AvogadroLibs 1.100.0
|
Provide a data structure for regularly spaced 3D grids. More...
#include <avogadro/core/cube.h>
Public Types | |
enum | Type { VdW , SolventAccessible , SolventExcluded , ESP , ElectronDensity , SpinDensity , MO , FromFile , None } |
Public Member Functions | |
Vector3 | min () const |
Vector3 | max () const |
Vector3 | spacing () const |
Vector3i | dimensions () const |
bool | setLimits (const Vector3 &min, const Vector3 &max, const Vector3i &points) |
bool | setLimits (const Vector3 &min, const Vector3 &max, float spacing) |
bool | setLimits (const Vector3 &min, const Vector3i &dim, float spacing) |
bool | setLimits (const Vector3 &min, const Vector3i &dim, const Vector3 &spacing) |
bool | setLimits (const Cube &cube) |
bool | setLimits (const Molecule &mol, float spacing, float padding) |
std::vector< float > * | data () |
const std::vector< float > * | data () const |
bool | setData (const std::vector< float > &values) |
bool | addData (const std::vector< float > &values) |
std::vector< float >::const_iterator | getRowIter (int j, int k) const |
unsigned int | closestIndex (const Vector3 &pos) const |
Vector3i | indexVector (const Vector3 &pos) const |
Vector3 | position (unsigned int index) const |
float | value (int i, int j, int k) const |
float | value (const Vector3i &pos) const |
float | valuef (const Vector3f &pos) const |
float | value (const Vector3 &pos) const |
bool | setValue (unsigned int i, unsigned int j, unsigned int k, float value) |
bool | setValue (unsigned int i, float value) |
void | fill (float value) |
bool | fillStripe (unsigned int i, unsigned int j, unsigned int kfirst, unsigned int klast, float value) |
float | minValue () const |
float | maxValue () const |
void | setName (const std::string &name_) |
std::string | name () const |
void | setCubeType (Type type) |
Type | cubeType () const |
Mutex * | lock () const |
std::array< float, 3 > | computeGradient (int i, int j, int k) const |
std::array< float, 8 > | getValsCube (int i, int j, int k) const |
std::array< std::array< float, 3 >, 8 > | getGradCube (int i, int j, int k) const |
float | getData (int i, int j, int k) const |
std::array< std::array< float, 3 >, 8 > | getPosCube (int i, int j, int k) const |
Protected Attributes | |
std::vector< float > | m_data |
Vector3 | m_min |
Vector3 | m_max |
Vector3 | m_spacing |
Vector3i | m_points |
float | m_minValue |
float | m_maxValue |
std::string | m_name |
Type | m_cubeType |
Mutex * | m_lock |
Vector3 min | ( | ) | const |
Vector3 max | ( | ) | const |
Vector3 spacing | ( | ) | const |
Vector3i dimensions | ( | ) | const |
bool setLimits | ( | const Vector3 & | min, |
const Vector3 & | max, | ||
const Vector3i & | points | ||
) |
Set the limits of the cube.
min | The minimum point in the cube. |
max | The maximum point in the cube. |
points | The number of (integer) points in the cube. |
bool setLimits | ( | const Vector3 & | min, |
const Vector3 & | max, | ||
float | spacing | ||
) |
Set the limits of the cube.
min | The minimum point in the cube. |
max | The maximum point in the cube. |
spacing | The interval between points in the cube. |
bool setLimits | ( | const Vector3 & | min, |
const Vector3i & | dim, | ||
float | spacing | ||
) |
Set the limits of the cube.
min | The minimum point in the cube. |
dim | The integer dimensions of the cube in x, y and z. |
spacing | The interval between points in the cube. |
bool setLimits | ( | const Vector3 & | min, |
const Vector3i & | dim, | ||
const Vector3 & | spacing | ||
) |
Set the limits of the cube.
min | The minimum point in the cube. |
dim | The integer dimensions of the cube in x, y and z. |
spacing | The interval between points in the cube. |
bool setLimits | ( | const Cube & | cube | ) |
bool setLimits | ( | const Molecule & | mol, |
float | spacing, | ||
float | padding | ||
) |
Set the limits of the cube.
mol | Molecule to take limits from |
spacing | The spacing of the regular grid |
padding | Padding around the molecule |
std::vector< float > * data | ( | ) |
bool setData | ( | const std::vector< float > & | values | ) |
Set the values in the cube to those passed in the vector.
bool addData | ( | const std::vector< float > & | values | ) |
Adds the values in the cube to those passed in the vector.
std::vector< float >::const_iterator getRowIter | ( | int | j, |
int | k | ||
) | const |
unsigned int closestIndex | ( | const Vector3 & | pos | ) | const |
pos | Position to get closest index for. |
Vector3i indexVector | ( | const Vector3 & | pos | ) | const |
pos | Position to get closest index for. |
Vector3 position | ( | unsigned int | index | ) | const |
index | Index to be translated to a position. |
float value | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
This function is very quick as it just returns the value at the point.
float value | ( | const Vector3i & | pos | ) | const |
This function is very quick as it just returns the value at the point.
float valuef | ( | const Vector3f & | pos | ) | const |
This function uses trilinear interpolation to find the value at points between those specified in the cube.
float value | ( | const Vector3 & | pos | ) | const |
This function uses trilinear interpolation to find the value at points between those specified in the cube.
bool setValue | ( | unsigned int | i, |
unsigned int | j, | ||
unsigned int | k, | ||
float | value | ||
) |
Sets the value at the specified point in the cube.
i | x component of the position. |
j | y component of the position. |
k | z component of the position. |
value | Value at the specified position. |
bool setValue | ( | unsigned int | i, |
float | value | ||
) |
Sets the value at the specified index in the cube.
i | 1-dimensional index of the point to set in the cube. |
void fill | ( | float | value | ) |
Sets all indices in the cube to the specified value.
value | Value to fill the cube with. |
bool fillStripe | ( | unsigned int | i, |
unsigned int | j, | ||
unsigned int | kfirst, | ||
unsigned int | klast, | ||
float | value | ||
) |
Sets all indices in a Z stripe of the cube to the specified value.
i | x component of the position. |
j | y component of the position. |
kfirst | first z position to fill. |
klast | last z position to fill. |
value | Value to fill the stripe with. |
float minValue | ( | ) | const |
float maxValue | ( | ) | const |
Mutex * lock | ( | ) | const |
Provides locking.
std::array< float, 3 > computeGradient | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Compute the gradient at a specific point in the cube.
i | x index |
j | y index |
k | z index |
std::array< float, 8 > getValsCube | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Get the values of the eight corners of a cube defined by the indices (i, j, k).
i | x index |
j | y index |
k | z index |
std::array< std::array< float, 3 >, 8 > getGradCube | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Get the gradients at the eight corners of the cube defined by the indices (i, j, k).
i | x index |
j | y index |
k | z index |
float getData | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Get the data value at the specified indices.
i | x index |
j | y index |
k | z index |
std::array< std::array< float, 3 >, 8 > getPosCube | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Retrieves the positions of the eight corners of a cube at grid indices (i, j, k).
The indices (i, j, k) are converted to real-space positions (xpos, ypos, zpos), mapping grid indices to physical coordinates. The method returns a cube that spans one step in each of the x, y, and z directions, with step sizes defined by m_spacing
.
i | X-index. |
j | Y-index. |
k | Z-index. |
std::array
of eight (x, y, z)
coordinates representing the cube's corners.