#include <Grid.hpp>
Public Member Functions | |
Grid (int ndim=0, const VectorInt &nx=VectorInt(), const VectorDouble &x0=VectorDouble(), const VectorDouble &dx=VectorDouble()) | |
Grid (const Grid &r) | |
Grid & | operator= (const Grid &r) |
virtual | ~Grid () |
void | resetFromSpaceDimension (int ndim) |
void | resetFromGrid (Grid *grid) |
int | resetFromVector (const VectorInt &nx=VectorInt(), const VectorDouble &dx=VectorDouble(), const VectorDouble &x0=VectorDouble(), const VectorDouble &angles=VectorDouble()) |
void | setX0 (int idim, double value) |
void | setDX (int idim, double value) |
void | setNX (int idim, int value) |
void | setRotationByMatrix (const MatrixSquareGeneral &rotmat) |
void | setRotationByVector (const VectorDouble &rotmat) |
void | setRotationByAngles (const VectorDouble &angles) |
void | setRotationByAngle (double angle) |
int | getNDim () const |
double | getX0 (int idim) const |
double | getDX (int idim) const |
int | getNX (int idim) const |
int | getNTotal () const |
double | getCellSize () const |
double | getExtend (int idim, bool flagCell=false) const |
double | getVolume (bool flagCell=false) const |
VectorDouble | getExtends (bool flagCell=false) const |
virtual String | toString (const AStringFormat *strfmt=nullptr) const override |
Interface to AStringable. More... | |
void | copyParams (int mode, const Grid &gridaux) |
double | getCoordinate (int rank, int idim, bool flag_rotate=true) const |
VectorDouble | getCoordinatesByRank (int rank, bool flag_rotate=true) const |
VectorDouble | getCoordinatesByIndice (const VectorInt &indice, bool flag_rotate=true, const VectorInt &shift=VectorInt(), const VectorDouble &dxsPerCell=VectorDouble()) const |
VectorDouble | getCoordinatesByCorner (const VectorInt &icorner) const |
VectorDouble | getCellCoordinatesByCorner (int node, const VectorInt &shift=VectorInt(), const VectorDouble &dxsPerCell=VectorDouble()) const |
double | indiceToCoordinate (int idim0, const VectorInt &indice, const VectorDouble &percent=VectorDouble(), bool flag_rotate=true) const |
VectorDouble | indicesToCoordinate (const VectorInt &indice, const VectorDouble &percent=VectorDouble()) const |
void | indicesToCoordinateInPlace (const VectorInt &indice, VectorDouble &coor, const VectorDouble &percent=VectorDouble(), bool flag_rotate=true) const |
double | rankToCoordinate (int idim0, int rank, const VectorDouble &percent=VectorDouble()) const |
VectorDouble | rankToCoordinates (int rank, const VectorDouble &percent=VectorDouble()) const |
void | rankToCoordinatesInPlace (int rank, VectorDouble &coor, const VectorDouble &percent=VectorDouble()) const |
int | indiceToRank (const VectorInt &indice) const |
void | rankToIndice (int rank, VectorInt &indices, bool minusOne=false) const |
VectorInt | coordinateToIndices (const VectorDouble &coor, bool centered=false, double eps=EPSILON6) const |
int | coordinateToIndicesInPlace (const VectorDouble &coor, VectorInt &indice, bool centered=false, double eps=EPSILON6) const |
int | coordinateToRank (const VectorDouble &coor, bool centered=false, double eps=EPSILON6) const |
VectorInt | getCenterIndices () const |
VectorInt | generateGridIndices (const String &string, bool startFromZero=true, bool invert=true, bool verbose=false) const |
bool | sampleBelongsToCell (const VectorDouble &coor, const VectorDouble ¢er, const VectorDouble &dxsPerCell=VectorDouble()) const |
bool | sampleBelongsToCell (const VectorDouble &coor, int rank, const VectorDouble &dxsPerCell=VectorDouble()) const |
VectorDouble | getRotAngles () const |
VectorDouble | getRotMat () const |
double | getRotAngle (int idim) const |
VectorInt | getNXs () const |
VectorDouble | getX0s () const |
VectorDouble | getDXs () const |
const Rotation & | getRotation () const |
bool | isSame (const Grid &grid) const |
bool | isSameMesh (const Grid &grid) const |
bool | isRotated () const |
bool | isSameRotation (const Grid &grid) const |
VectorDouble | getAxis (int idim) const |
void | iteratorInit (const VectorInt &order=VectorInt()) |
VectorInt | iteratorNext (void) |
bool | empty () const |
void | dilate (int mode, const VectorInt &nshift, VectorInt &nx, VectorDouble &dx, VectorDouble &x0) const |
void | multiple (const VectorInt &nmult, bool flagCell, VectorInt &nx, VectorDouble &dx, VectorDouble &x0) const |
void | divider (const VectorInt &nmult, bool flagCell, VectorInt &nx, VectorDouble &dx, VectorDouble &x0) const |
int | getMirrorIndex (int idim, int ix) const |
Public Member Functions inherited from 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 (int level) const final |
Static Public Member Functions | |
static VectorInt | gridIndices (const VectorInt &nx, const String &string, bool startFromZero=true, bool invert=true, bool verbose=false) |
static int | generateMirrorIndex (int nx, int ix) |
Grid::Grid | ( | int | ndim = 0 , |
const VectorInt & | nx = VectorInt() , |
||
const VectorDouble & | x0 = VectorDouble() , |
||
const VectorDouble & | dx = VectorDouble() |
||
) |
Grid::Grid | ( | const Grid & | r | ) |
|
virtual |
VectorInt Grid::coordinateToIndices | ( | const VectorDouble & | coor, |
bool | centered = false , |
||
double | eps = EPSILON6 |
||
) | const |
int Grid::coordinateToIndicesInPlace | ( | const VectorDouble & | coor, |
VectorInt & | 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 |
int Grid::coordinateToRank | ( | const VectorDouble & | coor, |
bool | centered = false , |
||
double | eps = EPSILON6 |
||
) | const |
void Grid::copyParams | ( | int | mode, |
const Grid & | gridaux | ||
) |
void Grid::dilate | ( | int | mode, |
const VectorInt & | nshift, | ||
VectorInt & | nx, | ||
VectorDouble & | dx, | ||
VectorDouble & | x0 | ||
) | const |
void Grid::divider | ( | const VectorInt & | nmult, |
bool | flagCell, | ||
VectorInt & | nx, | ||
VectorDouble & | dx, | ||
VectorDouble & | x0 | ||
) | const |
bool Grid::empty | ( | ) | const |
VectorInt Grid::generateGridIndices | ( | const String & | string, |
bool | startFromZero = true , |
||
bool | invert = true , |
||
bool | verbose = false |
||
) | const |
|
static |
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 |
VectorDouble Grid::getAxis | ( | int | 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 |
VectorDouble Grid::getCellCoordinatesByCorner | ( | int | node, |
const VectorInt & | shift = VectorInt() , |
||
const VectorDouble & | dxsPerCell = VectorDouble() |
||
) | 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 |
double Grid::getCellSize | ( | ) | const |
VectorInt Grid::getCenterIndices | ( | ) | const |
double Grid::getCoordinate | ( | int | rank, |
int | idim, | ||
bool | flag_rotate = true |
||
) | const |
VectorDouble Grid::getCoordinatesByCorner | ( | const VectorInt & | icorner | ) | const |
Returns the coordinates of a Grid corner
icorner | Vector specifying the corner (0: minimum; 1: maximum). (Dimension: ndim) |
VectorDouble Grid::getCoordinatesByIndice | ( | const VectorInt & | indice, |
bool | flag_rotate = true , |
||
const VectorInt & | shift = VectorInt() , |
||
const VectorDouble & | dxsPerCell = VectorDouble() |
||
) | 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) |
VectorDouble Grid::getCoordinatesByRank | ( | int | rank, |
bool | flag_rotate = true |
||
) | const |
Return the Vector of coordinates for a given grid node
rank | Rank of the target grid node |
flag_rotate | TRUE: perform the rotation; FALSE: skip rotation |
double Grid::getDX | ( | int | idim | ) | const |
|
inline |
double Grid::getExtend | ( | int | idim, |
bool | flagCell = false |
||
) | const |
VectorDouble Grid::getExtends | ( | bool | flagCell = false | ) | const |
int Grid::getMirrorIndex | ( | int | idim, |
int | ix | ||
) | 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 |
int Grid::getNTotal | ( | ) | const |
int Grid::getNX | ( | int | idim | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
double Grid::getVolume | ( | bool | flagCell = false | ) | const |
double Grid::getX0 | ( | int | 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 |
VectorDouble Grid::indicesToCoordinate | ( | const VectorInt & | indice, |
const VectorDouble & | percent = VectorDouble() |
||
) | const |
void Grid::indicesToCoordinateInPlace | ( | const VectorInt & | indice, |
VectorDouble & | coor, | ||
const VectorDouble & | percent = VectorDouble() , |
||
bool | flag_rotate = true |
||
) | const |
double Grid::indiceToCoordinate | ( | int | idim0, |
const VectorInt & | indice, | ||
const VectorDouble & | percent = VectorDouble() , |
||
bool | flag_rotate = true |
||
) | const |
int Grid::indiceToRank | ( | const VectorInt & | indice | ) | const |
|
inline |
bool 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 Grid::isSameMesh | ( | const Grid & | grid | ) | const |
|
inline |
Initialize an iterator on the grid
order | Array giving the order of the Space Dimensions when iterating |
VectorInt Grid::iteratorNext | ( | void | ) |
Return the vector of grid indices for each iteration
void Grid::multiple | ( | const VectorInt & | nmult, |
bool | flagCell, | ||
VectorInt & | nx, | ||
VectorDouble & | dx, | ||
VectorDouble & | x0 | ||
) | const |
double Grid::rankToCoordinate | ( | int | idim0, |
int | rank, | ||
const VectorDouble & | percent = VectorDouble() |
||
) | const |
VectorDouble Grid::rankToCoordinates | ( | int | rank, |
const VectorDouble & | percent = VectorDouble() |
||
) | const |
void Grid::rankToCoordinatesInPlace | ( | int | rank, |
VectorDouble & | coor, | ||
const VectorDouble & | percent = VectorDouble() |
||
) | const |
void Grid::rankToIndice | ( | int | rank, |
VectorInt & | indices, | ||
bool | minusOne = false |
||
) | 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 Grid::resetFromGrid | ( | Grid * | grid | ) |
void Grid::resetFromSpaceDimension | ( | int | ndim | ) |
int Grid::resetFromVector | ( | const VectorInt & | nx = VectorInt() , |
const VectorDouble & | dx = VectorDouble() , |
||
const VectorDouble & | x0 = VectorDouble() , |
||
const VectorDouble & | angles = VectorDouble() |
||
) |
bool Grid::sampleBelongsToCell | ( | const VectorDouble & | coor, |
const VectorDouble & | center, | ||
const VectorDouble & | dxsPerCell = VectorDouble() |
||
) | 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 |
bool Grid::sampleBelongsToCell | ( | const VectorDouble & | coor, |
int | rank, | ||
const VectorDouble & | dxsPerCell = VectorDouble() |
||
) | 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 |
void Grid::setDX | ( | int | idim, |
double | value | ||
) |
void Grid::setNX | ( | int | idim, |
int | value | ||
) |
void Grid::setRotationByAngle | ( | double | angle | ) |
Define the rotation by the value of its first angle
angle | Value of the first rotation angle |
void Grid::setRotationByAngles | ( | const VectorDouble & | angles | ) |
void Grid::setRotationByMatrix | ( | const MatrixSquareGeneral & | rotmat | ) |
void Grid::setRotationByVector | ( | const VectorDouble & | rotmat | ) |
void Grid::setX0 | ( | int | idim, |
double | value | ||
) |
|
overridevirtual |
Interface to AStringable.
Reimplemented from AStringable.