Avogadro  1.1.0
Public Types | Public Member Functions | Protected Attributes
Avogadro::Cube Class Reference

Data type holding regularly spaced data in a cube. More...

#include <avogadro/cube.h>

Inheritance diagram for Avogadro::Cube:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Type {
  VdW, ESP, ElectronDensity, MO,
  FromFile, None
}

Public Member Functions

 Cube (QObject *parent=0)
Eigen::Vector3d min () const
Eigen::Vector3d max () const
Eigen::Vector3d spacing () const
Eigen::Vector3i dimensions () const
bool setLimits (const Eigen::Vector3d &min, const Eigen::Vector3d &max, const Eigen::Vector3i &points)
bool setLimits (const Eigen::Vector3d &min, const Eigen::Vector3d &max, double spacing)
bool setLimits (const Eigen::Vector3d &min, const Eigen::Vector3i &dim, double spacing)
bool setLimits (const Cube &cube)
bool setLimits (const Molecule *mol, double spacing, double padding)
std::vector< double > * data ()
bool setData (const std::vector< double > &values)
bool addData (const std::vector< double > &values)
unsigned int closestIndex (const Eigen::Vector3d &pos) const
Eigen::Vector3i indexVector (const Eigen::Vector3d &pos) const
Eigen::Vector3d position (unsigned int index) const
double value (int i, int j, int k) const
double value (const Eigen::Vector3i &pos) const
float valuef (const Eigen::Vector3f &pos) const
double value (const Eigen::Vector3d &pos) const
bool setValue (int i, int j, int k, double value)
bool setValue (unsigned int i, double value)
double minValue () const
double maxValue () const
void setName (QString name)
QString name () const
void setCubeType (Type type)
Type cubeType ()
QReadWriteLocklock () const

Protected Attributes

std::vector< double > m_data
Eigen::Vector3d m_min
Eigen::Vector3d m_max
Eigen::Vector3d m_spacing
Eigen::Vector3i m_points
double m_minValue
double m_maxValue
QString m_name
Type m_cubeType
QReadWriteLockm_lock

Detailed Description

Data type holding regularly spaced data in a cube.

Author:
Marcus D. Hanwell

The Cube class is a Primitive subclass that provides storage for scalar values on a regularly spaced grid in three dimensions. This is typically used for things such as molecular orbital values, which can be rendered using other techniques.


Member Enumeration Documentation

This enum allows us to iterate through the various types of primitives.

Holds the primitive type

Reimplemented from Avogadro::Primitive.


Member Function Documentation

bool Avogadro::Cube::addData ( const std::vector< double > &  values)

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

unsigned int Avogadro::Cube::closestIndex ( const Eigen::Vector3d &  pos) const
Returns:
Index of the point closest to the position supplied.
Parameters:
posPosition to get closest index for.
std::vector< double > * Avogadro::Cube::data ( )
Returns:
Vector containing all the data in a one-dimensional array.
Eigen::Vector3i Avogadro::Cube::dimensions ( ) const [inline]
Returns:
The x, y and z dimensions of the cube.

Referenced by Avogadro::MeshGenerator::initialize(), and Avogadro::Molecule::OBMol().

Vector3i Avogadro::Cube::indexVector ( const Eigen::Vector3d &  pos) const
Returns:
Index vector of the point closest to the position supplied, in the form of i, j, k.
Parameters:
posPosition to get closest index for.
Returns:
The i, j, k index closest to the position supplied.
Eigen::Vector3d Avogadro::Cube::max ( ) const [inline]
Returns:
The maximum point in the cube.

Referenced by setLimits().

double Avogadro::Cube::maxValue ( ) const [inline]
Returns:
The minimum value at any point in the Cube.
Eigen::Vector3d Avogadro::Cube::min ( ) const [inline]
Returns:
The minimum point in the cube.

Referenced by Avogadro::MeshGenerator::initialize(), Avogadro::Molecule::OBMol(), and setLimits().

double Avogadro::Cube::minValue ( ) const [inline]
Returns:
The minimum value at any point in the Cube.
Vector3d Avogadro::Cube::position ( unsigned int  index) const
Parameters:
indexIndex to be translated to a position.
Returns:
Position of the given index.
bool Avogadro::Cube::setData ( const std::vector< double > &  values)

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

Referenced by Avogadro::Molecule::setOBMol().

bool Avogadro::Cube::setLimits ( const Eigen::Vector3d &  min,
const Eigen::Vector3d &  max,
const Eigen::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.

Referenced by setLimits(), and Avogadro::Molecule::setOBMol().

bool Avogadro::Cube::setLimits ( const Eigen::Vector3d &  min,
const Eigen::Vector3d &  max,
double  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.
bool Avogadro::Cube::setLimits ( const Eigen::Vector3d &  min,
const Eigen::Vector3i &  dim,
double  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.
bool Avogadro::Cube::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.
bool Avogadro::Cube::setLimits ( const Molecule mol,
double  spacing,
double  padding 
)

Set the limits of the cube by the molecule supplied with padding.

Parameters:
molThe molecule to use when finding bounds.
spacingThe interval between points in the cube.
paddingThe padding to use around the extents of the molecule.

References QList::at(), Avogadro::Molecule::atoms(), max(), min(), Avogadro::Atom::pos(), setLimits(), and QList::size().

bool Avogadro::Cube::setValue ( int  i,
int  j,
int  k,
double  value 
)

Sets the value at the specified point in the cube.

Parameters:
ix compenent of the position.
jy compenent of the position.
kz compenent of the position.
valueValue at the specified position.

References Avogadro::Primitive::index(), and value().

bool Avogadro::Cube::setValue ( unsigned int  i,
double  value 
) [inline]

Sets the value at the specified index in the cube.

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

References value().

Eigen::Vector3d Avogadro::Cube::spacing ( ) const [inline]
Returns:
The spacing of the grid.

Referenced by Avogadro::MeshGenerator::initialize(), and Avogadro::Molecule::OBMol().

double Avogadro::Cube::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.

References Avogadro::Primitive::index().

Referenced by Avogadro::MeshGenerator::marchingCube(), setValue(), and valuef().

double Avogadro::Cube::value ( const Eigen::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.
double Avogadro::Cube::value ( const Eigen::Vector3d &  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.
float Avogadro::Cube::valuef ( const Eigen::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.

References value().

Referenced by Avogadro::MeshGenerator::normal().


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