pytessel 1.2.0__cp310-cp310-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pytessel might be problematic. Click here for more details.
- pytessel/__init__.py +3 -0
- pytessel/_version.py +1 -0
- pytessel/isosurface.cpp +561 -0
- pytessel/isosurface.h +180 -0
- pytessel/isosurface_mesh.cpp +144 -0
- pytessel/isosurface_mesh.h +104 -0
- pytessel/pytessel.cpython-310-darwin.so +0 -0
- pytessel/scalar_field.cpp +239 -0
- pytessel/scalar_field.h +104 -0
- pytessel-1.2.0.dist-info/LICENSE +674 -0
- pytessel-1.2.0.dist-info/METADATA +169 -0
- pytessel-1.2.0.dist-info/RECORD +14 -0
- pytessel-1.2.0.dist-info/WHEEL +5 -0
- pytessel-1.2.0.dist-info/top_level.txt +1 -0
pytessel/scalar_field.h
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* *
|
|
3
|
+
* Author: Ivo Filot <ivo@ivofilot.nl> *
|
|
4
|
+
* *
|
|
5
|
+
* PyTessel is free software: *
|
|
6
|
+
* you can redistribute it and/or modify it under the terms of the *
|
|
7
|
+
* GNU General Public License as published by the Free Software *
|
|
8
|
+
* Foundation, either version 3 of the License, or (at your option) *
|
|
9
|
+
* any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* PyTessel is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty *
|
|
13
|
+
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
14
|
+
* See the GNU General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU General Public License *
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
|
18
|
+
* *
|
|
19
|
+
**************************************************************************/
|
|
20
|
+
|
|
21
|
+
#pragma once
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include <array>
|
|
26
|
+
#include <algorithm>
|
|
27
|
+
|
|
28
|
+
#include "vec3.h"
|
|
29
|
+
|
|
30
|
+
class ScalarField{
|
|
31
|
+
private:
|
|
32
|
+
std::array<unsigned int, 3> grid_dimensions;
|
|
33
|
+
std::vector<float> grid;
|
|
34
|
+
mat33 unitcell;
|
|
35
|
+
mat33 unitcell_inverse;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @brief constructor
|
|
41
|
+
*
|
|
42
|
+
* @param[in] _filename url to filename
|
|
43
|
+
* @param[in] _flag_is_locpot whether this file is a locpot
|
|
44
|
+
* @param[in] _is_bin is binary file
|
|
45
|
+
*/
|
|
46
|
+
ScalarField(const std::vector<float>& grid,
|
|
47
|
+
const std::vector<unsigned int>& dimensions,
|
|
48
|
+
const std::vector<float>& unitcell);
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* float get_value_interp(x,y,z)
|
|
52
|
+
*
|
|
53
|
+
* Grabs a value from the 3D scalar field. Calculate the value
|
|
54
|
+
* by using a trilinear interpolation.
|
|
55
|
+
*
|
|
56
|
+
* The trilinear interpolation algorithm has been extracted from:
|
|
57
|
+
* http://paulbourke.net/miscellaneous/interpolation/
|
|
58
|
+
*
|
|
59
|
+
* Future algorithm can make use of a cubic interpolation.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
float get_value_interp(float x, float y, float z) const;
|
|
63
|
+
|
|
64
|
+
float get_value(unsigned int i, unsigned int j, unsigned int k) const;
|
|
65
|
+
|
|
66
|
+
Vec3 grid_to_realspace(float i, float j, float k) const;
|
|
67
|
+
|
|
68
|
+
Vec3 realspace_to_grid(float i, float j, float k) const;
|
|
69
|
+
|
|
70
|
+
Vec3 realspace_to_direct(float x, float y, float z) const;
|
|
71
|
+
|
|
72
|
+
void copy_grid_dimensions(unsigned int _grid_dimensions[]) const;
|
|
73
|
+
|
|
74
|
+
float get_max() const;
|
|
75
|
+
|
|
76
|
+
float get_min() const;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @brief test whether point is inside unit cell
|
|
80
|
+
*
|
|
81
|
+
* @param[in] x x position
|
|
82
|
+
* @param[in] y y position
|
|
83
|
+
* @param[in] z z position
|
|
84
|
+
*
|
|
85
|
+
* @return True if inside, False otherwise.
|
|
86
|
+
*/
|
|
87
|
+
bool is_inside(float x, float y, float z) const;
|
|
88
|
+
|
|
89
|
+
void inverse(const mat33& mat, mat33* invmat);
|
|
90
|
+
|
|
91
|
+
inline const mat33& get_mat_unitcell() const {
|
|
92
|
+
return this->unitcell;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
inline const mat33& get_mat_inverse() const {
|
|
96
|
+
return this->unitcell_inverse;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
std::vector<float> get_unitcell_vf() const;
|
|
100
|
+
|
|
101
|
+
std::vector<float> get_unitcell_inverse() const;
|
|
102
|
+
|
|
103
|
+
private:
|
|
104
|
+
};
|