11#include <pscf/math/IntVec.h>
13#include <util/format/Int.h>
21 template <
int D>
class Mesh;
31 std::istream&
operator >> (std::istream& in, Mesh<D>& mesh);
41 std::ostream&
operator << (std::ostream& out, Mesh<D>
const & mesh);
146 bool isInMesh(
int coordinate,
int i)
const;
170 int shift(
int& coordinate,
int i)
const;
191 template <
class Archive>
192 void serialize(Archive& ar,
const unsigned int version);
207 friend std::istream& operator >> <>(std::istream&,
Mesh<D> & );
209 friend std::ostream& operator << <>(std::ostream&,
Mesh<D> const & );
218 {
return dimensions_; }
225 return dimensions_[i];
236 template <
class Archive>
239 for (
int i=0; i < D; ++i) {
249 for (
int i = 0; i < D; ++i) {
259 for (
int i = 0; i < D; ++i) {
260 out <<
" " <<
Int(mesh.dimensions_[i], 6);
265 #ifndef PSCF_MESH_TPP
An IntVec<D, T> is a D-component vector of elements of integer type T.
Description of a regular grid of points in a periodic domain.
IntVec< D > dimensions() const
Get an IntVec<D> of the grid dimensions.
Mesh< D > & operator=(Mesh< D > const &other)
Assignment operator.
int size() const
Get total number of grid points.
int rank(IntVec< D > const &position) const
Get the rank of a grid point with specified position.
bool isInMesh(int coordinate, int i) const
Is this coordinate in range?
IntVec< D > position(int rank) const
Get the position IntVec<D> of a grid point with a specified rank.
int shift(int &coordinate, int i) const
Shift a periodic coordinate into range.
void setDimensions(IntVec< D > const &dimensions)
Set the grid dimensions for an existing mesh.
void serialize(Archive &ar, const unsigned int version)
Serialize to/from an archive.
Mesh()
Default constructor.
int dimension(int i) const
Get grid dimension along Cartesian direction i.
Wrapper for an int, for formatted ostream output.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
const int Dimension
Dimensionality of space.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.