AvogadroLibs 1.97.0
Public Types | Public Member Functions | Protected Attributes | List of all members
Cube Class Reference

Provide a data structure for regularly spaced 3D grids. More...

#include <avogadro/core/cube.h>

Public Types

enum  Type {
  VdW ,
  ESP ,
  ElectronDensity ,
  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)
 
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
 
Mutexlock () 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
 
Mutexm_lock
 

Detailed Description

Author
Marcus D. Hanwell

Member Enumeration Documentation

◆ Type

enum Type

Different Cube types relating to the data

Member Function Documentation

◆ min()

Vector3 min ( ) const
Returns
The minimum point in the cube.

◆ max()

Vector3 max ( ) const
Returns
The maximum point in the cube.

◆ spacing()

Vector3 spacing ( ) const
Returns
The spacing of the grid.

◆ dimensions()

Vector3i dimensions ( ) const
Returns
The x, y and z dimensions of the cube.

◆ setLimits() [1/6]

bool setLimits ( const Vector3 &  min,
const Vector3 &  max,
const Vector3i &  points 
)

Set the limits of the cube.

Parameters
minThe minimum point in the cube.
maxThe maximum point in the cube.
pointsThe number of (integer) points in the cube.

◆ setLimits() [2/6]

bool setLimits ( const Vector3 &  min,
const Vector3 &  max,
float  spacing 
)

Set the limits of the cube.

Parameters
minThe minimum point in the cube.
maxThe maximum point in the cube.
spacingThe interval between points in the cube.

◆ setLimits() [3/6]

bool setLimits ( const Vector3 &  min,
const Vector3i &  dim,
float  spacing 
)

Set the limits of the cube.

Parameters
minThe minimum point in the cube.
dimThe integer dimensions of the cube in x, y and z.
spacingThe interval between points in the cube.

◆ setLimits() [4/6]

bool setLimits ( const Vector3 &  min,
const Vector3i &  dim,
const Vector3 &  spacing 
)

Set the limits of the cube.

Parameters
minThe minimum point in the cube.
dimThe integer dimensions of the cube in x, y and z.
spacingThe interval between points in the cube.

◆ setLimits() [5/6]

bool setLimits ( const Cube cube)

Set the limits of the cube - copy the limits of an existing Cube.

Parameters
cubeExisting Cube to copy the limits from.

◆ setLimits() [6/6]

bool setLimits ( const Molecule mol,
float  spacing,
float  padding 
)

Set the limits of the cube.

Parameters
molMolecule to take limits from
spacingThe spacing of the regular grid
paddingPadding around the molecule

◆ data()

std::vector< float > * data ( )
Returns
Vector containing all the data in a one-dimensional array.

◆ setData()

bool setData ( const std::vector< float > &  values)

Set the values in the cube to those passed in the vector.

◆ addData()

bool addData ( const std::vector< float > &  values)

Adds the values in the cube to those passed in the vector.

◆ closestIndex()

unsigned int closestIndex ( const Vector3 &  pos) const
Returns
Index of the point closest to the position supplied.
Parameters
posPosition to get closest index for.

◆ indexVector()

Vector3i indexVector ( const Vector3 &  pos) const
Parameters
posPosition to get closest index for.
Returns
The i, j, k index closest to the position supplied.

◆ position()

Vector3 position ( unsigned int  index) const
Parameters
indexIndex to be translated to a position.
Returns
Position of the given index.

◆ value() [1/3]

float value ( int  i,
int  j,
int  k 
) const

This function is very quick as it just returns the value at the point.

Returns
Cube value at the integer point i, j, k.

◆ value() [2/3]

float value ( const Vector3i &  pos) const

This function is very quick as it just returns the value at the point.

Returns
Cube value at the integer point pos.

◆ valuef()

float valuef ( const Vector3f &  pos) const

This function uses trilinear interpolation to find the value at points between those specified in the cube.

Returns
Cube value at the specified position.
Warning
This function is quite computationally expensive and should be avoided where possible.

◆ value() [3/3]

float value ( const Vector3 &  pos) const

This function uses trilinear interpolation to find the value at points between those specified in the cube.

Returns
Cube value at the specified position.
Warning
This function is quite computationally expensive and should be avoided where possible.

◆ setValue() [1/2]

bool setValue ( unsigned int  i,
unsigned int  j,
unsigned int  k,
float  value 
)

Sets the value at the specified point in the cube.

Parameters
ix component of the position.
jy component of the position.
kz component of the position.
valueValue at the specified position.

◆ setValue() [2/2]

bool setValue ( unsigned int  i,
float  value 
)

Sets the value at the specified index in the cube.

Parameters
i1-dimensional index of the point to set in the cube.

◆ fill()

void fill ( float  value)

Sets all indices in the cube to the specified value.

Parameters
valueValue to fill the cube with.

◆ fillStripe()

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.

Parameters
ix component of the position.
jy component of the position.
kfirstfirst z position to fill.
klastlast z position to fill.
valueValue to fill the stripe with.

◆ minValue()

float minValue ( ) const
Returns
The minimum value at any point in the Cube.

◆ maxValue()

float maxValue ( ) const
Returns
The maximum value at any point in the Cube.

◆ lock()

Mutex * lock ( ) const

Provides locking.


The documentation for this class was generated from the following file: