1.8.0
CCC
 
Loading...
Searching...
No Matches
gstlrn::DbGrid Class Reference

Class containing the Data Information organized as a Regular Grid. More...

#include <DbGrid.hpp>

Inheritance diagram for gstlrn::DbGrid:
gstlrn::Db gstlrn::AStringable gstlrn::ASerializable gstlrn::ICloneable gstlrn::DbMeshTurbo

Detailed Description

Class containing the Data Information organized as a Regular Grid.

This class is derived from the Db class, with a specific decoration: its samples correspond to the nodes of a regular grid defined in the current space.

A regular grid is a tessellation of n-dimensional Euclidean space by congruent parallelotopes (e.g. bricks). The number of meshes along each space direction is defined by NX and the total number of samples is equal to: NX[1] x NX[2] x ... x NX[NDIM] where NDIM is he space dimension.

Note that this particular Db does not allow the modification of the sample number by addition or deletion.

The grid decoration contains the following information:

  • the number of meshes per direction (NX)
  • the coordinates of the grid origin (X0) defined as the node located in first position (smallest index) along each space direction
  • the mesh value along each space direction (DX)
  • the rotation angles around the grid origin (the origin is invariant through this rotation).

Note that rotation is defined by as many angles as the space dimension. This general property is not valid:

  • for 1D where the rotation concept does not make sense
  • for 2D where a single angle would be sufficient: however a second dummy angle (always set to 0) is used for generality sake.

Note that this grid decoration essentially describes the organization of the grid nodes. Then the same grid can be considered as a grid of points (punctual grid) or a grid of cells (block grid). In the latter case:

  • the origin is (currently) the lower-left corner (for 2D) or the origin cell.
  • the extensions of the cells are considered as constant by default and equal to DX. However, they can be replaced by a set of variables allowing the user to assign a variable cell extension for each cell.

Public Member Functions

 DbGrid ()
 
 DbGrid (const DbGrid &r)
 
DbGridoperator= (const DbGrid &r)
 
virtual ~DbGrid ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface.
 
bool isGrid () const override
 Db Interface.
 
double getCoordinate (Id iech, Id idim, bool flag_rotate=true) const override
 
void getCoordinatesInPlace (1 &coor, Id iech, bool flag_rotate=true) const override
 Update the vector of coordinates (optimized manner) No check is done with respect to the dimension of the returned vector.
 
double getUnit (Id idim=0) const override
 
Id getNDim () const override
 
bool mayChangeSampleNumber () const override
 
void resetDims (Id ncol, Id nech) override
 
bool isConsistent () const override
 
Id reset (const 1 &nx, const 1 &dx=1(), const 1 &x0=1(), const 1 &angles=1(), const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const 1 &tab=1(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true, bool flagAddCoordinates=true)
 
Id resetCoveringDb (const Db *db, const 1 &nx=1(), const 1 &dx=1(), const 1 &x0=1(), const 1 &margin=1())
 
Id resetFromPolygon (Polygons *polygon, const 1 &nodes, const 1 &dcell, bool flagAddSampleRank=true)
 
DbGridcoarsify (const 1 &nmult)
 
DbGridrefine (const 1 &nmult)
 
bool migrateAllVariables (Db *dbin, bool flag_fill=true, bool flag_inter=true, bool flag_ball=false, bool flagAddSampleRank=true)
 
const GridgetGrid () const
 
void generateCoordinates (const String &radix="x")
 
 getColumnSubGrid (const String &name, Id idim0, Id rank, bool useSel=false)
 
Id gridDefine (const 1 &nx, const 1 &dx=1(), const 1 &x0=1(), const 1 &angles=1())
 
void gridCopyParams (Id mode, const Grid &gridaux)
 
bool isSameGrid (const Grid &grid) const
 
bool isSameGridMesh (const DbGrid &dbaux) const
 
bool isSameGridRotation (const DbGrid &dbaux) const
 
bool isGridRotated () const
 
Id getNTotal () const
 
double getCellSize () const
 
double getVolume () const
 
 getExtends () const
 
double getExtend (Id idim) const
 
Id getNX (Id idim) const
 
 getNXs () const
 
 getNXsExt (Id ndimMax) const
 
bool hasSingleBlock () const
 
double getDX (Id idim) const
 
 getDXs () const
 
double getX0 (Id idim) const
 
 getX0s () const
 
double getAngle (Id idim) const
 
 getAngles () const
 
 getRotMat () const
 
void setNX (Id idim, Id value)
 
void setX0 (Id idim, double value)
 
void setDX (Id idim, double value)
 
 getGridAxis (Id idim) const
 
 getCoordinateFromCorner (const 1 &icorner) const
 
void getCoordinateFromCornerInPlace (1 &coor, const 1 &icorner) 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
 
 getCoordinatesPerSample (Id iech, bool flag_rotate=true) const
 
void getCoordinatesPerSampleInPlace (1 &coor, Id iech, bool flag_rotate=true) const
 
Id coordinateToRank (const 1 &coor, bool centered=false, double eps=EPSILON6) const
 
 coordinateToIndices (const 1 &coor, bool centered=false, double eps=EPSILON6) const
 
Id coordinateToIndicesInPlace (const 1 &coor, 1 &indices, bool centered=false, double eps=EPSILON6) const
 
 getCenterIndices (bool flagSup=false) const
 
Id indiceToRank (const 1 &indice) const
 
void rankToIndice (Id node, 1 &indices, bool minusOne=false) const
 
void rankToCoordinatesInPlace (Id rank, 1 &coor, const 1 &percent=1()) const
 
 rankToCoordinates (Id rank, const 1 &percent=1()) const
 
void indicesToCoordinateInPlace (const 1 &indice, 1 &coor, const 1 &percent=1()) const
 
 indicesToCoordinate (const 1 &indice, const 1 &percent=1()) const
 
bool sampleBelongsToCell (const 1 &coor, Id rank, const 1 &dxsPerCell=1()) const
 
Id centerCoordinateInPlace (1 &coor, bool centered=false, bool stopIfOut=false, double eps=EPSILON6) const
 
 locateDataInGrid (const Db *data, const 1 &rankIn=1(), bool centered=false, bool useSel=false) const
 
Id getMirrorIndex (Id idim, Id ix) const
 
 getSlice (const String &name, Id pos=0, Id indice=0, bool useSel=false) const
 
 getOneSlice (const String &name, Id posx=0, Id posy=1, const 1 &corner=1(), bool useSel=false) const
 
 getOneSliceForCoordinate (Id idim, Id posx=0, Id posy=1, const 1 &corner=1(), bool useSel=false) const
 
Id assignGridColumn (const String &name, Id idim, Id rank, double value, bool useSel=false)
 
 getBlockExtensions (Id node) const
 
 getCellEdges (Id node=0, bool forceGridMesh=false) const
 
 getAllCellsEdges (bool forceGridMesh=false) const
 
 getGridEdges () const
 
 getCodir (const 1 &grincr) const
 
 getLimitsFromVariableExtend (const String &nameTop, const String &nameBot, const 1 &dimExclude=1()) const
 
Id setSelectionFromVariableExtend (const String &nameTop, const String &nameBot)
 
void clean3DFromSurfaces (const VectorString &names, const DbGrid *surf2D, const String &nameTop=String(), const String &nameBot=String(), bool verbose=false)
 
Id morpho (const EMorpho &oper, double vmin=0.5, double vmax=1.5, Id option=0, const 1 &radius=1(), bool flagDistErode=false, bool verbose=false, const NamingConvention &namconv=NamingConvention("Morpho"))
 
Id smooth (ANeigh *neigh, Id type=1, double range=1., const NamingConvention &namconv=NamingConvention("Smooth"))
 
Id addSelectionFromDbByMorpho (Db *db, Id nmin=0, Id radius=0, Id option=0, const 1 &dilation=1(), bool verbose=false, const NamingConvention &namconv=NamingConvention("Morpho", false, false, true, ELoc::fromKey("SEL")))
 
void getSampleAsSTInPlace (Id iech, SpaceTarget &P) const override
 
 getDiscretizedBlock (const 1 &ndiscs, Id iech=0, bool flagPerCell=false, bool flagRandom=false, Id seed=132433) const
 
void getGridPileInPlace (Id iuid, const 1 &indg, Id idim0, 1 &vec) const
 
void setGridPileInPlace (Id iuid, const 1 &indg, Id idim0, const 1 &vec)
 
 getDistanceToOrigin (const 1 &origin, const 1 &radius=1())
 
void initThread () const override
 
- Public Member Functions inherited from gstlrn::Db
 Db ()
 
 Db (const Db &r)
 
Dboperator= (const Db &r)
 
virtual ~Db ()
 
virtual bool isLine () const
 
virtual bool isMesh () const
 
Id resetFromSamples (Id nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const 1 &tab=1(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true)
 
Id resetFromCSV (const String &filename, bool verbose, const CSVformat &csvfmt, Id ncol_max=-1, Id nrow_max=-1, bool flagAddSampleRank=true)
 
Id resetFromBox (Id nech, const 1 &coormin, const 1 &coormax, Id ndim=2, double extend=0., Id seed=321415, bool flagAddSampleRank=true)
 
Id resetFromOnePoint (const 1 &tab=1(), bool flagAddSampleRank=true)
 
Id resetSamplingDb (const Db *dbin, double proportion=0, Id number=0, const VectorString &names=VectorString(), Id seed=23241, bool verbose=false, bool flagAddSampleRank=true)
 
Id resetReduce (const Db *dbin, const VectorString &names=VectorString(), const 1 &ranks=1(), bool verbose=false)
 
Id resetFromGridRandomized (const DbGrid *dbin, double randperc=0., bool flagAddSampleRank=true)
 
const std::vector< double > & getArrays () const
 
String getNameByLocator (const ELoc &locatorType, Id locatorIndex=0) const
 
String getNameByColIdx (Id icol) const
 
String getNameByUID (Id iuid) const
 
VectorString getName (const String &name) const
 
VectorString getNames (const VectorString &names) const
 
VectorString getNamesByLocator (const ELoc &locatorType) const
 
VectorString getNamesByColIdx (const 1 &icols) const
 
VectorString getNamesByUID (const 1 &iuids) const
 
VectorString getAllNames (bool excludeRankAndCoordinates=false, bool verbose=false) const
 
void setName (const String &old_name, const String &name)
 
void setName (const VectorString &list, const String &name)
 
void setNameByUID (Id iuid, const String &name)
 
void setNameByColIdx (Id icol, const String &name)
 
void setNameByLocator (const ELoc &locatorType, const String &name)
 
VectorString expandNameList (const VectorString &names) const
 
VectorString expandNameList (const String &names) const
 
VectorString identifyNames (const VectorString &names) const
 
Id getNUIDMax () const
 
Id getNColumn () const
 
Id getNSample (bool useSel=false) const
 
Id getNSampleActiveAndDefined (Id item) const
 
Id getNSampleActiveAndDefined (const String &name) const
 
Id getNSampleActive () const
 
Id getRankRelativeToAbsolute (Id irel) const
 
Id getRankAbsoluteToRelative (Id iabs) const
 
void clearLocators (const ELoc &locatorType)
 
void clearSelection ()
 
void setLocatorByUID (Id iuid, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorByColIdx (Id icol, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocator (const String &name, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocators (const VectorString &names, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByUID (Id number, Id iuid, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByUID (const 1 &iuids, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByColIdx (const 1 &icols, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool cleanSameLocator=false)
 
void addColumnsByVVD (const 1 &tab, const String &radix, const ELoc &locatorType, Id locatorIndex=0, bool useSel=false)
 
Id addColumns (const 1 &tab, const String &radix="New", const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool useSel=false, double valinit=0., Id nvar=1)
 
Id addColumnsByConstant (Id nadd=1, double valinit=0., const String &radix="New", const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, Id nechInit=0)
 
Id addColumnsRandom (Id nadd, const String &radix="New", const ELoc &locatorType=ELoc::fromKey("Z"), Id locatorIndex=0, Id seed=1352, Id nechInit=0)
 
Id addSelection (const 1 &tab=1(), const String &name="NewSel", const String &combine="set")
 
Id addSelectionByVariable (const String &varname, double lower=TEST, double upper=TEST, const String &name="NewSel", const String &oldSelName="")
 Create a selection by testing a target variable against 'lower' and 'upper'.
 
Id addSelectionByRanks (const 1 &ranks, const String &name="NewSel", const String &combine="set")
 
Id addSelectionByLimit (const String &testvar, const Limits &limits=Limits(), const String &name="NewSel", const String &combine="set")
 
Id addSelectionFromDbByConvexHull (Db *db, double dilate=0., bool verbose=false, const NamingConvention &namconv=NamingConvention("Hull", true, true, true, ELoc::fromKey("SEL")))
 
Id addSelectionRandom (double prop, Id seed=138213, const String &name="NewSel", const String &combine="set")
 
Id addSamples (Id nadd, double valinit=TEST)
 
Id deleteSample (Id e_del)
 
Id deleteSamples (const 1 &e_dels)
 
void switchLocator (const ELoc &locatorType_in, const ELoc &locatorType_out)
 
Id getLastUID (Id number=0) const
 
String getLastName (Id number=0) const
 
Id getColIdx (const String &name) const
 
Id getColIdxByUID (Id iuid) const
 
Id getColIdxByLocator (const ELoc &locatorType, Id locatorIndex=0) const
 
 getColIdxs (const String &name) const
 
 getColIdxs (const VectorString &names) const
 
 getColIdxsByUID (const 1 &iuids) const
 
 getColIdxsByLocator (const ELoc &locatorType) const
 
void setColumn (const 1 &tab, const String &name, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), Id locatorIndex=0, bool useSel=false)
 
void setColumnByUIDOldStyle (const double *tab, Id iuid, bool useSel=false)
 
void setColumnByUID (const 1 &tab, Id iuid, bool useSel=false)
 
void setColumnByColIdx (const 1 &tab, Id icol, bool useSel=false)
 
void setColumnsByColIdx (const 1 &tabs, const 1 &icols, bool useSel=false)
 
void setColumnByColIdxOldStyle (const double *tab, Id icol, bool useSel=false)
 
void duplicateColumnByUID (Id iuid_in, Id iuid_out)
 
 getItem (const 1 &rows, const VectorString &colnames, bool useSel=false) const
 
 getItem (const 1 &rows, const String &colname, bool useSel=false) const
 
 getItem (const 1 &rows, const ELoc &locatorType, bool useSel=false) const
 
 getItem (const VectorString &colnames, bool useSel=false) const
 
 getItem (const String &colname, bool useSel=false) const
 
 getItem (const ELoc &locatorType, bool useSel=false) const
 
VectorString getItemNames (const VectorString &colnames) const
 
VectorString getItemNames (const String &colname) const
 
VectorString getItemNames (const ELoc &locatorType) const
 
Id setItem (const 1 &rows, const VectorString &colnames, const 1 &values, bool useSel=false)
 
Id setItem (const 1 &rows, const ELoc &locatorType, const 1 &values, bool useSel=false)
 
Id setItem (const VectorString &colnames, const 1 &values, bool useSel=false)
 
Id setItem (const ELoc &locatorType, const 1 &values, bool useSel=false)
 
Id setItem (const 1 &rows, const String &colname, const 1 &values, bool useSel=false)
 
Id setItem (const String &colname, const 1 &values, bool useSel=false)
 
bool getLocator (const String &name, ELoc *ret_locatorType, Id *ret_locatorIndex) const
 
bool getLocatorByColIdx (Id icol, ELoc *ret_locatorType, Id *ret_locatorIndex) const
 
bool getLocatorByUID (Id iuid, ELoc *ret_locatorType, Id *ret_locatorIndex) const
 
VectorString getLocators (bool anyLocator=true, const ELoc &locatorType=ELoc::fromKey("UNKNOWN")) const
 
bool isUIDDefined (Id iuid) const
 
Id getUID (const String &name) const
 
Id getUIDByColIdx (Id icol) const
 
Id getUIDByLocator (const ELoc &locatorType, Id locatorIndex=0) const
 
 getUIDs (const VectorString &names) const
 
 getUIDsByLocator (const ELoc &locatorType) const
 
 getUIDsByColIdx (const 1 &icols) const
 
 getAllUIDs () const
 
void getAllUIDs (1 &iuids) const
 
void copyByUID (Id iuidIn, Id iuidOut)
 
void copyByCol (Id icolIn, Id icolOut)
 
Id getNFacies (void) const
 
bool hasLocatorDefined (const String &name, const ELoc &locatorType, Id locatorIndex=0) const
 
 getSampleCoordinates (Id iech) const
 
void getSampleAsSPInPlace (SpacePoint &P, Id iabs) const
 In the SpacePoint 'P', define the sample rank and coordinates.
 
 getSampleLocators (const ELoc &locatorType, Id iech) const
 
 getIncrements (const 1 &iechs, const 1 &jechs) const
 
 getOneCoordinate (Id idim, bool useSel=false, bool flag_rotate=true) const
 
 getAllCoordinates (bool useSel=false) const
 
MatrixDense getAllCoordinatesMat (const MatrixDense &box=MatrixDense()) const
 
void setCoordinate (Id iech, Id idim, double value)
 
void setCoordinates (Id idim, const 1 &coor, bool useSel=false)
 
void setSampleCoordinates (Id iech, const 1 &coor)
 
double getDistance1D (Id iech, Id jech, Id idim=0, bool flagAbs=false) const
 
double getDistance (Id iech, Id jech) const
 
Id getDistanceVecInPlace (Id iech, Id jech, 1 &dd, const Db *db2=nullptr) const
 
double getValue (const String &name, Id iech) const
 
void setValue (const String &name, Id iech, double value)
 
double getArray (Id iech, Id iuid) const
 
void getArrayVec (const 1 &iechs, Id iuid, 1 &values) const
 
void setArray (Id iech, Id iuid, double value)
 
void setArrayVec (const 1 &iechs, Id iuid, const 1 &values)
 
void updArray (Id iech, Id iuid, const EOperator &oper, double value)
 
void updArrayVec (const 1 &iechs, Id iuid, const EOperator &oper, 1 &values)
 
 getArrayByUID (Id iuid, bool useSel=false) const
 
void setArrayByUID (const 1 &tab, Id iuid)
 
void getArrayBySample (std::vector< double > &vals, Id iech) const
 
void setArrayBySample (Id iech, const 1 &vec)
 
void getSamplesAsSP (std::vector< SpacePoint > &pvec, const ASpaceSharedPtr &space, bool useSel=false) const
 
void getSamplesFromNbghAsSP (std::vector< SpacePoint > &pvec, const 1 &nbgh) const
 
bool hasLocator (const ELoc &locatorType) const
 
double getFromLocator (const ELoc &locatorType, Id iech, Id locatorIndex=0) const
 
void setFromLocator (const ELoc &locatorType, Id iech, Id locatorIndex, double value)
 
double getValueByColIdx (Id iech, Id icol, bool flagCheck=true) const
 
const double * getColAdressByColIdx (Id icol) const
 
void setValueByColIdx (Id iech, Id icol, double value, bool flagCheck=true)
 
 getValuesByNames (const 1 &iechs, const VectorString &names, bool bySample=false) const
 
 getValuesByColIdx (const 1 &iechs, const 1 &icols, bool bySample=false) const
 
void setValuesByNames (const 1 &iechs, const VectorString &names, const 1 &values, bool bySample=false)
 
void setValuesByColIdx (const 1 &iechs, const 1 &icols, const 1 &values, bool bySample=false)
 
Id getNLoc (const ELoc &loctype) const
 
bool hasLocVariable (const ELoc &loctype) const
 
double getLocVariable (const ELoc &loctype, Id iech, Id item) const
 
void setLocVariable (const ELoc &loctype, Id iech, Id item, double value)
 
void updLocVariable (const ELoc &loctype, Id iech, Id item, const EOperator &oper, double value)
 
Id getNZValues () const
 
bool hasZVariable () const
 
double getZVariable (Id iech, Id item) const
 
void setZVariable (Id iech, Id item, double value)
 
void updZVariable (Id iech, Id item, const EOperator &oper, double value)
 
 getLocVariables (const ELoc &loctype, Id iech, Id nitemax=0) const
 
void setLocVariables (const ELoc &loctype, Id iech, const 1 &values)
 
bool isNVarComparedTo (Id nvar, Id compare=0) const
 
bool isIsotopic (Id iech, Id nvar_max=-1) const
 
bool isAllUndefined (Id iech) const
 
bool isAllUndefinedByType (const ELoc &loctype, Id iech) const
 
bool isAllIsotopic () const
 
void setInterval (Id iech, Id item, double rklow=TEST, double rkup=TEST)
 
Id getNInterval () const
 
void setBound (Id iech, Id item, double lower=TEST, double upper=TEST)
 
 getWithinBounds (Id item, bool useSel=false) const
 
 getGradient (Id item, bool useSel=false) const
 
 getTangent (Id item, bool useSel=false) const
 
 getCodeList (void) const
 
Id getSelection (Id iech) const
 
 getSelections (void) const
 
void getSampleRanksPerVariable (1 &ranks, const 1 &nbgh=1(), Id ivar=-1, bool useSel=true, bool useZ=true, bool useVerr=false, bool useExtD=true) const
 Create the vector of elligible sample ranks for the variable 'ivar'.
 
 getSampleRanks (const 1 &ivars=1(), const 1 &nbgh=1(), bool useSel=true, bool useZ=true, bool useVerr=false, bool useExtD=true) const
 
void getSampleRanksInPlace (1 &sampleRanks, const 1 &ivars=1(), const 1 &nbgh=1(), bool useSel=true, bool useZ=true, bool useVerr=false, bool useExtD=true) const
 
 getValuesByRanks (const 1 &sampleRanks, const 1 &means=1(), bool subtractMean=true) const
 
void getValuesByRanksInPlace (1 *values, const 1 &sampleRanks, const 1 &means=1(), bool subtractMean=true) const
 
Id getListOfSampleIndicesPerVariableInPlace (1 &ranks, Id ivar=0, bool useSel=true) const
 Returns the vector of indices for samples with variable 'ivar' defined For the target variable 'ivar' and for sample 'iech',.
 
Id getListOfSampleIndicesInPlace (Id nvar, 1 &cumul, 1 &ranks, bool useSel=true) const
 Updates (and resizes) the two arguments:
 
double getWeight (Id iech) const
 
 getWeights (bool useSel=false) const
 
double getSimvar (const ELoc &locatorType, Id iech, Id isimu, Id ivar, Id icase, Id nbsimu, Id nvar) const
 
void setSimvar (const ELoc &locatorType, Id iech, Id isimu, Id ivar, Id icase, Id nbsimu, Id nvar, double value)
 
void updSimvar (const ELoc &locatorType, Id iech, Id isimu, Id ivar, Id icase, Id nbsimu, Id nvar, const EOperator &oper, double value)
 
bool isActive (Id iech) const
 
bool isActiveDomain (Id iech) const
 
bool isActiveAndDefined (Id iech, Id item) const
 
VectorBool getActiveArray () const
 
 getSortArray () const
 
double getCosineToDirection (Id iech1, Id iech2, const 1 &codir) const
 
 getColumn (const String &name, bool useSel=false, bool flagCompress=true) const
 
 getColumnByUID (Id iuid, bool useSel=false, bool flagCompress=true) const
 
 getColumnByLocator (const ELoc &locatorType, Id locatorIndex=0, bool useSel=false, bool flagCompress=true) const
 
 getColumnByColIdx (Id icol, bool useSel=false, bool flagCompress=true) const
 
 getAllColumns (bool useSel=false, bool flagCompress=true) const
 
 getColumns (const VectorString &names=VectorString(), bool useSel=false, bool flagCompress=true, const 1 &origins=1()) const
 
 getColumnsAsVVD (const VectorString &names=VectorString(), bool useSel=false, bool flagCompress=true) const
 
MatrixDense getColumnsAsMatrix (const VectorString &names, bool useSel=false, bool flagCompress=true) const
 
 getColumnsByColIdx (const 1 &icols=1(), bool useSel=false, bool flagCompress=true, const 1 &origins=1()) const
 
 getColumnsByColIdxInterval (Id icol_beg, Id icol_end, bool useSel=false, bool flagCompress=true) const
 
 getColumnsActiveAndDefined (const ELoc &locatorType, const 1 &origins=1()) const
 
 getColumnsByLocator (const ELoc &locatorType, bool useSel=false, bool flagCompress=true, const 1 &origins=1()) const
 
 getColumnsByUID (const 1 &iuids, bool useSel=false, bool flagCompress=true, const 1 &origins=1()) const
 
 getColumnsByUIDInterval (Id iuid_beg, Id iuid_end, bool useSel=false, bool flagCompress=true) const
 
void setAllColumns (const 1 &tabs)
 
void deleteColumn (const String &name)
 
void deleteColumnByUID (Id iuid_del)
 
void deleteColumnByColIdx (Id icol_del)
 
void deleteColumns (const VectorString &names)
 
void deleteColumnsByLocator (const ELoc &locatorType)
 
void deleteColumnsByUID (const 1 &iuids)
 
void deleteColumnsByColIdx (const 1 &icols)
 
void deleteColumnsByUIDRange (Id i_del, Id n_del)
 
 getExtrema (Id idim, bool useSel=false) const
 
 getExtremas (bool useSel=false) const
 
 getExtends (bool useSel=false) const
 
 getCoorMinimum (bool useSel=false) const
 
 getCoorMaximum (bool useSel=false) const
 
double getExtension (Id idim, bool useSel=false) const
 
double getExtensionDiagonal (bool useSel=false) const
 
double getCenter (Id idim, bool useSel=false) const
 
 getCenters (bool useSel=false) const
 
void getExtensionInPlace (1 &mini, 1 &maxi, bool flagPreserve=false, bool useSel=false) const
 
double getMinimum (const String &name, bool useSel=false) const
 
double getMaximum (const String &name, bool useSel=false) const
 
 getRange (const String &name, bool useSel=false) const
 
double getMean (const String &name, bool useSel=false) const
 
double getVariance (const String &name, bool useSel=false) const
 
double getStdv (const String &name, bool useSel=false) const
 
double getCorrelation (const String &name1, const String &name2, bool useSel=false) const
 
bool hasSameDimension (const Db *dbaux) const
 
bool hasLargerDimension (const Db *dbaux) const
 
bool isColIdxValid (Id icol) const
 
bool isUIDValid (Id iuid) const
 
bool isSampleIndexValid (Id iech) const
 
bool isSampleIndicesValid (const 1 &iechs, bool useSel=false) const
 
bool isLocatorIndexValid (const ELoc &locatorType, Id locatorIndex) const
 
bool isDimensionIndexValid (Id idim) const
 
void combineSelection (1 &sel, const String &combine="set") const
 
void generateRank (const String &radix="rank")
 
 shrinkToValidRows (const 1 &rows) const
 
 shrinkToValidCols (const 1 &cols) const
 
void statisticsBySample (const VectorString &names, const std::vector< EStatOption > &opers=EStatOption::fromKeys({"MEAN"}), bool flagIso=true, double proba=TEST, double vmin=TEST, double vmax=TEST, const NamingConvention &namconv=NamingConvention("Stats"))
 
 statisticsMulti (const VectorString &names, bool flagIso=true, bool verbose=false, const String &title="")
 
bool areSame (const String &name1, const String &name2, double eps=EPSILON3, bool useSel=true, bool verbose=false) const
 
 filter (const String &name, const Interval &interval, Id belowRow=ITEST, Id aboveRow=ITEST) const
 
Table printOneSample (Id iech, const VectorString &names=VectorString(), bool excludeCoordinates=true, bool skipTitle=false) const
 
void dumpGeometry (Id iech, Id jech) const
 
- Public Member Functions inherited from gstlrn::AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (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)
 
ASerializableoperator= (const ASerializable &r)
 
 ASerializable (ASerializable &&r) noexcept
 
ASerializableoperator= (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)
 
- Public Member Functions inherited from gstlrn::ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Static Public Member Functions

static DbGridcreateFromNF (const String &NFFilename, bool verbose=true)
 
static DbGridcreate (const 1 &nx, const 1 &dx=1(), const 1 &x0=1(), const 1 &angles=1(), const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const 1 &tab=1(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true, bool flagAddCoordinates=true)
 
static DbGridcreateCoveringDb (const Db *dbin, const 1 &nx=1(), const 1 &dx=1(), const 1 &x0=1(), const 1 &margin=1())
 
static DbGridcreateFromPolygon (Polygons *polygon, const 1 &nodes, const 1 &dcell, bool flagAddSampleRank=true)
 
static DbGridcreateCoarse (DbGrid *dbin, const 1 &nmult, bool flagCell=true, bool flagAddSampleRank=true)
 
static DbGridcreateRefine (DbGrid *dbin, const 1 &nmult, bool flagCell=true, bool flagAddSampleRank=true)
 
static DbGridcreateFromGridExtend (const DbGrid &gridIn, const VectorString &tops, const VectorString &bots, const 1 &nxnew, bool verbose=false, double eps=EPSILON3)
 
static DbGridcreateFromGridShrink (const DbGrid &gridIn, const 1 &deletedRanks)
 
static DbGridcreateGrid2D (const ELoadBy &order, Id nx, Id ny, double x0=0., double y0=0., double dx=1., double dy=1., double angle=0., bool flagAddSampleRank=true, const 1 &tab=1())
 
static DbGridcreateSqueezeAndStretchForward (const DbGrid *grid3Din, const DbGrid *surf2D, const String &nameTop, const String &nameBot, const VectorString &names, Id nzout, double thickmin=0.)
 
static DbGridcreateSqueezeAndStretchBackward (const DbGrid *grid3Din, const DbGrid *surf2D, const String &nameTop, const String &nameBot, const VectorString &names, Id nzout, double z0out, double dzout)
 
static DbGridcreateSubGrid (const DbGrid *gridin, 1 limits, bool flagAddCoordinates=false)
 
static DbGridcreateMultiple (DbGrid *dbin, const 1 &nmult, bool flagAddSampleRank)
 
static DbGridcreateDivider (DbGrid *dbin, const 1 &nmult, bool flagAddSampleRank)
 
static DbGridcreateFillRandom (const 1 &nx, Id nvar=1, Id nfex=0, Id ncode=0, double varmax=0., double selRatio=0., const 1 &heteroRatio=1(), const 1 &means=1(), const 1 &x0=1(), Id seed=1367843)
 
- Static Public Member Functions inherited from gstlrn::Db
static Dbcreate ()
 
static DbcreateFromNF (const String &NFFilename, bool verbose=true)
 
static DbcreateFromSamples (Id nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const 1 &tab=1(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true)
 
static DbcreateFromCSV (const String &filename, const CSVformat &csv=CSVformat(), bool verbose=false, Id ncol_max=-1, Id nrow_max=-1, bool flagAddSampleRank=true)
 
static DbcreateFromBox (Id nech, const 1 &coormin, const 1 &coormax, Id seed=43241, bool flag_exact=true, bool flag_repulsion=false, double range=0., double beta=0., double extend=0., bool flagAddSampleRank=true)
 
static DbcreateFromOnePoint (const 1 &tab=1(), bool flagAddSampleRank=true)
 
static DbcreateSamplingDb (const Db *dbin, double proportion=0., Id number=0, const VectorString &names=VectorString(), Id seed=23241, bool verbose=false, bool flagAddSampleRank=true)
 
static DbcreateFromDbGrid (Id nech, DbGrid *dbgrid, Id seed=432423, bool flag_exact=true, bool flag_repulsion=false, double range=0., double beta=0., bool flagAddSampleRank=true)
 
static DbcreateReduce (const Db *dbin, const VectorString &names=VectorString(), const 1 &ranks=1(), bool verbose=false)
 
static DbcreateFillRandom (Id ndat, Id ndim=2, Id nvar=1, Id nfex=0, Id ncode=0, double varmax=0., double selRatio=0., const 1 &heteroRatio=1(), const 1 &coormin=1(), const 1 &coormax=1(), Id seed=124234, bool flagAddSampleRank=true)
 
static DbcreateEmpty (Id ndat, Id ndim=2, Id nvar=1, Id nfex=0, Id ncode=0, bool flagVerr=false, bool flagSel=false, bool flagAddSampleRank=true)
 
static DbcreateFromGridRandomized (DbGrid *dbgrid, double randperc=0., bool flagAddSampleRank=true)
 
static Id getNEloc ()
 
static getMultipleSelectedRanks (const 1 &index, const 1 &ivars=1(), const 1 &nbgh=1())
 Return the vector of the ranks within 'index' of data beloging:
 
static getMultipleSelectedVariables (const 1 &index, const 1 &ivars=1(), const 1 &nbgh=1())
 
static Id getSimRank (Id isimu, Id ivar, Id icase, Id nbsimu, Id nvar)
 
static const DbcoverSeveralDbs (const Db *db1, const Db *db2, bool *isBuilt)
 
- 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 StringgetPrefixName ()
 

Additional Inherited Members

- Public Attributes inherited from gstlrn::Db
 DECLARE_TOTL
 Has a specific implementation in the Target language.
 

Constructor & Destructor Documentation

◆ DbGrid() [1/2]

gstlrn::DbGrid::DbGrid ( )

◆ DbGrid() [2/2]

gstlrn::DbGrid::DbGrid ( const DbGrid r)

◆ ~DbGrid()

gstlrn::DbGrid::~DbGrid ( )
virtual

Member Function Documentation

◆ addSelectionFromDbByMorpho()

Id gstlrn::DbGrid::addSelectionFromDbByMorpho ( Db db,
Id  nmin = 0,
Id  radius = 0,
Id  option = 0,
const 1 &  dilation = 1(),
bool  verbose = false,
const NamingConvention namconv = NamingConvention("Morpho", false, false, true, ELoc::fromKey("SEL")) 
)

Create a selection based on the count of active samples of 'db'

Parameters
dbDb used for statistics
nminMinimum number of samples
radiusRadius of the cell neighborhood used when counting the samples
optionType of structuring element: 0 for Cross and 1 for Block
dilationVector giving the radius extension for Dilation operation
verboseVerbose flag
namconvNaming convention
Returns

◆ assignGridColumn()

Id gstlrn::DbGrid::assignGridColumn ( const String name,
Id  idim,
Id  rank,
double  value,
bool  useSel = false 
)

Set all elements of a column (1-D) along a given space dimension to a constant value

Parameters
nameName of the target variable
idimRank of the Space dimension
rankRank of the target Column
valueAssigned value
useSelUse the selection

◆ centerCoordinateInPlace()

Id gstlrn::DbGrid::centerCoordinateInPlace ( 1 &  coor,
bool  centered = false,
bool  stopIfOut = false,
double  eps = EPSILON6 
) const

◆ clean3DFromSurfaces()

void gstlrn::DbGrid::clean3DFromSurfaces ( const VectorString names,
const DbGrid surf2D,
const String nameTop = String(),
const String nameBot = String(),
bool  verbose = false 
)

Clean the contents of a 3D file by using surfaces extracted from the 2D file

Parameters
namesVector of variable of the current grid which must be processed
surf2DName of the 2-D grid file containing the surfaces
nameTopName of the Top surface (optional)
nameBotName of the Bottom surface (optional)
verboseVerbose flag
Remarks
The input file 'surf2D' and the current grid should match (in 2-D)

◆ coarsify()

DbGrid * gstlrn::DbGrid::coarsify ( const 1 &  nmult)

◆ coordinateToIndices()

gstlrn::DbGrid::coordinateToIndices ( const 1 &  coor,
bool  centered = false,
double  eps = EPSILON6 
) const

◆ coordinateToIndicesInPlace()

Id gstlrn::DbGrid::coordinateToIndicesInPlace ( const 1 &  coor,
1 &  indices,
bool  centered = false,
double  eps = EPSILON6 
) const

◆ coordinateToRank()

Id gstlrn::DbGrid::coordinateToRank ( const 1 &  coor,
bool  centered = false,
double  eps = EPSILON6 
) const

◆ create()

DbGrid * gstlrn::DbGrid::create ( const 1 &  nx,
const 1 &  dx = 1(),
const 1 &  x0 = 1(),
const 1 &  angles = 1(),
const ELoadBy &  order = ELoadBy::fromKey("SAMPLE"),
const 1 &  tab = 1(),
const VectorString names = VectorString(),
const VectorString locatorNames = VectorString(),
bool  flagAddSampleRank = true,
bool  flagAddCoordinates = true 
)
static

◆ createCoarse()

DbGrid * gstlrn::DbGrid::createCoarse ( DbGrid dbin,
const 1 &  nmult,
bool  flagCell = true,
bool  flagAddSampleRank = true 
)
static

◆ createCoveringDb()

DbGrid * gstlrn::DbGrid::createCoveringDb ( const Db dbin,
const 1 &  nx = 1(),
const 1 &  dx = 1(),
const 1 &  x0 = 1(),
const 1 &  margin = 1() 
)
static

◆ createDivider()

DbGrid * gstlrn::DbGrid::createDivider ( DbGrid dbin,
const 1 &  nmult,
bool  flagAddSampleRank 
)
static

Create a Grid Db as a divider of another Grid Db

Returns
Pointer to the newly created Db grid structure
Parameters
[in]dbinInitial Db Grid
[in]nmultArray of subdivision coefficients
[in]flagAddSampleRanktrue to add the 'rank' as first column

◆ createFillRandom()

DbGrid * gstlrn::DbGrid::createFillRandom ( const 1 &  nx,
Id  nvar = 1,
Id  nfex = 0,
Id  ncode = 0,
double  varmax = 0.,
double  selRatio = 0.,
const 1 &  heteroRatio = 1(),
const 1 &  means = 1(),
const 1 &  x0 = 1(),
Id  seed = 1367843 
)
static

Creating a new Db loaded with random values

Parameters
nxVector of mesh indices
nvarNumber of variables
nfexNumber of external drift functions
ncodeNumber of codes (no code when 0)
varmaxMaximum value for the measurement error
selRatioPercentage of samples that must be masked off (between 0 and 1)
heteroRatioVector of proportions of NA to be generated per variable
meansVector of means per variable (optional)
x0Vector of coordinates of the origin of the grid (optional)
seedValue for the Random Generator seed
Returns
A pointer to the newly created DbGrid
Remarks
The generated grid lies within a [0,1] hypercube. The variance of measurement error is created only if 'varmax' is positive. Then a field is created for each variable. this field is filled with random values uniformly generated in [0, varmax] The external drift values are generated according to Normal distribution.

◆ createFromGridExtend()

DbGrid * gstlrn::DbGrid::createFromGridExtend ( const DbGrid gridIn,
const VectorString tops,
const VectorString bots,
const 1 &  nxnew,
bool  verbose = false,
double  eps = EPSILON3 
)
static

Create a new Grid, starting from an initial Grid, and extending its space dimensions A set of Top and Bottom variables is provided which serve in designing the Top and Bottom of the new coordinates.

Parameters
gridInInitial
topsVector of Variable names which define the Tops
botsVector of Variable names which define the Bottoms
nxnewVector giving the number of meshes for each additional space dimension
verboseVerbose flag
epsEach new coordinate is calculated from the top to bottom extension inflated by eps
Returns

◆ createFromGridShrink()

DbGrid * gstlrn::DbGrid::createFromGridShrink ( const DbGrid gridIn,
const 1 &  deletedRanks 
)
static

Create a new grid, from an Initial Grid, by suppressing a set of space dimensions

Parameters
gridInInitial grid
deletedRanksVector of indices of space dimensions to be suppressed
Returns

◆ createFromNF()

DbGrid * gstlrn::DbGrid::createFromNF ( const String NFFilename,
bool  verbose = true 
)
static

Create a Db by loading the contents of a Neutral File

Parameters
NFFilenameName of the Neutral File (Db format)
verboseVerbose
Remarks
The name does not need to be completed in particular when defined by absolute path
or read from the Data Directory (in the gstlearn distribution)

◆ createFromPolygon()

DbGrid * gstlrn::DbGrid::createFromPolygon ( Polygons polygon,
const 1 &  nodes,
const 1 &  dcell,
bool  flagAddSampleRank = true 
)
static

◆ createGrid2D()

DbGrid * gstlrn::DbGrid::createGrid2D ( const ELoadBy &  order,
Id  nx,
Id  ny,
double  x0 = 0.,
double  y0 = 0.,
double  dx = 1.,
double  dy = 1.,
double  angle = 0.,
bool  flagAddSampleRank = true,
const 1 &  tab = 1() 
)
static

Create a 2-D Db structure

Returns
Pointer to the newly created 2-D Db grid structure
Parameters
[in]orderManner in which values in tab are ordered (ELoadBy)
[in]flagAddSampleRanktrue to add 'rank' as a supplementary field
[in]nxNumber of grid nodes along X
[in]nyNumber of grid nodes along Y
[in]x0Grid origin along X
[in]y0Grid origin along Y
[in]dxGrid mesh along X
[in]dyGrid mesh along Y
[in]angleRotation angle
[in]tabArray containing the data

◆ createMultiple()

DbGrid * gstlrn::DbGrid::createMultiple ( DbGrid dbin,
const 1 &  nmult,
bool  flagAddSampleRank 
)
static

Create a Grid Db as a multiple of another Grid Db

Returns
Pointer to the newly created Db grid structure
Parameters
[in]dbinInitial Db Grid
[in]nmultArray of multiplicity coefficients
[in]flagAddSampleRanktrue to add the 'rank' as first column **

◆ createRefine()

DbGrid * gstlrn::DbGrid::createRefine ( DbGrid dbin,
const 1 &  nmult,
bool  flagCell = true,
bool  flagAddSampleRank = true 
)
static

◆ createSqueezeAndStretchBackward()

DbGrid * gstlrn::DbGrid::createSqueezeAndStretchBackward ( const DbGrid grid3Din,
const DbGrid surf2D,
const String nameTop,
const String nameBot,
const VectorString names,
Id  nzout,
double  z0out,
double  dzout 
)
static

Creating a 3D grid by squeeze-and-stretch backwards, i.e. from sugar box to structural, from:

  • a 3D grid containing the relevant information
  • a 2D grid containing the top and bottom information
    Parameters
    grid3Din3D input grid
    surf2D2D grid of surfaces
    nameTopName of the variable in 'surf2D' containing the top information
    nameBotName of the variable in 'surf2D' containing the bottom information
    namesVector of names in 'grid3D' to be exported in output 3D grid
    nzout,z0out,dzoutSpecification along third dimension of the output 3D Grid
    Returns
    The output 3D grid (or nullptr in case of error)
    Remarks
    :
  • the grid files 'surf2D' and 'grid3Din' should match (in 2-D)
  • the grid 'surf2D' contains the top and bottom (identified by the corresponding locators)
  • the grid 'surf2D' contains a selection which designates the only pixels where 'top' and 'bot' are defined and correctly ordered (o save time)

◆ createSqueezeAndStretchForward()

DbGrid * gstlrn::DbGrid::createSqueezeAndStretchForward ( const DbGrid grid3Din,
const DbGrid surf2D,
const String nameTop,
const String nameBot,
const VectorString names,
Id  nzout,
double  thickmin = 0. 
)
static

Creating a 3D grid by squeeze-and-stretch forwards, i.e. from structural to sugar box, from:

  • a 3D grid containing the relevant information
  • a 2D grid containing the top and bottom information
    Parameters
    grid3Din3D input grid
    surf2D2D grid of surfaces
    nameTopName of the variable in 'surf2D' containing the top information
    nameBotName of the variable in 'surf2D' containing the bottom information
    namesVector of names in 'grid3D' to be exported in output 3D grid
    nzoutNumber of Vertical meshes in the output 3D grid
    thickminThe algorithm is not applied if
    Returns
    The output 3D grid (or nullptr in case of error)
    Remarks
    :
  • the grid files 'surf2D' and 'grid3Din' should match (in 2-D)
  • the grid 'surf2D' contains the top and bottom (identified by the corresponding locators)
  • the grid 'surf2D' contains a selection which designates the only pixels where 'top' and 'bot' are defined and correctly ordered (o save time)

◆ createSubGrid()

DbGrid * gstlrn::DbGrid::createSubGrid ( const DbGrid gridIn,
limits,
bool  flagAddCoordinates = false 
)
static

Create the sub-grid, extracted from 'gridIn' and reduced to the vector of limits

Parameters
gridInInput grid
limitsA vector of Min and Max per space dimension (Dimension: [ndim][2])
flagAddCoordinatesTrue if the grid coordinates must be included in the output file
Returns

◆ generateCoordinates()

void gstlrn::DbGrid::generateCoordinates ( const String radix = "x")

◆ getAllCellsEdges()

gstlrn::DbGrid::getAllCellsEdges ( bool  forceGridMesh = false) const

◆ getAngle()

double gstlrn::DbGrid::getAngle ( Id  idim) const
inline

◆ getAngles()

gstlrn::DbGrid::getAngles ( ) const
inline

◆ getBlockExtensions()

gstlrn::DbGrid::getBlockExtensions ( Id  node) const

◆ getCellEdges()

gstlrn::DbGrid::getCellEdges ( Id  node = 0,
bool  forceGridMesh = false 
) const

Return the VectorVectorDouble containing the borders of a cell

Parameters
nodeTarget cell
forceGridMeshWhen TRUE, returns the edges of the standard grid mesh even if a variable block extension is defined
Returns

◆ getCellSize()

double gstlrn::DbGrid::getCellSize ( ) const
inline

◆ getCenterIndices()

gstlrn::DbGrid::getCenterIndices ( bool  flagSup = false) const
inline

◆ getCodir()

gstlrn::DbGrid::getCodir ( const 1 &  grincr) const

◆ getColumnSubGrid()

gstlrn::DbGrid::getColumnSubGrid ( const String name,
Id  idim0,
Id  rank,
bool  useSel = false 
)

◆ getCoordinate()

double gstlrn::DbGrid::getCoordinate ( Id  iech,
Id  idim,
bool  flag_rotate = true 
) const
overridevirtual

Return the coordinate of a sample along one Space Dimension

Parameters
iechRank of the sample
idimRank of the Space Dimension
flag_rotateUse the rotation (only for Grid)
Returns

Reimplemented from gstlrn::Db.

◆ getCoordinateFromCorner()

gstlrn::DbGrid::getCoordinateFromCorner ( const 1 &  icorner) const
inline

◆ getCoordinateFromCornerInPlace()

void gstlrn::DbGrid::getCoordinateFromCornerInPlace ( 1 &  coor,
const 1 &  icorner 
) const
inline

◆ getCoordinatesByIndice()

gstlrn::DbGrid::getCoordinatesByIndice ( const 1 &  indice,
bool  flag_rotate = true,
const 1 &  shift = 1(),
const 1 &  dxsPerCell = 1() 
) const
inline

◆ getCoordinatesByIndiceInPlace()

void gstlrn::DbGrid::getCoordinatesByIndiceInPlace ( 1 &  coor,
const 1 &  indice,
bool  flag_rotate = true,
const 1 &  shift = 1(),
const 1 &  dxsPerCell = 1() 
) const
inline

◆ getCoordinatesInPlace()

void gstlrn::DbGrid::getCoordinatesInPlace ( 1 &  coor,
Id  iech,
bool  flag_rotate = true 
) const
overridevirtual

Update the vector of coordinates (optimized manner) No check is done with respect to the dimension of the returned vector.

Parameters
coorReturned vector of coordinates (should be dimensionned beforehand)
iechRank of the target
flag_rotateTrue if Grid rotation must be taken into account

Reimplemented from gstlrn::Db.

◆ getCoordinatesPerSample()

gstlrn::DbGrid::getCoordinatesPerSample ( Id  iech,
bool  flag_rotate = true 
) const
inline

◆ getCoordinatesPerSampleInPlace()

void gstlrn::DbGrid::getCoordinatesPerSampleInPlace ( 1 &  coor,
Id  iech,
bool  flag_rotate = true 
) const
inline

◆ getDiscretizedBlock()

gstlrn::DbGrid::getDiscretizedBlock ( const 1 &  ndiscs,
Id  iech = 0,
bool  flagPerCell = false,
bool  flagRandom = false,
Id  seed = 132433 
) const

Generate a set of discretization locations, relative to the block center Dimension: number of discretization locations, space dimension

Parameters
ndiscsNumber of discretization (per space dimension)
iechRank of the target sample (used if flagPerCell = true)
flagPerCellTRUE when the cell dimension are read from the Db (BLEX)
flagRandomTRUE if the discretization location must be randomized
seedSeed for random number generator
Returns
Remarks
: Although randomization can be performed, this process does not consume random numbers.

◆ getDistanceToOrigin()

gstlrn::DbGrid::getDistanceToOrigin ( const 1 &  origin,
const 1 &  radius = 1() 
)

◆ getDX()

double gstlrn::DbGrid::getDX ( Id  idim) const
inline

◆ getDXs()

gstlrn::DbGrid::getDXs ( ) const
inline

◆ getExtend()

double gstlrn::DbGrid::getExtend ( Id  idim) const
inline

◆ getExtends()

gstlrn::DbGrid::getExtends ( ) const
inline

◆ getGrid()

const Grid & gstlrn::DbGrid::getGrid ( ) const
inline

◆ getGridAxis()

gstlrn::DbGrid::getGridAxis ( Id  idim) const
inline

◆ getGridEdges()

gstlrn::DbGrid::getGridEdges ( ) const

Return the VectorVectorDouble containing the borders of the grid

Returns

◆ getGridPileInPlace()

void gstlrn::DbGrid::getGridPileInPlace ( Id  iuid,
const 1 &  indg,
Id  idim0,
1 &  vec 
) const

◆ getLimitsFromVariableExtend()

gstlrn::DbGrid::getLimitsFromVariableExtend ( const String nameTop,
const String nameBot,
const 1 &  dimExclude = 1() 
) const

Returns the minimum and maximum indices of the subgrid where variables 'nameTop' and 'nameBot' are both defined

Parameters
nameTopName of the Top variable
nameBotName of the Bottom variable
dimExcludeArray giving excluding dimension (see details)
Returns
A vector of Min and Max per space dimension (Dimension: [ndim][2])

: When a dimension is 'excluded', the reduction of the output grid should not be applied to this dimension

◆ getMirrorIndex()

Id gstlrn::DbGrid::getMirrorIndex ( Id  idim,
Id  ix 
) const
inline

◆ getNDim()

Id gstlrn::DbGrid::getNDim ( ) const
overridevirtual

Reimplemented from gstlrn::Db.

◆ getNTotal()

Id gstlrn::DbGrid::getNTotal ( ) const
inline

◆ getNX()

Id gstlrn::DbGrid::getNX ( Id  idim) const
inline

◆ getNXs()

gstlrn::DbGrid::getNXs ( ) const
inline

◆ getNXsExt()

gstlrn::DbGrid::getNXsExt ( Id  ndimMax) const

◆ getOneSlice()

gstlrn::DbGrid::getOneSlice ( const String name,
Id  posx = 0,
Id  posy = 1,
const 1 &  corner = 1(),
bool  useSel = false 
) const

Returns the contents of one slice extracted from a DbGrid

Parameters
nameName of the targte variable
posxRank of the first extracted coordinate (in [0, ndim[)
posyRank of the second extracted coordinate (in [0, ndim[)
cornerVector giving a reference node that belongs to the extracted section
useSelUse of the current Selection
Returns
Remarks
The argument 'corner' gives the indices of a node that belongs to the
extracted section. Obviously corner[posx] and corner[posy] are not used

◆ getOneSliceForCoordinate()

gstlrn::DbGrid::getOneSliceForCoordinate ( Id  idim,
Id  posx = 0,
Id  posy = 1,
const 1 &  corner = 1(),
bool  useSel = false 
) const

Returns the contents of one slice extracted from a DbGrid

Parameters
idimRank of the target coordinate
posxRank of the first extracted coordinate (in [0, ndim[)
posyRank of the second extracted coordinate (in [0, ndim[)
cornerVector giving a reference node that belongs to the extracted section
useSelUse of the current Selection
Returns
Remarks
If idim does not match the Space dimension of the DbGrid, empty vector if returned
If the variable exists physically, this variable is read
Otherwise, the coordinate is generated on the fly
The argument 'corner' gives the indices of a node that belongs to the
extracted section. Obviously corner[posx] and corner[posy] are not used

◆ getRotMat()

gstlrn::DbGrid::getRotMat ( ) const
inline

◆ getSampleAsSTInPlace()

void gstlrn::DbGrid::getSampleAsSTInPlace ( Id  iech,
SpaceTarget P 
) const
overridevirtual

Load a Space Target with all possible contents gathered from Db

Parameters
iechRank of the target sample
PSpace Target (used to store information)

Reimplemented from gstlrn::Db.

◆ getSlice()

gstlrn::DbGrid::getSlice ( const String name,
Id  pos = 0,
Id  indice = 0,
bool  useSel = false 
) const

Extracts a slice from a 3-D Grid

Parameters
nameName of the target variable
posType of section: 0 for YoZ; 1 for XoZ and 2 for XoY
indiceRank of the section
useSelUse the active selection
Returns
A VectorVectorDouble with 4 columns, i.e: X, Y, Z, Var
Remarks
In presence of a selection and if useSel is TRUE,
values are returned but set to TEST

◆ getUnit()

double gstlrn::DbGrid::getUnit ( Id  idim = 0) const
overridevirtual

Return a Unit calculated for a Db (in a given Space dimension)

Parameters
idimRank of the Space dimension
Returns
Remarks
This unit is defined as 1/1000 of the extension in the given space dimension

Reimplemented from gstlrn::Db.

◆ getVolume()

double gstlrn::DbGrid::getVolume ( ) const
inline

◆ getX0()

double gstlrn::DbGrid::getX0 ( Id  idim) const
inline

◆ getX0s()

gstlrn::DbGrid::getX0s ( ) const
inline

◆ gridCopyParams()

void gstlrn::DbGrid::gridCopyParams ( Id  mode,
const Grid gridaux 
)

◆ gridDefine()

Id gstlrn::DbGrid::gridDefine ( const 1 &  nx,
const 1 &  dx = 1(),
const 1 &  x0 = 1(),
const 1 &  angles = 1() 
)

◆ hasSingleBlock()

bool gstlrn::DbGrid::hasSingleBlock ( ) const

◆ indicesToCoordinate()

gstlrn::DbGrid::indicesToCoordinate ( const 1 &  indice,
const 1 &  percent = 1() 
) const
inline

◆ indicesToCoordinateInPlace()

void gstlrn::DbGrid::indicesToCoordinateInPlace ( const 1 &  indice,
1 &  coor,
const 1 &  percent = 1() 
) const
inline

◆ indiceToRank()

Id gstlrn::DbGrid::indiceToRank ( const 1 &  indice) const
inline

◆ initThread()

void gstlrn::DbGrid::initThread ( ) const
overridevirtual

Reimplemented from gstlrn::Db.

◆ isConsistent()

bool gstlrn::DbGrid::isConsistent ( ) const
overridevirtual

Reimplemented from gstlrn::Db.

Reimplemented in gstlrn::DbMeshTurbo.

◆ isGrid()

bool gstlrn::DbGrid::isGrid ( ) const
inlineoverridevirtual

Db Interface.

Reimplemented from gstlrn::Db.

◆ isGridRotated()

bool gstlrn::DbGrid::isGridRotated ( ) const

◆ isSameGrid()

bool gstlrn::DbGrid::isSameGrid ( const Grid grid) const

◆ isSameGridMesh()

bool gstlrn::DbGrid::isSameGridMesh ( const DbGrid dbaux) const

◆ isSameGridRotation()

bool gstlrn::DbGrid::isSameGridRotation ( const DbGrid dbaux) const

◆ locateDataInGrid()

gstlrn::DbGrid::locateDataInGrid ( const Db data,
const 1 &  rankIn = 1(),
bool  centered = false,
bool  useSel = false 
) const

◆ mayChangeSampleNumber()

bool gstlrn::DbGrid::mayChangeSampleNumber ( ) const
inlineoverridevirtual

Reimplemented from gstlrn::Db.

Reimplemented in gstlrn::DbMeshTurbo.

◆ migrateAllVariables()

bool gstlrn::DbGrid::migrateAllVariables ( Db dbin,
bool  flag_fill = true,
bool  flag_inter = true,
bool  flag_ball = false,
bool  flagAddSampleRank = true 
)

Migrate all the variables (Z_locator) from 'dbin' on the nodes of 'this' (grid)

Parameters
dbinInput Db
flagAddSampleRanktrue if the rank of the samples must be aaded
flag_fillFilling option
flag_interInterpolation
flag_ballUse BallTree sorting algorithm when available
Returns

◆ morpho()

Id gstlrn::DbGrid::morpho ( const EMorpho &  oper,
double  vmin = 0.5,
double  vmax = 1.5,
Id  option = 0,
const 1 &  radius = 1(),
bool  flagDistErode = false,
bool  verbose = false,
const NamingConvention namconv = NamingConvention("Morpho") 
)

◆ operator=()

DbGrid & gstlrn::DbGrid::operator= ( const DbGrid r)

◆ rankToCoordinates()

gstlrn::DbGrid::rankToCoordinates ( Id  rank,
const 1 &  percent = 1() 
) const
inline

◆ rankToCoordinatesInPlace()

void gstlrn::DbGrid::rankToCoordinatesInPlace ( Id  rank,
1 &  coor,
const 1 &  percent = 1() 
) const
inline

◆ rankToIndice()

void gstlrn::DbGrid::rankToIndice ( Id  node,
1 &  indices,
bool  minusOne = false 
) const
inline

◆ refine()

DbGrid * gstlrn::DbGrid::refine ( const 1 &  nmult)

◆ reset()

Id gstlrn::DbGrid::reset ( const 1 &  nx,
const 1 &  dx = 1(),
const 1 &  x0 = 1(),
const 1 &  angles = 1(),
const ELoadBy &  order = ELoadBy::fromKey("SAMPLE"),
const 1 &  tab = 1(),
const VectorString names = VectorString(),
const VectorString locatorNames = VectorString(),
bool  flagAddSampleRank = true,
bool  flagAddCoordinates = true 
)

Creating a Db regular grid of any dimension

Parameters
nxA vector of the number of grid meshes. The number of items in this argument gives the dimension of the space. (size = ndim)
dxVector cell meshes size in each direction (size = ndim) (by default, use 1)
x0Vector of origin coordinates (size = ndim) (by default, use 0)
anglesArray giving the rotation angles (only for dimension 2 or 3). The first angle corresponds to the rotation around OZ axis, the second to a rotation around OY'and the third one around Ox. The dimension of this array cannot exceed the space dimension.
orderFlag for values order in 'tab' (defined ELoadBy.hpp)
tabVariable values array (size = nvar * nsamples)
namesNames of the Variables of 'tab' (size = nvar)
locatorNamesLocators for each variable of array 'tab' (size = nvar)
flagAddSampleRankIf true, add an automatic rank variable
flagAddCoordinatesIf TRUE, add the grid coordinates

◆ resetCoveringDb()

Id gstlrn::DbGrid::resetCoveringDb ( const Db db,
const 1 &  nx = 1(),
const 1 &  dx = 1(),
const 1 &  x0 = 1(),
const 1 &  margin = 1() 
)

Creating a Grid Db which covers the extension of the input 'Db'

Parameters
dbInput Db from which the newly created Db is constructed
nxVector of the expected number of grid nodes (default = 10)
dxVector of the expected sizes for the grid meshes (in distance)
x0Vector of the expected origin of the grid (in coordinate)
marginVector of the expected margins of the grid (in distance)
Remarks
Arguments 'nodes' and 'dcell' are disjunctive. If both defined, 'dcell' prevails

Load the data

◆ resetDims()

void gstlrn::DbGrid::resetDims ( Id  ncol,
Id  nech 
)
overridevirtual

Set dimension

Parameters
ncolNumber of columns (= variables)
nechNumber of samples (ignore in case of Grid)

Reimplemented from gstlrn::Db.

◆ resetFromPolygon()

Id gstlrn::DbGrid::resetFromPolygon ( Polygons polygon,
const 1 &  nodes,
const 1 &  dcell,
bool  flagAddSampleRank = true 
)

Creating a regular grid Db which covers the input Polygon

Parameters
polygonPointer to the input Polygon
nodesVector of the expected number of nodes
dcellVector of the expected dimensions for the grid cells
flagAddSampleRanktrue if the sample rank must be generated

Load the data

◆ sampleBelongsToCell()

bool gstlrn::DbGrid::sampleBelongsToCell ( const 1 &  coor,
Id  rank,
const 1 &  dxsPerCell = 1() 
) const
inline

◆ setDX()

void gstlrn::DbGrid::setDX ( Id  idim,
double  value 
)
inline

◆ setGridPileInPlace()

void gstlrn::DbGrid::setGridPileInPlace ( Id  iuid,
const 1 &  indg,
Id  idim0,
const 1 &  vec 
)

◆ setNX()

void gstlrn::DbGrid::setNX ( Id  idim,
Id  value 
)
inline

◆ setSelectionFromVariableExtend()

Id gstlrn::DbGrid::setSelectionFromVariableExtend ( const String nameTop,
const String nameBot 
)

Defines a selection in the current grid where variables 'nameTop' and 'nameBot' are both defined and ordered properly

Parameters
nameTopName of the Top variable
nameBotName of the Bottom variable

: This method also adds a selection in the current grid which masks off the pixels where 'nameTop' and 'nameBot' are defined but not correctly ordered. This is the reason why this method cannot be 'const'

◆ setX0()

void gstlrn::DbGrid::setX0 ( Id  idim,
double  value 
)
inline

◆ smooth()

Id gstlrn::DbGrid::smooth ( ANeigh neigh,
Id  type = 1,
double  range = 1.,
const NamingConvention namconv = NamingConvention("Smooth") 
)

◆ toString()

String gstlrn::DbGrid::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

ICloneable interface.

AStringable Interface

Reimplemented from gstlrn::Db.

Reimplemented in gstlrn::DbMeshTurbo.


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