SUNphi  1.0
SUNphi::Grid< NDims, Coord, Idx, Flags > Class Template Reference

A grid of points spanning an hypercubic grid. More...

#include <Grid.hpp>

Inheritance diagram for SUNphi::Grid< NDims, Coord, Idx, Flags >:
SUNphi::GridHashable< Grid< NDims, Coord, Idx, Flags >, NDims, Coord, Idx, getFlag< Flags, GridFlag::HASHED > > SUNphi::GridShiftableBC< Grid< NDims, Coord, Idx, Flags >, NDims, Coord, Idx, getFlag< Flags, GridFlag::SHIFTED_BC > >

Public Types

typedef std::array< Coord, NDims > Coords
 
typedef std::array< Coord, 2 *NDims > Neigh
 
typedef Idx Vol
 
typedef Coord Side
 
typedef Coords Sides
 

Public Member Functions

const Idx & volume () const
 Get the volume.
 
Side side (const int mu) const
 Get the given side.
 
Sides sides () const
 Get all sides.
 
void assertPointIsInRange (const Idx &i) const
 Check that a given point is in range.
 
void assertOriDirIsInRange (const int &oriDir) const
 Check that a given oriented dir is in range.
 
void assertCoordsAreInRange (const Coords &cs) const
 Check that a given set of coords are in range. More...
 
template<typename F >
void forAllPoints (F &&f) const
 Loop on all points calling the passed function. More...
 
int dimOfOriDir (const int oriDir) const
 Dimension of an oriented directions.
 
int oriDirOfOriAndDim (const Orientation ori, const int dim) const
 Oriented direction given orientation and dimension.
 
void setSides (const Sides &extSides)
 Set the sides and trigger the volume change.
 
Coords computeCoordsOfPoint (Idx i) const
 Compte the coordinate of point i. More...
 
Idx pointOfCoords (const Coords &cs) const
 Compute the point of given coords. More...
 
Coords shiftedCoords (const Coords &in, const int oriDir, const Coord amount=1) const
 
Idx computeNeighOfPoint (const Idx i, const int oriDir) const
 Compute the neighbor in the oriented direction oriDir of point i. More...
 
 Grid (const Sides &sides={})
 Construct from sides.
 

Static Public Member Functions

template<typename F >
static void forAllDims (F &&f)
 Loop on all dimension calling the passed function. More...
 
template<typename F >
static void forAllOriDirs (F &&f)
 Loop on all oriented directions calling the passed function. More...
 
static Orientation oriOfOriDir (const int oriDir)
 Orientation of an oriented directions. More...
 

Static Public Attributes

static constexpr int flags
 Flags of the class. More...
 
static constexpr bool isHashing
 Extract the flag determining whether is hashing. More...
 
static constexpr bool isShiftingBC
 Extract the flag determining whether BC might be shifted. More...
 
static constexpr int nDims
 Number of dimensions. More...
 
static constexpr int nOriDirs
 Number of oriented directions. More...
 

Private Member Functions

void setVolume ()
 Set the volume, calling computing routine. More...
 

Private Attributes

Sides _sides
 Side of the grid.
 
Idx _volume
 Volume of the grid.
 

Detailed Description

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
class SUNphi::Grid< NDims, Coord, Idx, Flags >

A grid of points spanning an hypercubic grid.

Definition at line 402 of file Grid.hpp.

Member Typedef Documentation

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
typedef std::array<Coord,NDims> SUNphi::Grid< NDims, Coord, Idx, Flags >::Coords

Type to hold sizes, coordinate, etc

Definition at line 416 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
typedef std::array<Coord,2*NDims> SUNphi::Grid< NDims, Coord, Idx, Flags >::Neigh

Type to hold the neighbors

Definition at line 416 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
typedef Coord SUNphi::Grid< NDims, Coord, Idx, Flags >::Side

Type to hold side

Definition at line 416 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
typedef Coords SUNphi::Grid< NDims, Coord, Idx, Flags >::Sides

Type to hold sides

Definition at line 416 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
typedef Idx SUNphi::Grid< NDims, Coord, Idx, Flags >::Vol

Type to hold volume

Definition at line 416 of file Grid.hpp.

Member Function Documentation

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
void SUNphi::Grid< NDims, Coord, Idx, Flags >::assertCoordsAreInRange ( const Coords cs) const
inline

Check that a given set of coords are in range.

Maximal value

Coord mu value

Definition at line 506 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
Coords SUNphi::Grid< NDims, Coord, Idx, Flags >::computeCoordsOfPoint ( Idx  i) const
inline

Compte the coordinate of point i.

Result

Dividend, corresponding to the mu side length

Quozient, corresponding to the index of the remaining nDims-1 components

Remainder, corresponding to the coordinate

Definition at line 596 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
Idx SUNphi::Grid< NDims, Coord, Idx, Flags >::computeNeighOfPoint ( const Idx  i,
const int  oriDir 
) const
inline

Compute the neighbor in the oriented direction oriDir of point i.

Parameters
iPoint
oriDirOriented direction

Definition at line 700 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
template<typename F >
static void SUNphi::Grid< NDims, Coord, Idx, Flags >::forAllDims ( F &&  f)
inlinestatic

Loop on all dimension calling the passed function.

Parameters
fFunction to be called

Definition at line 527 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
template<typename F >
static void SUNphi::Grid< NDims, Coord, Idx, Flags >::forAllOriDirs ( F &&  f)
inlinestatic

Loop on all oriented directions calling the passed function.

Parameters
fFunction to be called

Definition at line 535 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
template<typename F >
void SUNphi::Grid< NDims, Coord, Idx, Flags >::forAllPoints ( F &&  f) const
inline

Loop on all points calling the passed function.

Parameters
fFunction to be called

Definition at line 543 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
static Orientation SUNphi::Grid< NDims, Coord, Idx, Flags >::oriOfOriDir ( const int  oriDir)
inlinestatic

Orientation of an oriented directions.

Output orientation

Definition at line 552 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
Idx SUNphi::Grid< NDims, Coord, Idx, Flags >::pointOfCoords ( const Coords cs) const
inline

Compute the point of given coords.

< Coordinates of the point

Returned point

Grid side

Definition at line 627 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
void SUNphi::Grid< NDims, Coord, Idx, Flags >::setVolume ( )
inlineprivate

Set the volume, calling computing routine.

Output volume, initially 1

Definition at line 427 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
Coords SUNphi::Grid< NDims, Coord, Idx, Flags >::shiftedCoords ( const Coords in,
const int  oriDir,
const Coord  amount = 1 
) const
inline

Returns the coordinates shifted in the asked direction

Periodic boundary conditions are always assumed

Returned coordinates

Orientation

Direction to shift

Offset to add

Destintion not considering wrap

Actual destintion

Absolute number of boundaries passed

Parameters
inInput coordinates
oriDirOriented direction
amountNumber of steps

Definition at line 653 of file Grid.hpp.

Member Data Documentation

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
constexpr int SUNphi::Grid< NDims, Coord, Idx, Flags >::flags
static
Initial value:
=
Flags

Flags of the class.

Definition at line 444 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
constexpr bool SUNphi::Grid< NDims, Coord, Idx, Flags >::isHashing
static
Initial value:
=
getFlag<flags,GridFlag::HASHED>

Extract the flag determining whether is hashing.

Definition at line 448 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
constexpr bool SUNphi::Grid< NDims, Coord, Idx, Flags >::isShiftingBC
static
Initial value:
=
getFlag<flags,GridFlag::SHIFTED_BC>

Extract the flag determining whether BC might be shifted.

Definition at line 452 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
constexpr int SUNphi::Grid< NDims, Coord, Idx, Flags >::nDims
static
Initial value:
=
NDims

Number of dimensions.

Definition at line 456 of file Grid.hpp.

template<int NDims = 4, typename Coord = int32_t, typename Idx = int64_t, int Flags = GRID_DEFAULT_FLAGS>
constexpr int SUNphi::Grid< NDims, Coord, Idx, Flags >::nOriDirs
static
Initial value:
=
2*NDims

Number of oriented directions.

Definition at line 460 of file Grid.hpp.


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