#include <lattice.h>
A container class to hold all the arrays on the lattice and access them.
T | The type of the contained values. |
Public Types | |
using | iterator = typename std::vector< T >::iterator |
Iterator of lattice. More... | |
using | const_iterator = typename std::vector< T >::const_iterator |
Const interator of lattice. More... | |
Public Member Functions | |
RectangularLattice (const std::array< double, 3 > &l, const std::array< int, 3 > &n, const std::array< double, 3 > &orig, bool per, const LatticeUpdate upd) | |
Rectangular lattice constructor. More... | |
void | reset () |
Sets all values on lattice to zeros. More... | |
bool | out_of_bounds (int ix, int iy, int iz) const |
Checks if 3D index is out of lattice bounds. More... | |
ThreeVector | cell_center (int ix, int iy, int iz) const |
Find the coordinates of a given cell. More... | |
ThreeVector | cell_center (int index) const |
Find the coordinate of cell center given the 1d index of the cell. More... | |
const std::array< double, 3 > & | lattice_sizes () const |
const std::array< int, 3 > & | dimensions () const |
const std::array< double, 3 > & | cell_sizes () const |
const std::array< double, 3 > & | origin () const |
bool | periodic () const |
LatticeUpdate | when_update () const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
T & | operator[] (std::size_t i) |
const T & | operator[] (std::size_t i) const |
std::size_t | size () const |
T & | node (int ix, int iy, int iz) |
Take the value of a cell given its 3-D indices. More... | |
bool | value_at (const ThreeVector &r, T &value) |
Interpolates lattice quantity to coordinate r. More... | |
template<typename F > | |
void | iterate_sublattice (const std::array< int, 3 > &lower_bounds, const std::array< int, 3 > &upper_bounds, F &&func) |
A sub-lattice iterator, which iterates in a 3D-structured manner and calls a function on every cell. More... | |
template<typename F > | |
void | iterate_in_radius (const ThreeVector &point, const double r_cut, F &&func) |
Iterates only nodes, whose cell centers lie not further than r_cut in x, y, z directions from the given point and applies a function to each node. More... | |
template<typename L > | |
bool | identical_to_lattice (const L *lat) const |
Checks if lattices of possibly different types have identical structure. More... | |
Protected Attributes | |
std::vector< T > | lattice_ |
The lattice itself, array containing physical quantities. More... | |
const std::array< double, 3 > | lattice_sizes_ |
Lattice sizes in x, y, z directions. More... | |
const std::array< int, 3 > | n_cells_ |
Number of cells in x,y,z directions. More... | |
const std::array< double, 3 > | cell_sizes_ |
Cell sizes in x, y, z directions. More... | |
const std::array< double, 3 > | origin_ |
Coordinates of the left down nearer corner. More... | |
const bool | periodic_ |
Whether the lattice is periodic. More... | |
const LatticeUpdate | when_update_ |
When the lattice should be recalculated. More... | |
Private Member Functions | |
int | positive_modulo (int i, int n) const |
Returns division modulo, which is always between 0 and n-1 in is not suitable, because it returns results from -(n-1) to n-1. More... | |
using smash::RectangularLattice< T >::iterator = typename std::vector<T>::iterator |
using smash::RectangularLattice< T >::const_iterator = typename std::vector<T>::const_iterator |
|
inline |
Rectangular lattice constructor.
[in] | l | 3-dimensional array (lx,ly,lz) indicates the size of the lattice in x, y, z directions respectively [fm]. |
[in] | n | 3-dimensional array (nx,ny,nz) indicates the number of cells of the lattice in x, y, z directions respectively. Each cell in the lattice is labeled by three integers i, j, k where \(i\in[0, nx-1]\), \(j\in[0, ny-1]\), \(k\in[0, nz-1]\). The sizes of each cell are given by lx/nx, ly/ny, lz/nz in x,y,z directions respectively. |
[in] | orig | A 3-dimensional array indicating the coordinates of the origin [fm]. |
[in] | per | Boolean indicating whether a periodic boundary condition is applied. |
[in] | upd | Enum indicating how frequently the lattice is updated. |
Definition at line 65 of file lattice.h.
|
inline |
Sets all values on lattice to zeros.
Definition at line 92 of file lattice.h.
|
inline |
Checks if 3D index is out of lattice bounds.
[in] | ix | The index of the cell in x direction. |
[in] | iy | The index of the cell in y direction. |
[in] | iz | The index of the cell in z direction. |
Definition at line 102 of file lattice.h.
|
inline |
Find the coordinates of a given cell.
[in] | ix | The index of the cell in x direction. |
[in] | iy | The index of the cell in y direction. |
[in] | iz | The index of the cell in z direction. |
Definition at line 119 of file lattice.h.
|
inline |
Find the coordinate of cell center given the 1d index of the cell.
[in] | index | 1-dimensional index of the given cell. It can be related to a 3-dimensional one by index = ix + nx (iy + iz * ny). |
Definition at line 133 of file lattice.h.
|
inline |
Definition at line 142 of file lattice.h.
|
inline |
Definition at line 145 of file lattice.h.
|
inline |
Definition at line 148 of file lattice.h.
|
inline |
Definition at line 151 of file lattice.h.
|
inline |
Definition at line 154 of file lattice.h.
|
inline |
Definition at line 157 of file lattice.h.
|
inline |
Definition at line 164 of file lattice.h.
|
inline |
Definition at line 166 of file lattice.h.
|
inline |
Definition at line 168 of file lattice.h.
|
inline |
Definition at line 170 of file lattice.h.
|
inline |
Definition at line 172 of file lattice.h.
|
inline |
Definition at line 174 of file lattice.h.
|
inline |
Definition at line 176 of file lattice.h.
|
inline |
Take the value of a cell given its 3-D indices.
[in] | ix | The index of the cell in x direction. |
[in] | iy | The index of the cell in y direction. |
[in] | iz | The index of the cell in z direction. |
Definition at line 186 of file lattice.h.
|
inline |
Interpolates lattice quantity to coordinate r.
Result is stored in the value variable. Returns true if coordinate r is on the lattice, false if out of the lattice. In the latter case, the value is set to the default value (usually 0).
[in] | r | Position where the physical quantity would be evaluated. |
[out] | value | Physical quantity evaluated at the nearest cell to the given position. |
Definition at line 209 of file lattice.h.
|
inline |
A sub-lattice iterator, which iterates in a 3D-structured manner and calls a function on every cell.
F | Type of the function. Arguments are the current node and the 3 integer indices of the cell. |
[in] | lower_bounds | Starting numbers for iterating ix, iy, iz. |
[in] | upper_bounds | Ending numbers for iterating ix, iy, iz. |
[in] | func | Function acting on the cells (such as taking value). |
Definition at line 233 of file lattice.h.
|
inline |
Iterates only nodes, whose cell centers lie not further than r_cut in x, y, z directions from the given point and applies a function to each node.
Useful for adding quantities from one particle to the lattice.
F | Type of the function. Arguments are the current node and the 3 integer indices of the cell. |
[in] | point | Position, usually the position of particle [fm]. |
[in] | r_cut | Maximum distance from the cell center to the given position. [fm] |
[in] | func | Function acting on the cells (such as taking value). |
Definition at line 279 of file lattice.h.
|
inline |
Checks if lattices of possibly different types have identical structure.
L | Type of the other lattice. |
[in] | lat | The other lattice being compared with the current one |
Definition at line 318 of file lattice.h.
|
inlineprivate |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |