#include <Grid.hpp>
Public Member Functions | |
| Grid (Id ndim=0, const 1 &nx=1(), const 1 &x0=1(), const 1 &dx=1()) | |
| Grid (const Grid &r) | |
| Grid & | operator= (const Grid &r) |
| virtual | ~Grid () |
| void | initThread () const |
| void | resetFromSpaceDimension (Id ndim) |
| void | resetFromGrid (Grid *grid) |
| Id | resetFromVector (const 1 &nx=1(), const 1 &dx=1(), const 1 &x0=1(), const 1 &angles=1()) |
| void | setX0 (Id idim, double value) |
| void | setDX (Id idim, double value) |
| void | setNX (Id idim, Id value) |
| void | setRotationByMatrix (const MatrixSquare &rotmat) |
| void | setRotationByVector (const 1 &rotmat) |
| void | setRotationByAngles (const 1 &angles) |
| void | setRotationByAngle (double angle) |
| Id | getNDim () const |
| double | getX0 (Id idim) const |
| double | getDX (Id idim) const |
| Id | getNX (Id idim) const |
| Id | getNTotal () const |
| double | getCellSize () const |
| double | getExtend (Id idim, bool flagCell=false) const |
| double | getVolume (bool flagCell=false) const |
| getExtends (bool flagCell=false) const | |
| String | toString (const AStringFormat *strfmt=nullptr) const override |
| Interface to AStringable. | |
| void | copyParams (Id mode, const Grid &gridaux) |
| double | getCoordinate (Id rank, Id idim, bool flag_rotate=true) const |
| getCoordinatesByRank (Id rank, bool flag_rotate=true) const | |
| void | getCoordinatesByRankInPlace (1 &coor, Id rank, bool flag_rotate) const |
| getCoordinatesByIndice (const 1 &indice, bool flag_rotate=true, const 1 &shift=1(), const 1 &dxsPerCell=1()) const | |
| void | getCoordinatesByIndiceInPlace (1 &coor, const 1 &indice, bool flag_rotate=true, const 1 &shift=1(), const 1 &dxsPerCell=1()) const |
| getCoordinatesByCorner (const 1 &icorner) const | |
| void | getCoordinatesByCornerInPlace (1 &coor, const 1 &icorner) const |
| getCellCoordinatesByCorner (Id node, const 1 &shift=1(), const 1 &dxsPerCell=1()) const | |
| void | getCellCoordinatesByCornerInPlace (1 &coor, Id node, const 1 &shift=1(), const 1 &dxsPerCell=1()) const |
| double | indiceToCoordinate (Id idim0, const constvectint indice, const constvect percent={}, bool flag_rotate=true) const |
| indicesToCoordinate (const 1 &indice, const 1 &percent=1()) const | |
| void | indicesToCoordinateInPlace (const constvectint indice, const vect coor, const constvect percent={}, bool flag_rotate=true) const |
| double | rankToCoordinate (Id idim0, Id rank, const 1 &percent=1()) const |
| rankToCoordinates (Id rank, const 1 &percent=1()) const | |
| void | rankToCoordinatesInPlace (Id rank, 1 &coor, const 1 &percent=1()) const |
| Id | indiceToRank (const constvectint indice) const |
| void | rankToIndice (Id rank, vectint indices, bool minusOne=false) const |
| coordinateToIndices (const 1 &coor, bool centered=false, double eps=EPSILON6) const | |
| void | coordinateToIndicesInPlace (1 &indices, const 1 &coor, bool centered, double eps) const |
| Id | coordinateToIndicesInPlace (const 1 &coor, 1 &indice, bool centered=false, double eps=EPSILON6) const |
| Id | coordinateToRank (const 1 &coor, bool centered=false, double eps=EPSILON6) const |
| getCenterIndices (bool flagSup=false) const | |
| void | getCenterIndicesInPlace (1 &indices, bool flagSup) const |
| generateGridIndices (const String &string, bool startFromZero=true, bool invert=true, bool verbose=false) const | |
| bool | sampleBelongsToCell (constvect coor, constvect center, const 1 &dxsPerCell) const |
| bool | sampleBelongsToCell (const 1 &coor, const 1 ¢er, const 1 &dxsPerCell=1()) const |
| bool | sampleBelongsToCell (const 1 &coor, Id rank, const 1 &dxsPerCell=1()) const |
| getRotAngles () const | |
| getRotMat () const | |
| double | getRotAngle (Id idim) const |
| getNXs () const | |
| getX0s () const | |
| getDXs () const | |
| const Rotation & | getRotation () const |
| void | setRotation (const Rotation &rotation) |
| bool | isSame (const Grid &grid) const |
| bool | isSameMesh (const Grid &grid) const |
| bool | isRotated () const |
| bool | isSameRotation (const Grid &grid) const |
| getAxis (Id idim) const | |
| void | iteratorInit (const 1 &order=1()) |
| iteratorNext (void) | |
| void | iteratorNext (std::vector< Id > &indices) |
| bool | empty () const |
| void | dilate (Id mode, const 1 &nshift, 1 &nx, 1 &dx, 1 &x0) const |
| void | multiple (const 1 &nmult, bool flagCell, 1 &nx, 1 &dx, 1 &x0) const |
| void | divider (const 1 &nmult, bool flagCell, 1 &nx, 1 &dx, 1 &x0) const |
| Id | getMirrorIndex (Id idim, Id ix) const |
| bool | isInside (const 1 &indices) const |
Public Member Functions inherited from gstlrn::AStringable | |
| AStringable () | |
| AStringable (const AStringable &r) | |
| AStringable & | operator= (const AStringable &r) |
| virtual | ~AStringable () |
| virtual void | display (const AStringFormat *strfmt=nullptr) const final |
| virtual void | display (Id level) const final |
Public Member Functions inherited from gstlrn::ASerializable | |
| ASerializable () | |
| ASerializable (const ASerializable &r) | |
| ASerializable & | operator= (const ASerializable &r) |
| ASerializable (ASerializable &&r) noexcept | |
| ASerializable & | operator= (ASerializable &&r) noexcept |
| virtual | ~ASerializable () |
| bool | dumpToNF (const String &NFFilename, const EFormatNF &format=EFormatNF::fromKey("DEFAULT"), bool verbose=false) const |
| Dump the contents of an object into an Output File using a given Output NF Format. | |
| void | setDefaultFormatNF (const EFormatNF &format) |
Static Public Member Functions | |
| static | gridIndices (const 1 &nx, const String &string, bool startFromZero=true, bool invert=true, bool verbose=false) |
| static Id | generateMirrorIndex (Id nx, Id ix) |
Static Public Member Functions inherited from gstlrn::ASerializable | |
| static String | buildFileName (Id status, const String &filename, bool ensureDirExist=false) |
| static String | getFileIdentity (const String &filename, bool verbose=false) |
| static void | setPrefixName (const String &prefixName) |
| static void | unsetPrefixName () |
| static const String & | getPrefixName () |
Friends | |
| class | DbGrid |
| gstlrn::Grid::Grid | ( | Id | ndim = 0, |
| const 1 & | nx = 1(), |
||
| const 1 & | x0 = 1(), |
||
| const 1 & | dx = 1() |
||
| ) |
| gstlrn::Grid::Grid | ( | const Grid & | r | ) |
|
virtual |
| gstlrn::Grid::coordinateToIndices | ( | const 1 & | coor, |
| bool | centered = false, |
||
| double | eps = EPSILON6 |
||
| ) | const |
| void gstlrn::Grid::coordinateToIndicesInPlace | ( | 1 & | indices, |
| const 1 & | coor, | ||
| bool | centered, | ||
| double | eps | ||
| ) | const |
| Id gstlrn::Grid::coordinateToIndicesInPlace | ( | const 1 & | coor, |
| 1 & | indice, | ||
| bool | centered = false, |
||
| double | eps = EPSILON6 |
||
| ) | const |
Find the grid node to which the current sample is assigned
| coor | Sample coordinates |
| indice | Indices of the assigned grid node |
| centered | True for grid cell centered |
| eps | Epsilon to over-pass roundoff problem |
| Id gstlrn::Grid::coordinateToRank | ( | const 1 & | coor, |
| bool | centered = false, |
||
| double | eps = EPSILON6 |
||
| ) | const |
| void gstlrn::Grid::dilate | ( | Id | mode, |
| const 1 & | nshift, | ||
| 1 & | nx, | ||
| 1 & | dx, | ||
| 1 & | x0 | ||
| ) | const |
| void gstlrn::Grid::divider | ( | const 1 & | nmult, |
| bool | flagCell, | ||
| 1 & | nx, | ||
| 1 & | dx, | ||
| 1 & | x0 | ||
| ) | const |
| bool gstlrn::Grid::empty | ( | ) | const |
| gstlrn::Grid::generateGridIndices | ( | const String & | string, |
| bool | startFromZero = true, |
||
| bool | invert = true, |
||
| bool | verbose = false |
||
| ) | const |
Return the index of a sample when calculated from mirroring within an array whose indices vary between 0 and nx-1
| [in] | nx | Number of cells |
| [in] | ix | Rank of the cell to be restrained |
| gstlrn::Grid::getAxis | ( | Id | idim | ) | const |
Returns a vector with the coordinates along one axis. This is needed for the label of Grid representation Warning: Not considering any possible rotation.
| idim | Index of the Space Dimension |
| gstlrn::Grid::getCellCoordinatesByCorner | ( | Id | node, |
| const 1 & | shift = 1(), |
||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
Returns the coordinates of a Grid cell corner
| node | Rank of the Target cell |
| shift | Vector of shifts (dimension: ndim) 0 : no shift; -1 : minus half a cell-width; +1 plus half a cell-width |
| dxsPerCell | Vector of variable mesh extensions at target cell |
| void gstlrn::Grid::getCellCoordinatesByCornerInPlace | ( | 1 & | coor, |
| Id | node, | ||
| const 1 & | shift = 1(), |
||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
| double gstlrn::Grid::getCellSize | ( | ) | const |
| gstlrn::Grid::getCenterIndices | ( | bool | flagSup = false | ) | const |
| void gstlrn::Grid::getCenterIndicesInPlace | ( | 1 & | indices, |
| bool | flagSup | ||
| ) | const |
| gstlrn::Grid::getCoordinatesByCorner | ( | const 1 & | icorner | ) | const |
Returns the coordinates of a Grid corner
| icorner | Vector specifying the corner (0: minimum; 1: maximum). (Dimension: ndim) |
| void gstlrn::Grid::getCoordinatesByCornerInPlace | ( | 1 & | coor, |
| const 1 & | icorner | ||
| ) | const |
| gstlrn::Grid::getCoordinatesByIndice | ( | const 1 & | indice, |
| bool | flag_rotate = true, |
||
| const 1 & | shift = 1(), |
||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
Returns the coordinates of a grid node, defined by its indices
| indice | Vector of indices defining the target grid node |
| flag_rotate | True if the grid rotation must be taken into account |
| shift | Vector of shifts (dimension: ndim) 0 : no shift; -1 : minus half a cell-width; +1 plus half a cell-width |
| dxsPerCell | Vector of variable grid meshes (optional) |
| void gstlrn::Grid::getCoordinatesByIndiceInPlace | ( | 1 & | coor, |
| const 1 & | indice, | ||
| bool | flag_rotate = true, |
||
| const 1 & | shift = 1(), |
||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
| gstlrn::Grid::getCoordinatesByRank | ( | Id | rank, |
| bool | flag_rotate = true |
||
| ) | const |
| void gstlrn::Grid::getCoordinatesByRankInPlace | ( | 1 & | coor, |
| Id | rank, | ||
| bool | flag_rotate | ||
| ) | const |
Return the Vector of coordinates for a given grid node
| coor | Output Vector of coordinates (dimension: _nDim) |
| rank | Rank of the target grid node |
| flag_rotate | TRUE: perform the rotation; FALSE: skip rotation |
| double gstlrn::Grid::getDX | ( | Id | idim | ) | const |
|
inline |
| double gstlrn::Grid::getExtend | ( | Id | idim, |
| bool | flagCell = false |
||
| ) | const |
| gstlrn::Grid::getExtends | ( | bool | flagCell = false | ) | const |
Return the index of a sample when calculated from mirroring within an array whose indices vary between 0 and nx-1
| [in] | idim | Rank of the space dimension |
| [in] | ix | Rank of the cell to be restrained |
|
inline |
| Id gstlrn::Grid::getNTotal | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| double gstlrn::Grid::getVolume | ( | bool | flagCell = false | ) | const |
| double gstlrn::Grid::getX0 | ( | Id | idim | ) | const |
|
inline |
|
static |
Returns an array giving the ranks of the nodes (according to user's order) coded with standard order (according to gstlearn internal order)
| [in] | nx | Array giving the number of cells per direction |
| [in] | string | String describing the sorting order |
| [in] | startFromZero | True if numbering must start from 0 (1 otherwise) |
| [in] | invert | Way to use the resulting array (see remark) |
| [in] | verbose | Verbose flag |
| gstlrn::Grid::indicesToCoordinate | ( | const 1 & | indice, |
| const 1 & | percent = 1() |
||
| ) | const |
| void gstlrn::Grid::indicesToCoordinateInPlace | ( | const constvectint | indice, |
| const vect | coor, | ||
| const constvect | percent = {}, |
||
| bool | flag_rotate = true |
||
| ) | const |
| double gstlrn::Grid::indiceToCoordinate | ( | Id | idim0, |
| const constvectint | indice, | ||
| const constvect | percent = {}, |
||
| bool | flag_rotate = true |
||
| ) | const |
| Id gstlrn::Grid::indiceToRank | ( | const constvectint | indice | ) | const |
| void gstlrn::Grid::initThread | ( | ) | const |
| bool gstlrn::Grid::isInside | ( | const 1 & | indices | ) | const |
|
inline |
| bool gstlrn::Grid::isSame | ( | const Grid & | grid | ) | const |
Check that the current grid match the one provided as argument up to their common Space Dimension
| grid | Target grid to be checked against the current one |
| bool gstlrn::Grid::isSameMesh | ( | const Grid & | grid | ) | const |
|
inline |
| void gstlrn::Grid::iteratorInit | ( | const 1 & | order = 1() | ) |
Initialize an iterator on the grid
| order | Array giving the order of the Space Dimensions when iterating |
| void gstlrn::Grid::iteratorNext | ( | std::vector< Id > & | indices | ) |
| gstlrn::Grid::iteratorNext | ( | void | ) |
Return the vector of grid indices for each iteration
| void gstlrn::Grid::multiple | ( | const 1 & | nmult, |
| bool | flagCell, | ||
| 1 & | nx, | ||
| 1 & | dx, | ||
| 1 & | x0 | ||
| ) | const |
| gstlrn::Grid::rankToCoordinates | ( | Id | rank, |
| const 1 & | percent = 1() |
||
| ) | const |
| void gstlrn::Grid::rankToCoordinatesInPlace | ( | Id | rank, |
| 1 & | coor, | ||
| const 1 & | percent = 1() |
||
| ) | const |
| rank | Rank of the Node (in the meshing) |
| indices | Indices of the node in the grid system |
| minusOne | Consider that the number of cells in each direction should be reduced by one. |
| void gstlrn::Grid::resetFromGrid | ( | Grid * | grid | ) |
| void gstlrn::Grid::resetFromSpaceDimension | ( | Id | ndim | ) |
| Id gstlrn::Grid::resetFromVector | ( | const 1 & | nx = 1(), |
| const 1 & | dx = 1(), |
||
| const 1 & | x0 = 1(), |
||
| const 1 & | angles = 1() |
||
| ) |
| bool gstlrn::Grid::sampleBelongsToCell | ( | const 1 & | coor, |
| const 1 & | center, | ||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
| bool gstlrn::Grid::sampleBelongsToCell | ( | const 1 & | coor, |
| Id | rank, | ||
| const 1 & | dxsPerCell = 1() |
||
| ) | const |
Check if a sample belongs to a Grid Cell
| coor | Sample coordinates (can be lower space dimension than the current Grid) |
| rank | Rank of the Grid cell |
| dxsPerCell | When defined, vector of cell extension; otherwise use dx |
| bool gstlrn::Grid::sampleBelongsToCell | ( | constvect | coor, |
| constvect | center, | ||
| const 1 & | dxsPerCell | ||
| ) | const |
Check if a sample belongs to a Grid Cell
| coor | Sample coordinates |
| center | Coordinates of the grid node center |
| dxsPerCell | When defined, vector of cell extension; otherwise use dx |
| void gstlrn::Grid::setDX | ( | Id | idim, |
| double | value | ||
| ) |
|
inline |
| void gstlrn::Grid::setRotationByAngle | ( | double | angle | ) |
Define the rotation by the value of its first angle
| angle | Value of the first rotation angle |
| void gstlrn::Grid::setRotationByAngles | ( | const 1 & | angles | ) |
| void gstlrn::Grid::setRotationByMatrix | ( | const MatrixSquare & | rotmat | ) |
| void gstlrn::Grid::setRotationByVector | ( | const 1 & | rotmat | ) |
| void gstlrn::Grid::setX0 | ( | Id | idim, |
| double | value | ||
| ) |
|
overridevirtual |
Interface to AStringable.
Reimplemented from gstlrn::AStringable.
|
friend |