GQCP
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
GQCP::CubicGrid Class Reference

#include <CubicGrid.hpp>

Collaboration diagram for GQCP::CubicGrid:
Collaboration graph

Public Member Functions

 CubicGrid (const Vector< double, 3 > &origin, const std::array< size_t, 3 > &numbers_of_steps, const std::array< double, 3 > &step_sizes)
 
template<typename OutputType >
Field< OutputType > evaluate (const Function< OutputType, Vector< double, 3 > > &function) const
 
template<typename T >
integrate (const Field< T > &field) const
 
void forEach (const std::function< void(const size_t, const size_t, const size_t)> &callback) const
 
void forEach (const std::function< void(const Vector< double, 3 > &)> &callback) const
 
size_t numberOfPoints () const
 
const Vector< double, 3 > & origin () const
 
Vector< double, 3 > position (const size_t i, const size_t j, const size_t k) const
 
std::vector< Vector< double, 3 > > points () const
 
size_t numbersOfSteps (const size_t axis) const
 
const std::array< size_t, 3 > & numbersOfSteps () const
 
double stepSize (const size_t axis) const
 
const std::array< double, 3 > & stepSizes () const
 
double totalVolume () const
 
void writeToCubeFile (const Field< double > &scalar_field, const std::string &filename, const Molecule &molecule) const
 
double voxelVolume () const
 

Static Public Member Functions

static CubicGrid Centered (const Vector< double, 3 > &point, const size_t number_of_steps, const double step_size)
 
static CubicGrid ReadCubeFile (const std::string &filename)
 
static CubicGrid ReadRegularGridFile (const std::string &filename)
 

Detailed Description

A grid type whose points are on a regular cubic lattice.

Constructor & Destructor Documentation

◆ CubicGrid()

GQCP::CubicGrid::CubicGrid ( const Vector< double, 3 > &  origin,
const std::array< size_t, 3 > &  numbers_of_steps,
const std::array< double, 3 > &  step_sizes 
)
Parameters
originthe origin of the grid
numbers_of_stepsthe number of steps in the x, y, z-directions
step_sizesthe step sizes in the x, y, z-directions

Member Function Documentation

◆ Centered()

CubicGrid GQCP::CubicGrid::Centered ( const Vector< double, 3 > &  point,
const size_t  number_of_steps,
const double  step_size 
)
static

Create a cubic ground that is centered around the given point. Equal numbers of steps and step sizes are taken in the x-, y- and z-directions.

Parameters
pointthe point around which the grid should be centered
number_of_stepsthe number of steps that should be taken in the x-, y- and z-directions
step_sizethe size of the steps that should be taken in the x-, y- and z-directions

◆ evaluate()

template<typename OutputType >
Field< OutputType > GQCP::CubicGrid::evaluate ( const Function< OutputType, Vector< double, 3 > > &  function) const
inline

Evaluate a function on every point of this grid.

Parameters
functionThe function whose values should be evaluated.
Returns
A field with the calculated evaluations.

◆ forEach() [1/2]

void GQCP::CubicGrid::forEach ( const std::function< void(const size_t, const size_t, const size_t)> &  callback) const

Loop over the points of this grid by index number.

Parameters
callbackthe function you would like to apply to each incoming (i,j,k)-tuple of numbers of steps taken in the x,y,z-direction.

◆ forEach() [2/2]

void GQCP::CubicGrid::forEach ( const std::function< void(const Vector< double, 3 > &)> &  callback) const

Loop over the points of this grid by position (relative to the origin of this grid).

Parameters
callbackthe function you would like to apply to each incoming position vector

◆ integrate()

template<typename T >
T GQCP::CubicGrid::integrate ( const Field< T > &  field) const
inline

Integrate a Field over this grid.

Parameters
fieldthe field that should be integrated, i.e. provided as the integrand
Returns
the value of the integral

◆ numberOfPoints()

size_t GQCP::CubicGrid::numberOfPoints ( ) const
Returns
the number of points that are in this grid

◆ numbersOfSteps() [1/2]

const std::array< size_t, 3 > & GQCP::CubicGrid::numbersOfSteps ( ) const
inline
Returns
the number of steps in the x, y, z-directions

◆ numbersOfSteps() [2/2]

size_t GQCP::CubicGrid::numbersOfSteps ( const size_t  axis) const
inline
Parameters
axis0, 1, 2 representing the x-, y-, or z-axis
Returns
the number of steps that can be taken in the direction of the specified axis

◆ origin()

const Vector< double, 3 > & GQCP::CubicGrid::origin ( ) const
inline
Returns
the origin of this grid

◆ points()

std::vector< Vector< double, 3 > > GQCP::CubicGrid::points ( ) const
Returns
a vector of the points that are described by this grid

◆ position()

Vector< double, 3 > GQCP::CubicGrid::position ( const size_t  i,
const size_t  j,
const size_t  k 
) const
Parameters
ithe number of steps taken in the x-direction
jthe number of steps taken in the y-direction
kthe number of steps taken in the z-direction
Returns
the position vector associated to the given indices

◆ ReadCubeFile()

CubicGrid GQCP::CubicGrid::ReadCubeFile ( const std::string &  filename)
static

Parse a GAUSSIAN Cube file (http://paulbourke.net/dataformats/cube/). The values for the contained scalar field are ignored.

Parameters
filenamethe name of the cubefile
Note
The Cube file is assumed to have grid axes oriented along the x-, y-, and z-axes.

◆ ReadRegularGridFile()

CubicGrid GQCP::CubicGrid::ReadRegularGridFile ( const std::string &  filename)
static

Parse an .rgrid-file and create the CubicGrid that is contained in it. The values for the scalar field or vector field are ignored.

Parameters
filenamethe name of the .igrid-file
Note
A regular grid (.rgrid) file is a headerless file and contains the following data:
  • Each row relates to one grid point, where the fastest changing values are z > y > x.
  • Column specification:
    • Column 1: The index from 1 to the number of grid points
    • Columns 2-4: The position of the grid point: x, y, and z
    • Optional: Column 5 or columns 5-7: 1 value for a scalar field, 3 values for a vector field

◆ stepSize()

double GQCP::CubicGrid::stepSize ( const size_t  axis) const
inline
Parameters
axis0, 1, 2 representing the x-, y-, or z-axis
Returns
the step size that is taken in the direction of the specified axis

◆ stepSizes()

const std::array< double, 3 > & GQCP::CubicGrid::stepSizes ( ) const
inline
Returns
the step sizes in the x, y, z-directions

◆ totalVolume()

double GQCP::CubicGrid::totalVolume ( ) const
inline
Returns
the total volume that is contained in this grid

◆ voxelVolume()

double GQCP::CubicGrid::voxelVolume ( ) const
Returns
the volume of one voxel in this grid

◆ writeToCubeFile()

void GQCP::CubicGrid::writeToCubeFile ( const Field< double > &  scalar_field,
const std::string &  filename,
const Molecule molecule 
) const

Write a field's values to a GAUSSIAN Cube file (http://paulbourke.net/dataformats/cube/).

Parameters
scalar_fieldthe scalar field that should be written to the cubefile
filenamethe name of the cubefile that has to be generated
moleculethe molecule that should be placed in the cubefile

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