PSCF v1.1
|
Description of a regular grid of points in a periodic domain. More...
#include <Mesh.h>
Public Member Functions | |
Mesh () | |
Default constructor. More... | |
Mesh (Mesh< D > const &other) | |
Copy constructor. More... | |
Mesh (IntVec< D > const &dimensions) | |
Constructor from grid dimensions. More... | |
Mesh< D > & | operator= (Mesh< D > const &other) |
Assignment operator. More... | |
void | setDimensions (IntVec< D > const &dimensions) |
Set the grid dimensions for an existing mesh. More... | |
IntVec< D > | dimensions () const |
Get an IntVec<D> of the grid dimensions. More... | |
int | dimension (int i) const |
Get grid dimension along Cartesian direction i. More... | |
int | size () const |
Get total number of grid points. More... | |
IntVec< D > | position (int rank) const |
Get the position IntVec<D> of a grid point with a specified rank. More... | |
int | rank (IntVec< D > const &position) const |
Get the rank of a grid point with specified position. More... | |
bool | isInMesh (int coordinate, int i) const |
Is this coordinate in range? More... | |
bool | isInMesh (IntVec< D > const &position) const |
Is this IntVec<D> grid position within the grid? More... | |
int | shift (int &coordinate, int i) const |
Shift a periodic coordinate into range. More... | |
IntVec< D > | shift (IntVec< D > &position) const |
Shift a periodic position into primary grid. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize to/from an archive. More... | |
Friends | |
std::istream & | operator>> (std::istream &, Mesh< D > &) |
Input stream extractor for reading a Mesh<D> object. More... | |
std::ostream & | operator<< (std::ostream &, Mesh< D > const &) |
Output stream inserter for writing a Mesh<D> object. More... | |
Description of a regular grid of points in a periodic domain.
The coordinates of a point on a grid form an IntVec<D>, referred to here as a grid position. Each element of a grid position must lie in the range 0 <= position[i] < dimension(i), where i indexes a Cartesian axis, and dimension(i) is the dimension of the grid along axis i.
Each grid position is also assigned a non-negative integer rank. Mesh position ranks are ordered sequentially like elements in a multi-dimensional C array, with the last coordinate being the most rapidly varying.
Pscf::Mesh< D >::Mesh |
Pscf::Mesh< D >::Mesh | ( | Mesh< D > const & | other | ) |
Pscf::Mesh< D >::Mesh | ( | IntVec< D > const & | dimensions | ) |
Constructor from grid dimensions.
dimensions | IntVec<D> of grid dimensions |
Definition at line 37 of file Mesh.tpp.
References Pscf::Mesh< D >::dimensions(), and Pscf::Mesh< D >::setDimensions().
Mesh< D > & Pscf::Mesh< D >::operator= | ( | Mesh< D > const & | other | ) |
void Pscf::Mesh< D >::setDimensions | ( | IntVec< D > const & | dimensions | ) |
Set the grid dimensions for an existing mesh.
dimensions | IntVec<D> of grid dimensions. |
Definition at line 53 of file Mesh.tpp.
References UTIL_THROW.
Referenced by Pscf::Mesh< D >::Mesh().
|
inline |
Get an IntVec<D> of the grid dimensions.
Definition at line 217 of file Mesh.h.
Referenced by Pscf::Pspc::Propagator< D >::allocate(), Pscf::Pspg::WaveList< D >::allocate(), Pscf::Pspg::WaveList< D >::computeMinimumImages(), Pscf::Basis< D >::makeBasis(), Pscf::Mesh< D >::Mesh(), Pscf::Pspc::Block< D >::setDiscretization(), Pscf::Pspg::Block< D >::setDiscretization(), Pscf::Pspc::Solvent< D >::setDiscretization(), and Pscf::Pspg::Solvent< D >::setDiscretization().
|
inline |
Get grid dimension along Cartesian direction i.
i | index of Cartesian direction 0 <=i < Util::Dimension |
Definition at line 221 of file Mesh.h.
References Util::Dimension.
Referenced by Pscf::Pspg::WaveList< D >::allocate(), and Pscf::Pspg::WaveList< D >::computeMinimumImages().
|
inline |
Get total number of grid points.
Value size() == 0 will be obtained iff the mesh was default constructed and has not yet been given meaningful initial values.
Definition at line 229 of file Mesh.h.
Referenced by pscfpp.file.File::__eq__(), pscfpp.text.Record::__init__(), pscfpp.file.File::__init__(), pscfpp.file.File::__repr__(), pscfpp.text.Record::__str__(), Pscf::Pspg::Propagator< D >::allocate(), Pscf::Pspg::WaveList< D >::allocate(), Pscf::Pspg::WaveList< D >::computeMinimumImages(), Pscf::Pspg::FieldIo< D >::convertBasisToKGrid(), Pscf::Pspc::FieldIo< D >::convertBasisToKGrid(), Pscf::Basis< D >::makeBasis(), Pscf::Pspc::Block< D >::setDiscretization(), and Pscf::Pspg::Block< D >::setDiscretization().
IntVec< D > Pscf::Mesh< D >::position | ( | int | rank | ) | const |
int Pscf::Mesh< D >::rank | ( | IntVec< D > const & | position | ) | const |
Get the rank of a grid point with specified position.
position | integer position of a grid point |
Definition at line 72 of file Mesh.tpp.
Referenced by Pscf::Pspg::WaveList< D >::computeMinimumImages(), Pscf::Pspg::FieldIo< D >::convertBasisToKGrid(), Pscf::Pspc::FieldIo< D >::convertBasisToKGrid(), Pscf::Pspg::FieldIo< D >::convertKGridToBasis(), Pscf::Pspc::FieldIo< D >::convertKGridToBasis(), and Pscf::Pspc::FieldIo< D >::hasSymmetry().
bool Pscf::Mesh< D >::isInMesh | ( | int | coordinate, |
int | i | ||
) | const |
bool Pscf::Mesh< D >::isInMesh | ( | IntVec< D > const & | position | ) | const |
int Pscf::Mesh< D >::shift | ( | int & | coordinate, |
int | i | ||
) | const |
Shift a periodic coordinate into range.
Upon return, the coordinate will be shifted to lie within the range 0 <= coordinate < dimension(i) by subtracting an integer multiple of dimension(i), giving coordinate - shift*dimension(i). The return value is the required integer ‘shift’.
coordinate | coordinate in Cartesian direction i. |
i | index of Cartesian direction, i >= 0. |
Definition at line 131 of file Mesh.tpp.
Referenced by Pscf::Pspg::WaveList< D >::computeMinimumImages().
IntVec< D > Pscf::Mesh< D >::shift | ( | IntVec< D > & | position | ) | const |
Shift a periodic position into primary grid.
Upon return, each element of the parameter position is shifted to lie within the range 0 <= position[i] < dimension(i) by adding or subtracting an integer multiple of dimension(i). The IntVec<D> of shift values is returned.
position | IntVec<D> position within a grid. |
void Pscf::Mesh< D >::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
|
friend |
|
friend |