1.4.1
CCC
 
Db Class Reference

Class containing the Data Information. More...

#include <Db.hpp>

Inheritance diagram for Db:
AStringable ASerializable ICloneable DbGraphO DbGrid DbLine DbMeshStandard DbMeshTurbo

Detailed Description

Class containing the Data Information.

This Data Set benefits from the comparison to an Excel spread sheet: it can be considered as a Data Frame with a number of rows and a number of columns. The columns will correspond to variables and the rows to samples.

Notes:

  • For short, this Data Base organization is referred to as Db,
  • At any time, variables can be added, renamed or deleted,
  • In the current version, this Data Set is currently limited to numerical contents. The data frame is necessarily completely filled with values: therefore, a specific value stands for a missing value (printed as NA);

Moreover each variable may be assigned a role (or functionality) in the rest of a script. This role is defined by a locator: for example, a variable can serve as a coordinate, or a target variable. The locators can be viewed in the following list (see ELoc.hpp). Note that a variable which does not play any role in particular may be assigned to an idle role (locator NA); This locator may be modified or cancelled (by the user) at any time.

There are two status for these locators: unique or multiple.

Unique. Only one variable can be assigned this unique locator: this is the case for the selection (SEL) as there may be only one current selection activated at a time.

Multiple. Several variable may be assigned the same locator: this is the case for the coordinates (X). In that case, the locator name is followed by its rank (1-based). Then the first coordinate will correspond to the locator X1, the second coordinate to X2, ... Note that:

  • for a given locator name, the ranks are always consecutive between 1 and N (if it happens that you delete X3, the locator X4 is automatically modified into X3, X5 into X4, and so on up to X{N} into X{N-1}.
  • there is no limitation in the number of ranks for a given locator name.

Each variable (or column) can be designated:

  • by its name (unique in the Data Base) or
  • by its locator (name and rank) or
  • by its column index (0-based): this designation mode is dangerous (and not recommended) as the index may change over time.

Public Member Functions

 Db ()
 
 Db (const Db &r)
 
Dboperator= (const Db &r)
 
virtual ~Db ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface. More...
 
virtual bool isGrid () const
 Interface for Db. More...
 
virtual bool isLine () const
 
virtual bool isMesh () const
 
virtual double getCoordinate (int iech, int idim, bool flag_rotate=true) const
 
virtual void getCoordinatesPerSampleInPlace (int iech, VectorDouble &coor, bool flag_rotate=true) const
 
virtual double getUnit (int idim=0) const
 
virtual int getNDim () const
 
virtual bool mayChangeSampleNumber () const
 
virtual void resetDims (int ncol, int nech)
 
virtual bool isConsistent () const
 
int resetFromSamples (int nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const VectorDouble &tab=VectorDouble(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true)
 
int resetFromCSV (const String &filename, bool verbose, const CSVformat &csvfmt, int ncol_max=-1, int nrow_max=-1, bool flagAddSampleRank=true)
 
int resetFromBox (int nech, const VectorDouble &coormin, const VectorDouble &coormax, int ndim=2, double extend=0., int seed=321415, bool flagAddSampleRank=true)
 
int resetFromOnePoint (const VectorDouble &tab=VectorDouble(), bool flagAddSampleRank=true)
 
int resetSamplingDb (const Db *dbin, double proportion=0, int number=0, const VectorString &names=VectorString(), int seed=23241, bool verbose=false, bool flagAddSampleRank=true)
 
int resetReduce (const Db *dbin, const VectorString &names=VectorString(), const VectorInt &ranks=VectorInt(), bool verbose=false)
 
const VectorDoublegetArrays () const
 
String getNameByLocator (const ELoc &locatorType, int locatorIndex=0) const
 
String getNameByColIdx (int icol) const
 
String getNameByUID (int iuid) const
 
VectorString getName (const String &name) const
 
VectorString getNames (const VectorString &names) const
 
VectorString getNamesByLocator (const ELoc &locatorType) const
 
VectorString getNamesByColIdx (const VectorInt &icols) const
 
VectorString getNamesByUID (const VectorInt &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 (int iuid, const String &name)
 
void setNameByColIdx (int 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
 
int getUIDMaxNumber () const
 
int getColumnNumber () const
 
int getSampleNumber (bool useSel=false) const
 
int getNumberActiveAndDefined (int item) const
 
int getActiveSampleNumber () const
 
int getRankRelativeToAbsolute (int irel) const
 
int getRankAbsoluteToRelative (int iabs) const
 
void clearLocators (const ELoc &locatorType)
 
void clearSelection ()
 
void setLocatorByUID (int iuid, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorByColIdx (int icol, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocator (const String &name, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocators (const VectorString &names, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByUID (int number, int iuid, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByUID (const VectorInt &iuids, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void setLocatorsByColIdx (const VectorInt &icols, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool cleanSameLocator=false)
 
void addColumnsByVVD (const VectorVectorDouble &tab, const String &radix, const ELoc &locatorType, int locatorIndex=0, bool useSel=false)
 
int addColumns (const VectorDouble &tab, const String &radix="New", const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool useSel=false, double valinit=0., int nvar=1)
 
int addColumnsByConstant (int nadd=1, double valinit=0., const String &radix="New", const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, int nechInit=0)
 
int addColumnsRandom (int nadd, const String &radix="New", const ELoc &locatorType=ELoc::fromKey("Z"), int locatorIndex=0, int seed=1352, int nechInit=0)
 
int addSelection (const VectorDouble &tab=VectorDouble(), const String &name="NewSel", const String &combine="set")
 
int addSelectionByRanks (const VectorInt &ranks, const String &name="NewSel", const String &combine="set")
 
int addSelectionByLimit (const String &testvar, const Limits &limits=Limits(), const String &name="NewSel", const String &combine="set")
 
int addSelectionFromDbByConvexHull (Db *db, double dilate=0., bool verbose=false, const NamingConvention &namconv=NamingConvention("Hull", true, true, true, ELoc::fromKey("SEL")))
 
int addSelectionRandom (double prop, int seed=138213, const String &name="NewSel", const String &combine="set")
 
int addSamples (int nadd, double valinit=TEST)
 
int deleteSample (int e_del)
 
int deleteSamples (const VectorInt &e_dels)
 
void switchLocator (const ELoc &locatorType_in, const ELoc &locatorType_out)
 
int getLastUID (int number=0) const
 
String getLastName (int number=0) const
 
int getColIdx (const String &name) const
 
int getColIdxByUID (int iuid) const
 
int getColIdxByLocator (const ELoc &locatorType, int locatorIndex=0) const
 
VectorInt getColIdxs (const String &name) const
 
VectorInt getColIdxs (const VectorString &names) const
 
VectorInt getColIdxsByUID (const VectorInt &iuids) const
 
VectorInt getColIdxsByLocator (const ELoc &locatorType) const
 
void setColumn (const VectorDouble &tab, const String &name, const ELoc &locatorType=ELoc::fromKey("UNKNOWN"), int locatorIndex=0, bool useSel=false)
 
void setColumnByUIDOldStyle (const double *tab, int iuid, bool useSel=false)
 
void setColumnByUID (const VectorDouble &tab, int iuid, bool useSel=false)
 
void setColumnByColIdx (const VectorDouble &tab, int icol, bool useSel=false)
 
void setColumnsByColIdx (const VectorDouble &tabs, const VectorInt &icols, bool useSel=false)
 
void setColumnByColIdxOldStyle (const double *tab, int icol, bool useSel=false)
 
void duplicateColumnByUID (int iuid_in, int iuid_out)
 
VectorVectorDouble getItem (const VectorInt &rows, const VectorString &colnames, bool useSel=false) const
 
VectorVectorDouble getItem (const VectorInt &rows, const String &colname, bool useSel=false) const
 
VectorVectorDouble getItem (const VectorInt &rows, const ELoc &locatorType, bool useSel=false) const
 
VectorVectorDouble getItem (const VectorString &colnames, bool useSel=false) const
 
VectorVectorDouble getItem (const String &colname, bool useSel=false) const
 
VectorVectorDouble 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
 
int setItem (const VectorInt &rows, const VectorString &colnames, const VectorVectorDouble &values, bool useSel=false)
 
int setItem (const VectorInt &rows, const ELoc &locatorType, const VectorVectorDouble &values, bool useSel=false)
 
int setItem (const VectorString &colnames, const VectorVectorDouble &values, bool useSel=false)
 
int setItem (const ELoc &locatorType, const VectorVectorDouble &values, bool useSel=false)
 
int setItem (const VectorInt &rows, const String &colname, const VectorDouble &values, bool useSel=false)
 
int setItem (const String &colname, const VectorDouble &values, bool useSel=false)
 
bool getLocator (const String &name, ELoc *ret_locatorType, int *ret_locatorIndex) const
 
bool getLocatorByColIdx (int icol, ELoc *ret_locatorType, int *ret_locatorIndex) const
 
bool getLocatorByUID (int iuid, ELoc *ret_locatorType, int *ret_locatorIndex) const
 
VectorString getLocators (bool anyLocator=true, const ELoc &locatorType=ELoc::fromKey("UNKNOWN")) const
 
int getLocatorNumber (const ELoc &locatorType) const
 
bool isUIDDefined (int iuid) const
 
int getUID (const String &name) const
 
int getUIDByColIdx (int icol) const
 
int getUIDByLocator (const ELoc &locatorType, int locatorIndex=0) const
 
VectorInt getUIDs (const VectorString &names) const
 
VectorInt getUIDsByLocator (const ELoc &locatorType) const
 
VectorInt getUIDsByColIdx (const VectorInt &icols) const
 
VectorInt getAllUIDs () const
 
void copyByUID (int iuidIn, int iuidOut)
 
void copyByCol (int icolIn, int icolOut)
 
int getFaciesNumber (void) const
 
bool hasLocatorDefined (const String &name, const ELoc &locatorType, int locatorIndex=0) const
 
VectorDouble getSampleCoordinates (int iech) const
 
void getSampleAsSPInPlace (int iech, SpacePoint &P) const
 
virtual void getSampleAsSTInPlace (int iech, SpaceTarget &P) const
 
void getSampleCoordinatesInPlace (int iech, VectorDouble &coor) const
 
VectorDouble getSampleLocators (const ELoc &locatorType, int iech) const
 
VectorVectorDouble getIncrements (const VectorInt &iechs, const VectorInt &jechs) const
 
VectorDouble getCoordinates (int idim, bool useSel=false, bool flag_rotate=true) const
 
VectorVectorDouble getAllCoordinates (bool useSel=false) const
 
MatrixRectangular getAllCoordinatesMat () const
 
void setCoordinate (int iech, int idim, double value)
 
void setCoordinates (int idim, const VectorDouble &coor, bool useSel=false)
 
void setSampleCoordinates (int iech, const VectorDouble &coor)
 
double getDistance1D (int iech, int jech, int idim=0, bool flagAbs=false) const
 
double getDistance (int iech, int jech) const
 
int getDistanceVecInPlace (int iech, int jech, VectorDouble &dd, const Db *db2=nullptr) const
 
double getValue (const String &name, int iech) const
 
void setValue (const String &name, int iech, double value)
 
double getArray (int iech, int iuid) const
 
void getArrayVec (const VectorInt &iechs, int iuid, VectorDouble &values) const
 
void setArray (int iech, int iuid, double value)
 
void setArrayVec (const VectorInt &iechs, int iuid, const VectorDouble &values)
 
void updArray (int iech, int iuid, const EOperator &oper, double value)
 
void updArrayVec (const VectorInt &iechs, int iuid, const EOperator &oper, VectorDouble &values)
 
VectorDouble getArrayByUID (int iuid, bool useSel=false) const
 
VectorDouble getArrayBySample (int iech) const
 
void setArrayBySample (int iech, const VectorDouble &vec)
 
std::vector< SpacePointgetSamplesAsSP (bool useSel=false) const
 
bool hasLocator (const ELoc &locatorType) const
 
int getFromLocatorNumber (const ELoc &locatorType) const
 
double getFromLocator (const ELoc &locatorType, int iech, int locatorIndex=0) const
 
void setFromLocator (const ELoc &locatorType, int iech, int locatorIndex, double value)
 
double getValueByColIdx (int iech, int icol) const
 
void setValueByColIdx (int iech, int icol, double value)
 
VectorDouble getValuesByNames (const VectorInt &iechs, const VectorString &names, bool bySample=false) const
 
VectorDouble getValuesByColIdx (const VectorInt &iechs, const VectorInt &icols, bool bySample=false) const
 
void setValuesByNames (const VectorInt &iechs, const VectorString &names, const VectorDouble &values, bool bySample=false)
 
void setValuesByColIdx (const VectorInt &iechs, const VectorInt &icols, const VectorDouble &values, bool bySample=false)
 
int getLocNumber (const ELoc &loctype) const
 
bool hasLocVariable (const ELoc &loctype) const
 
double getLocVariable (const ELoc &loctype, int iech, int item) const
 
void setLocVariable (const ELoc &loctype, int iech, int item, double value)
 
void updLocVariable (const ELoc &loctype, int iech, int item, const EOperator &oper, double value)
 
int getZNumber () const
 
bool hasZVariable () const
 
double getZVariable (int iech, int item) const
 
void setZVariable (int iech, int item, double value)
 
void updZVariable (int iech, int item, const EOperator &oper, double value)
 
VectorDouble getLocVariables (const ELoc &loctype, int iech, int nitemax=0) const
 
void setLocVariables (const ELoc &loctype, int iech, const VectorDouble &values)
 
bool isVariableNumberComparedTo (int nvar, int compare=0) const
 
bool isIsotopic (int iech, int nvar_max=-1) const
 
bool isAllUndefined (int iech) const
 
bool isAllUndefinedByType (const ELoc &loctype, int iech) const
 
bool isAllIsotopic () const
 
void setInterval (int iech, int item, double rklow=TEST, double rkup=TEST)
 
int getIntervalNumber () const
 
void setBound (int iech, int item, double lower=TEST, double upper=TEST)
 
VectorDouble getWithinBounds (int item, bool useSel=false) const
 
VectorDouble getGradient (int item, bool useSel=false) const
 
VectorDouble getTangent (int item, bool useSel=false) const
 
VectorDouble getCodeList (void) const
 
int getSelection (int iech) const
 
VectorDouble getSelections (void) const
 
VectorInt getRanksActive (const VectorInt &nbgh=VectorInt(), int item=-1, bool useSel=true, bool useVerr=false) const
 
VectorVectorInt getMultipleRanksActive (const VectorInt &ivars=VectorInt(), const VectorInt &nbgh=VectorInt(), bool useSel=true, bool useVerr=false) const
 
VectorDouble getMultipleValuesActive (const VectorInt &ivars=VectorInt(), const VectorInt &nbgh=VectorInt(), const VectorDouble &means=VectorDouble(), bool useSel=true, bool useVerr=false) const
 
double getWeight (int iech) const
 
VectorDouble getWeights (bool useSel=false) const
 
double getSimvar (const ELoc &locatorType, int iech, int isimu, int ivar, int icase, int nbsimu, int nvar) const
 
void setSimvar (const ELoc &locatorType, int iech, int isimu, int ivar, int icase, int nbsimu, int nvar, double value)
 
void updSimvar (const ELoc &locatorType, int iech, int isimu, int ivar, int icase, int nbsimu, int nvar, const EOperator &oper, double value)
 
bool isActive (int iech) const
 
bool isActiveDomain (int iech) const
 
bool isActiveAndDefined (int iech, int item) const
 
int getActiveAndDefinedNumber (int item) const
 
int getActiveAndDefinedNumber (const String &name) const
 
VectorBool getActiveArray () const
 
VectorInt getSortArray () const
 
double getCosineToDirection (int iech1, int iech2, const VectorDouble &codir) const
 
VectorDouble getColumn (const String &name, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumnByUID (int iuid, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumnByLocator (const ELoc &locatorType, int locatorIndex=0, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumnByColIdx (int icol, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getAllColumns (bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumns (const VectorString &names=VectorString(), bool useSel=false, bool flagCompress=true, const VectorDouble &origins=VectorDouble()) const
 
VectorVectorDouble getColumnsAsVVD (const VectorString &names=VectorString(), bool useSel=false, bool flagCompress=true) const
 
MatrixRectangular getColumnsAsMatrix (const VectorString &names, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumnsByColIdx (const VectorInt &icols=VectorInt(), bool useSel=false, bool flagCompress=true, const VectorDouble &origins=VectorDouble()) const
 
VectorDouble getColumnsByColIdxInterval (int icol_beg, int icol_end, bool useSel=false, bool flagCompress=true) const
 
VectorDouble getColumnsActiveAndDefined (const ELoc &locatorType, const VectorDouble &origins=VectorDouble()) const
 
VectorDouble getColumnsByLocator (const ELoc &locatorType, bool useSel=false, bool flagCompress=true, const VectorDouble &origins=VectorDouble()) const
 
VectorDouble getColumnsByUID (const VectorInt &iuids, bool useSel=false, bool flagCompress=true, const VectorDouble &origins=VectorDouble()) const
 
VectorDouble getColumnsByUIDInterval (int iuid_beg, int iuid_end, bool useSel=false, bool flagCompress=true) const
 
void setAllColumns (const VectorVectorDouble &tabs)
 
void deleteColumn (const String &name)
 
void deleteColumnByUID (int iuid_del)
 
void deleteColumnByColIdx (int icol_del)
 
void deleteColumns (const VectorString &names)
 
void deleteColumnsByLocator (const ELoc &locatorType)
 
void deleteColumnsByUID (const VectorInt &iuids)
 
void deleteColumnsByColIdx (const VectorInt &icols)
 
void deleteColumnsByUIDRange (int i_del, int n_del)
 
VectorDouble getExtrema (int idim, bool useSel=false) const
 
VectorVectorDouble getExtremas (bool useSel=false) const
 
VectorDouble getCoorMinimum (bool useSel=false) const
 
VectorDouble getCoorMaximum (bool useSel=false) const
 
double getExtension (int idim, bool useSel=false) const
 
double getExtensionDiagonal (bool useSel=false) const
 
double getCenter (int idim, bool useSel=false) const
 
VectorDouble getCenters (bool useSel=false) const
 
void getExtensionInPlace (VectorDouble &mini, VectorDouble &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
 
VectorDouble 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 (int icol) const
 
bool isUIDValid (int iuid) const
 
bool isSampleIndexValid (int iech) const
 
bool isSampleIndicesValid (const VectorInt &iechs, bool useSel=false) const
 
bool isLocatorIndexValid (const ELoc &locatorType, int locatorIndex) const
 
bool isDimensionIndexValid (int idim) const
 
void combineSelection (VectorDouble &sel, const String &combine="set") const
 
void generateRank (const String &radix="rank")
 
VectorInt shrinkToValidRows (const VectorInt &rows) const
 
VectorInt shrinkToValidCols (const VectorInt &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"))
 
VectorDouble 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
 
VectorInt filter (const String &name, const Interval &interval, int belowRow=ITEST, int aboveRow=ITEST) const
 
VectorInt getSampleRanks () const
 
Table printOneSample (int iech, const VectorString &names=VectorString(), bool excludeCoordinates=true, bool skipTitle=false) const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 
- Public Member Functions inherited from ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Static Public Member Functions

static Dbcreate ()
 
static DbcreateFromNF (const String &neutralFilename, bool verbose=true)
 
static DbcreateFromSamples (int nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const VectorDouble &tab=VectorDouble(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true)
 
static DbcreateFromCSV (const String &filename, const CSVformat &csv=CSVformat(), bool verbose=false, int ncol_max=-1, int nrow_max=-1, bool flagAddSampleRank=true)
 
static DbcreateFromBox (int nech, const VectorDouble &coormin, const VectorDouble &coormax, int 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 VectorDouble &tab=VectorDouble(), bool flagAddSampleRank=true)
 
static DbcreateSamplingDb (const Db *dbin, double proportion=0., int number=0, const VectorString &names=VectorString(), int seed=23241, bool verbose=false, bool flagAddSampleRank=true)
 
static DbcreateFromDbGrid (int nech, DbGrid *dbgrid, int 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 VectorInt &ranks=VectorInt(), bool verbose=false)
 
static DbcreateFillRandom (int ndat, int ndim=2, int nvar=1, int nfex=0, int ncode=0, double varmax=0., double selRatio=0., const VectorDouble &heteroRatio=VectorDouble(), const VectorDouble &coormin=VectorDouble(), const VectorDouble &coormax=VectorDouble(), int seed=124234, bool flagAddSampleRank=true)
 
static int getNEloc ()
 
static VectorInt getMultipleRanks (const VectorVectorInt &index, const VectorInt &ivars=VectorInt(), const VectorInt &nbgh=VectorInt())
 
static int getSimRank (int isimu, int ivar, int icase, int nbsimu, int nvar)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Public Attributes

 DECLARE_TOTL
 Has a specific implementation in the Target language. More...
 

Constructor & Destructor Documentation

◆ Db() [1/2]

Db::Db ( )

◆ Db() [2/2]

Db::Db ( const Db r)

◆ ~Db()

Db::~Db ( )
virtual

Member Function Documentation

◆ addColumns()

int Db::addColumns ( const VectorDouble tab,
const String radix = "New",
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  useSel = false,
double  valinit = 0.,
int  nvar = 1 
)

Add one or several columns to an already existing Db. This is performed by providing an array of values 'tab'. Its dimension must be equal to the number of samples (or active samples if 'useSel' is true, times the number of variables 'nvar'.

Parameters
tabArray to be loaded
radixGeneric name for the newly created variables
locatorTypeGeneric locator assigned to new variables
locatorIndexLocator index (starting from 0)
useSeltrue if the Selection must be taken into account
valinitinitial value (for unselected samples)
nvarNumber of variables loaded
Returns
Rank of the first UID
Remarks
When 'useSel' is used, you must have a Selection already defined. Then the number
of samples provided in 'tab' must match the number of active samples
When a vector 'tab' is provided, the number of variables 'nvar'
is calculated as its size divided by the number of samples in the grid.

◆ addColumnsByConstant()

int Db::addColumnsByConstant ( int  nadd = 1,
double  valinit = 0.,
const String radix = "New",
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
int  nechInit = 0 
)

Create a set of new variables in an already existing Db and initialize their contents to a constant value

Parameters
naddNumber of variables to be added
valinitValue to be used for variable initialization
radixGeneric radix given to the newly created variables
locatorTypeGeneric locator assigned to new variables
locatorIndexLocator index (starting from 0)
nechInitNumber of samples (used only if the Db is initially empty)
Returns
Rank of the first UID

◆ addColumnsByVVD()

void Db::addColumnsByVVD ( const VectorVectorDouble tab,
const String radix,
const ELoc &  locatorType,
int  locatorIndex = 0,
bool  useSel = false 
)

◆ addColumnsRandom()

int Db::addColumnsRandom ( int  nadd,
const String radix = "New",
const ELoc &  locatorType = ELoc::fromKey("Z"),
int  locatorIndex = 0,
int  seed = 1352,
int  nechInit = 0 
)

Create a set of new variables in an already existing Db and initialize their contents as a ranom value (from Normal distribution)

Parameters
naddNumber of variables to be added
radixGeneric radix given to the newly created variables
locatorTypeGeneric locator assigned to new variables
locatorIndexLocator index (starting from 0)
seedSeed value
nechInitNumber of samples (used only if the Db is initially empty)
Returns
Rank of the first UID

◆ addSamples()

int Db::addSamples ( int  nadd,
double  valinit = TEST 
)

Add samples to the Data Base

Parameters
naddNumber of samples to be added
valinitDefault value given to the added samples
Returns
Index of the first newly added sample (or -1 if adding samples is not authorized)

◆ addSelection()

int Db::addSelection ( const VectorDouble tab = VectorDouble(),
const String name = "NewSel",
const String combine = "set" 
)

Add the contents of the 'tab' as a Selection

Parameters
tabInput array
nameName given to the newly created Selection variable
combineHow to combine with an already existing selection (see combineSelection() for details)
Returns
Rank of the newly created Column within the Data Base
Remarks
The Selection is set to True if tab is not zero and to False otherwise.
If the dimension of 'tab' does not match the number of samples in the Db
the action is cancelled (a message is issued)

◆ addSelectionByLimit()

int Db::addSelectionByLimit ( const String testvar,
const Limits limits = Limits(),
const String name = "NewSel",
const String combine = "set" 
)

Create a selection around the only defined values of the target variable

Parameters
testvarName of the target variable
limitsLimits defining the Definition Domain to be tested (optional)
nameName of the newly created selection
combineHow to combine with an already existing selection (see combineSelection() for details)
Returns
The rank of the newly created selection variable within the Db

◆ addSelectionByRanks()

int Db::addSelectionByRanks ( const VectorInt ranks,
const String name = "NewSel",
const String combine = "set" 
)

Add a Selection by considering the input 'ranks' vector which give the ranks of the active samples (starting from 0)

Parameters
ranksVector of ranks of active samples
nameName given to the newly created Selection variable
combineHow to combine with an already existing selection (see combineSelection() for details)
Returns

◆ addSelectionFromDbByConvexHull()

int Db::addSelectionFromDbByConvexHull ( Db db,
double  dilate = 0.,
bool  verbose = false,
const NamingConvention namconv = NamingConvention("Hull", true, true, true,                                                                                        ELoc::fromKey("SEL")) 
)

Create a Selection based on the Convex Hull of the active samples of 'Db'

Parameters
dbData Base providing the (active) samples
dilateThe convex hull can be dilated: this gives the radius
verboseVerbose option
namconvNaming Convention
Returns

◆ addSelectionRandom()

int Db::addSelectionRandom ( double  prop,
int  seed = 138213,
const String name = "NewSel",
const String combine = "set" 
)

Create a Selection based on a proportion of active samples

Parameters
propProportion of active samples (between 0 and 1)
seedSeed for the random number generator
nameName of the newly created selection
combineHow to combine with an already existing selection (see combineSelection() for details)
Returns

◆ areSame()

bool Db::areSame ( const String name1,
const String name2,
double  eps = EPSILON3,
bool  useSel = true,
bool  verbose = false 
) const

◆ clearLocators()

void Db::clearLocators ( const ELoc &  locatorType)

◆ clearSelection()

void Db::clearSelection ( )
inline

◆ combineSelection()

void Db::combineSelection ( VectorDouble sel,
const String combine = "set" 
) const

Combine 'sel' input argument with an already existing selection (if any)

Parameters
selInput selection (only 0 and 1)
combineType of combination: "set", "not", "or", "and", "xor"
Remarks
Argument 'sel' may be modified by this procedure

◆ copyByCol()

void Db::copyByCol ( int  icolIn,
int  icolOut 
)

◆ copyByUID()

void Db::copyByUID ( int  iuidIn,
int  iuidOut 
)

◆ deleteSample()

int Db::deleteSample ( int  e_del)

Deleting a sample

Parameters
e_delIndex of the sample to be deleted
Returns
0 if successfull or -1 if sample deletion is not authorized

◆ deleteSamples()

int Db::deleteSamples ( const VectorInt e_dels)

◆ duplicateColumnByUID()

void Db::duplicateColumnByUID ( int  iuid_in,
int  iuid_out 
)

◆ filter()

VectorInt Db::filter ( const String name,
const Interval interval,
int  belowRow = ITEST,
int  aboveRow = ITEST 
) const

Find the occurrence of a given range of values for a given variable

Parameters
nameName of the Target variable
intervalInterval definition
belowRowIf specified, search must be performed below this row
aboveRowIf specified, search must be performed above this row
Returns

◆ generateRank()

void Db::generateRank ( const String radix = "rank")

◆ getActiveAndDefinedNumber() [1/2]

int Db::getActiveAndDefinedNumber ( const String name) const

Returns the number of active samples for which the variable 'name' is defined

Parameters
nameName of the Target variable
Returns
Number of samples

◆ getActiveAndDefinedNumber() [2/2]

int Db::getActiveAndDefinedNumber ( int  item) const

Returns the number of active samples for which the target variable (ELoc::Z) is defined

Parameters
itemRank of the ELoc::Z variable
Returns
Number of samples

◆ getActiveArray()

VectorBool Db::getActiveArray ( ) const

◆ getActiveSampleNumber()

GSTLEARN_DEPRECATED int Db::getActiveSampleNumber ( ) const

Returns the number of active samples if a Selection is already defined.

If no Selection is currently defined, it returns the total number of samples (see getSampleNumber())

Returns
Number of active samples
Remarks
This method is deprecated and should be replaced by a call to getSampleNumber()

◆ getAllCoordinates()

VectorVectorDouble Db::getAllCoordinates ( bool  useSel = false) const

Constitute a Vector of Vector of coordinates for all (active) samples

  • the first dimension is the space dimension
  • the second dimension is the number of (active) samples
    Parameters
    useSel
    Returns

◆ getAllCoordinatesMat()

MatrixRectangular Db::getAllCoordinatesMat ( ) const

Constitute a Matrix of coordinates for all (active) samples

  • one row per sample
  • one column by Space Dimension
    Returns

◆ getAllUIDs()

VectorInt Db::getAllUIDs ( ) const

◆ getArray()

double Db::getArray ( int  iech,
int  iuid 
) const

Return the value defined by Sample and UID

Parameters
iechSample Index
iuidUID Index
Returns

◆ getArrayBySample()

VectorDouble Db::getArrayBySample ( int  iech) const

◆ getArrayByUID()

VectorDouble Db::getArrayByUID ( int  iuid,
bool  useSel = false 
) const

◆ getArrays()

const VectorDouble& Db::getArrays ( ) const
inline

◆ getArrayVec()

void Db::getArrayVec ( const VectorInt iechs,
int  iuid,
VectorDouble values 
) const

Get the values of a series of samples

Parameters
iechsList of sample indices
iuidIndex of the UID
valuesList of values to be written
Remarks
: for efficiency purpose, no check is performed on the sample ranks

◆ getCodeList()

VectorDouble Db::getCodeList ( void  ) const

Returns the list of Unique codes

Returns
Pointer to the array containing a single occurence of each code

◆ getColIdx()

int Db::getColIdx ( const String name) const

Returns the rank of the Single Column corresponding to 'name'

Parameters
nameNamed for the searched column
Returns
The rank of the Single column or -1

◆ getColIdxByLocator()

int Db::getColIdxByLocator ( const ELoc &  locatorType,
int  locatorIndex = 0 
) const

Find Column for a given Locator characteristics

Parameters
locatorTypeLocator type
locatorIndexLocator index (starting from 0)
Returns

◆ getColIdxByUID()

int Db::getColIdxByUID ( int  iuid) const

◆ getColIdxs() [1/2]

VectorInt Db::getColIdxs ( const String name) const

◆ getColIdxs() [2/2]

VectorInt Db::getColIdxs ( const VectorString names) const

◆ getColIdxsByLocator()

VectorInt Db::getColIdxsByLocator ( const ELoc &  locatorType) const

◆ getColIdxsByUID()

VectorInt Db::getColIdxsByUID ( const VectorInt iuids) const

◆ getColumnNumber()

int Db::getColumnNumber ( ) const
inline

◆ getCoordinate()

double Db::getCoordinate ( int  iech,
int  idim,
bool  flag_rotate = true 
) const
virtual

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 in DbGrid.

◆ getCoordinates()

VectorDouble Db::getCoordinates ( int  idim,
bool  useSel = false,
bool  flag_rotate = true 
) const

Returns the vector of coordinates along a given Space Dimension

Parameters
idimRank of the Space dimension
useSelUse the Data Selection
flag_rotateFlag for rotation (only for Grid)
Returns

◆ getCoordinatesPerSampleInPlace()

void Db::getCoordinatesPerSampleInPlace ( int  iech,
VectorDouble coor,
bool  flag_rotate = true 
) const
virtual

Reimplemented in DbGrid.

◆ getCosineToDirection()

double Db::getCosineToDirection ( int  iech1,
int  iech2,
const VectorDouble codir 
) const

Calculates the cosine of the angle between a reference direction and the increment between two points in the same Db

Returns
Cosine of the angle
Parameters
[in]iech1rank of the first sample
[in]iech2rank of the second sample
[in]codirDirection coefficient

◆ getDistance()

double Db::getDistance ( int  iech,
int  jech 
) const

◆ getDistance1D()

double Db::getDistance1D ( int  iech,
int  jech,
int  idim = 0,
bool  flagAbs = false 
) const

◆ getDistanceVecInPlace()

int Db::getDistanceVecInPlace ( int  iech,
int  jech,
VectorDouble dd,
const Db db2 = nullptr 
) const

Calculate the distance vector in place

Parameters
iechRank of the first sample
jechRank of the second sample (from db2 if db2 provided)
ddVector for distances (It must be dimensioned to getNDim())
db2Second Db if different from current one (or nullptr)
Returns

◆ getFaciesNumber()

int Db::getFaciesNumber ( void  ) const

Returns the Number of different facies (labelling starts at 1) The facies variable must be locatorized as ELoc::Z and be unique

◆ getFromLocator()

double Db::getFromLocator ( const ELoc &  locatorType,
int  iech,
int  locatorIndex = 0 
) const

◆ getFromLocatorNumber()

int Db::getFromLocatorNumber ( const ELoc &  locatorType) const

◆ getGradient()

VectorDouble Db::getGradient ( int  item,
bool  useSel = false 
) const

◆ getIncrements()

VectorVectorDouble Db::getIncrements ( const VectorInt iechs,
const VectorInt jechs 
) const

◆ getIntervalNumber()

int Db::getIntervalNumber ( ) const

◆ getItem() [1/6]

VectorVectorDouble Db::getItem ( const ELoc &  locatorType,
bool  useSel = false 
) const

◆ getItem() [2/6]

VectorVectorDouble Db::getItem ( const String colname,
bool  useSel = false 
) const

◆ getItem() [3/6]

VectorVectorDouble Db::getItem ( const VectorInt rows,
const ELoc &  locatorType,
bool  useSel = false 
) const

◆ getItem() [4/6]

VectorVectorDouble Db::getItem ( const VectorInt rows,
const String colname,
bool  useSel = false 
) const

◆ getItem() [5/6]

VectorVectorDouble Db::getItem ( const VectorInt rows,
const VectorString colnames,
bool  useSel = false 
) const

◆ getItem() [6/6]

VectorVectorDouble Db::getItem ( const VectorString colnames,
bool  useSel = false 
) const

◆ getItemNames() [1/3]

VectorString Db::getItemNames ( const ELoc &  locatorType) const

◆ getItemNames() [2/3]

VectorString Db::getItemNames ( const String colname) const

◆ getItemNames() [3/3]

VectorString Db::getItemNames ( const VectorString colnames) const

◆ getLastName()

String Db::getLastName ( int  number = 0) const

◆ getLastUID()

int Db::getLastUID ( int  number = 0) const

Returns the rank of (one of) the lastly added UID in the Db

Parameters
number0 designates the last, 1 the one before last...
Returns

◆ getLocator()

bool Db::getLocator ( const String name,
ELoc *  ret_locatorType,
int *  ret_locatorIndex 
) const

Return the locator information corresponding to the input variable

Parameters
nameInput variable name (unique)
ret_locatorTypeLocator Type
ret_locatorIndexLocator Index (starting from 0)
Returns

◆ getLocatorByColIdx()

bool Db::getLocatorByColIdx ( int  icol,
ELoc *  ret_locatorType,
int *  ret_locatorIndex 
) const

Find the locator characteristics of a given Column

Parameters
icolIndex of the target column
ret_locatorTypeLocator type
ret_locatorIndexLocator index (starting from 0)
Returns
true if the target variable has a locator assigned and false otherwise

◆ getLocatorByUID()

bool Db::getLocatorByUID ( int  iuid,
ELoc *  ret_locatorType,
int *  ret_locatorIndex 
) const

◆ getLocatorNumber()

int Db::getLocatorNumber ( const ELoc &  locatorType) const

◆ getLocators()

VectorString Db::getLocators ( bool  anyLocator = true,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN") 
) const

◆ getLocVariables()

VectorDouble Db::getLocVariables ( const ELoc &  loctype,
int  iech,
int  nitemax = 0 
) const

◆ getMultipleRanks()

VectorInt Db::getMultipleRanks ( const VectorVectorInt index,
const VectorInt ivars = VectorInt(),
const VectorInt nbgh = VectorInt() 
)
static

◆ getMultipleRanksActive()

VectorVectorInt Db::getMultipleRanksActive ( const VectorInt ivars = VectorInt(),
const VectorInt nbgh = VectorInt(),
bool  useSel = true,
bool  useVerr = false 
) const

Returns the list of indices 'index' for valid samples for the set of variables 'ivars' as well as the count of samples (per variable)

Parameters
ivarsVector giving the indices of the variables of interest
nbghVector giving the ranks of the elligible samples (optional)
useSelDiscard the masked samples (if True)
useVerrDiscard the samples where Verr (if it exists) is not correctly defined
Note
: if the current 'db' has some Z-variable defined, only samples where
a variable is defined is considered (search for heterotopy).

◆ getMultipleValuesActive()

VectorDouble Db::getMultipleValuesActive ( const VectorInt ivars = VectorInt(),
const VectorInt nbgh = VectorInt(),
const VectorDouble means = VectorDouble(),
bool  useSel = true,
bool  useVerr = false 
) const

Returns a one_dimensional vector of values for valid samples for the set of variables 'ivars'

Parameters
ivarsVector giving the indices of the variables of interest
nbghVector giving the ranks of the elligible samples (optional)
meansVector of Means per variable (optional)
useSelDiscard the masked samples (if True)
useVerrDiscard the samples where Verr (if it exists) is not correctly defined
Note
: if the current 'db' has some Z-variable defined, only samples where
a variable is defined is considered (search for heterotopy).
: If argumennt 'Mean' is provided, the mean is subtracted from the output vector

◆ getNDim()

int Db::getNDim ( ) const
virtual

Reimplemented in DbGrid.

◆ getNEloc()

int Db::getNEloc ( )
static

◆ getNumberActiveAndDefined()

int Db::getNumberActiveAndDefined ( int  item) const

Returns the number of samples active and whose Z-value(item) is defined

Parameters
itemRank of the Z-locator
Returns

◆ getRankAbsoluteToRelative()

int Db::getRankAbsoluteToRelative ( int  iabs) const

◆ getRankRelativeToAbsolute()

int Db::getRankRelativeToAbsolute ( int  irel) const

Return the absolute rank of a sample from its relative rank

Parameters
irelRelative rank
Returns

◆ getRanksActive()

VectorInt Db::getRanksActive ( const VectorInt nbgh = VectorInt(),
int  item = -1,
bool  useSel = true,
bool  useVerr = false 
) const

◆ getSampleAsSPInPlace()

void Db::getSampleAsSPInPlace ( int  iech,
SpacePoint P 
) const

◆ getSampleAsSTInPlace()

void Db::getSampleAsSTInPlace ( int  iech,
SpaceTarget P 
) const
virtual

Load a Space Target with all possible contents gathered from Db

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

Reimplemented in DbGrid.

◆ getSampleCoordinates()

VectorDouble Db::getSampleCoordinates ( int  iech) const

◆ getSampleCoordinatesInPlace()

void Db::getSampleCoordinatesInPlace ( int  iech,
VectorDouble coor 
) const

◆ getSampleLocators()

VectorDouble Db::getSampleLocators ( const ELoc &  locatorType,
int  iech 
) const

◆ getSampleNumber()

int Db::getSampleNumber ( bool  useSel = false) const

Returns the Number of samples

Parameters
useSelWhen FALSE returns the total sample number. When TRUE returns the number of active samples
Returns

◆ getSampleRanks()

VectorInt Db::getSampleRanks ( ) const

Returns the ranks, within the exhaustive loop on variables then samples to be used in the kriging system, knowing that we must discard the masked samples and the samples whose value is not defined

Returns

◆ getSamplesAsSP()

std::vector< SpacePoint > Db::getSamplesAsSP ( bool  useSel = false) const

◆ getSelection()

int Db::getSelection ( int  iech) const

Return the Selection value at Sample 'iech'

Parameters
iechSample number
Returns
Remarks
If the selection value if TEST, the sample is considered as masked off.

◆ getSelections()

VectorDouble Db::getSelections ( void  ) const

◆ getSortArray()

VectorInt Db::getSortArray ( ) const

Return the vector of ordered samples by increasing coordinate along X

Returns
Array containing the increasing order
Remarks
The returned array must be desallocated

◆ getTangent()

VectorDouble Db::getTangent ( int  item,
bool  useSel = false 
) const

◆ getUID()

int Db::getUID ( const String name) const

Returns the Single UID which corresponds to the searched name

Parameters
nameName to be searched for
Returns
Rank of the UID or -1

◆ getUIDByColIdx()

int Db::getUIDByColIdx ( int  icol) const

◆ getUIDByLocator()

int Db::getUIDByLocator ( const ELoc &  locatorType,
int  locatorIndex = 0 
) const

◆ getUIDMaxNumber()

int Db::getUIDMaxNumber ( ) const
inline

◆ getUIDs()

VectorInt Db::getUIDs ( const VectorString names) const

◆ getUIDsByColIdx()

VectorInt Db::getUIDsByColIdx ( const VectorInt icols) const

◆ getUIDsByLocator()

VectorInt Db::getUIDsByLocator ( const ELoc &  locatorType) const

◆ getUnit()

double Db::getUnit ( int  idim = 0) const
virtual

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 in DbGrid.

◆ getValue()

double Db::getValue ( const String name,
int  iech 
) const

Returns the value of the 'iech' sample of the variable 'name'

This function does not use 'ids' mechanism in order to allow referring to a non-existing variable

◆ getValueByColIdx()

double Db::getValueByColIdx ( int  iech,
int  icol 
) const

◆ getValuesByColIdx()

VectorDouble Db::getValuesByColIdx ( const VectorInt iechs,
const VectorInt icols,
bool  bySample = false 
) const

◆ getValuesByNames()

VectorDouble Db::getValuesByNames ( const VectorInt iechs,
const VectorString names,
bool  bySample = false 
) const

◆ getWeight()

double Db::getWeight ( int  iech) const

◆ getWeights()

VectorDouble Db::getWeights ( bool  useSel = false) const

◆ getWithinBounds()

VectorDouble Db::getWithinBounds ( int  item,
bool  useSel = false 
) const

◆ getZNumber()

int Db::getZNumber ( ) const

◆ getZVariable()

double Db::getZVariable ( int  iech,
int  item 
) const

◆ hasLargerDimension()

bool Db::hasLargerDimension ( const Db dbaux) const

Check if the Space Dimension of 'dbaux' is larger (or equal) than the one of 'this'

Parameters
dbauxSecond Db
Returns

◆ hasLocator()

bool Db::hasLocator ( const ELoc &  locatorType) const

◆ hasLocatorDefined()

bool Db::hasLocatorDefined ( const String name,
const ELoc &  locatorType,
int  locatorIndex = 0 
) const

Check if a variable (specified by its name) matches the required locator

Parameters
nameName of the target Variable
locatorTypeCharacteristics of the required Locator Type
locatorIndexIndex of the required Locator (or -1)
Returns

◆ hasSameDimension()

bool Db::hasSameDimension ( const Db dbaux) const

◆ hasZVariable()

bool Db::hasZVariable ( ) const

◆ isActive()

bool Db::isActive ( int  iech) const

◆ isActiveAndDefined()

bool Db::isActiveAndDefined ( int  iech,
int  item 
) const

◆ isActiveDomain()

bool Db::isActiveDomain ( int  iech) const

◆ isAllIsotopic()

bool Db::isAllIsotopic ( ) const

Check that all the active samples are isotopic

◆ isAllUndefined()

bool Db::isAllUndefined ( int  iech) const

◆ isAllUndefinedByType()

bool Db::isAllUndefinedByType ( const ELoc &  loctype,
int  iech 
) const

◆ isConsistent()

virtual bool Db::isConsistent ( ) const
inlinevirtual

Reimplemented in DbMeshTurbo, DbMeshStandard, DbLine, DbGrid, and DbGraphO.

◆ isGrid()

virtual bool Db::isGrid ( ) const
inlinevirtual

Interface for Db.

Reimplemented in DbGrid.

◆ isIsotopic()

bool Db::isIsotopic ( int  iech,
int  nvar_max = -1 
) const

Check if the information (ELOC.Z) for a sample is isotopic or not Isotopic says that all variables (for this sample) are defined

Parameters
iechRank of the sample
nvar_maxMaximum number of variables to be checked (or -1)
Remarks
The returned answer is false is there is no variable defined or if the sample rank is not valid. If 'nvar_max' is defined, the test is performed on the 'nvar_max' first variables. Otherwise, it is performed on all ELOC.Z variables

◆ isLine()

virtual bool Db::isLine ( ) const
inlinevirtual

Reimplemented in DbLine, and DbGraphO.

◆ isMesh()

virtual bool Db::isMesh ( ) const
inlinevirtual

Reimplemented in DbMeshTurbo, and DbMeshStandard.

◆ isUIDDefined()

bool Db::isUIDDefined ( int  iuid) const

◆ isVariableNumberComparedTo()

bool Db::isVariableNumberComparedTo ( int  nvar,
int  compare = 0 
) const

Checks the number of variables in 'this' compared to the required 'nvar'

  • compare=0: they should be equal
  • compare<0: 'this' should contain less (or equal) than 'nvar'
  • compare>0: 'this' should contain more (or equal) than 'nvar'

◆ mayChangeSampleNumber()

virtual bool Db::mayChangeSampleNumber ( ) const
inlinevirtual

Reimplemented in DbMeshTurbo, DbMeshStandard, DbLine, DbGrid, and DbGraphO.

◆ operator=()

Db & Db::operator= ( const Db r)

◆ printOneSample()

Table Db::printOneSample ( int  iech,
const VectorString names = VectorString(),
bool  excludeCoordinates = true,
bool  skipTitle = false 
) const

◆ resetDims()

void Db::resetDims ( int  ncol,
int  nech 
)
virtual

Reimplemented in DbGrid.

◆ setAllColumns()

void Db::setAllColumns ( const VectorVectorDouble tabs)

Setting the contents of all the Columns of a Db

Parameters
tabsVector of vectors containing the values to be assigned

◆ setArray()

void Db::setArray ( int  iech,
int  iuid,
double  value 
)

Set the value by Sample and UID

Parameters
iechIndex of the Sample
iuidIndex of the UID
valueValue to be assigned

◆ setArrayBySample()

void Db::setArrayBySample ( int  iech,
const VectorDouble vec 
)

◆ setArrayVec()

void Db::setArrayVec ( const VectorInt iechs,
int  iuid,
const VectorDouble values 
)

Set the values of a series of samples

Parameters
iechsList of sample indices
iuidIndex of the UID
valuesList of values to be written
Remarks
: for efficiency purpose, no check is performed on the sample ranks

◆ setBound()

void Db::setBound ( int  iech,
int  item,
double  lower = TEST,
double  upper = TEST 
)

◆ setColumn()

void Db::setColumn ( const VectorDouble tab,
const String name,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  useSel = false 
)

Set the values for an already existing Column. Note that, if the Column does not exist, this Column is added beforehand

Parameters
tabArray of values to be stored in the target Column
nameName of the Column
locatorTypeLocator type
locatorIndexLocator index (starting from 0)
useSelShould an already existing Selection be taken into account
Remarks
: Arguments 'locatorType' and 'locatorIndex' are only used
: for newly added variables

◆ setColumnByColIdx()

void Db::setColumnByColIdx ( const VectorDouble tab,
int  icol,
bool  useSel = false 
)

◆ setColumnByColIdxOldStyle()

void Db::setColumnByColIdxOldStyle ( const double *  tab,
int  icol,
bool  useSel = false 
)

◆ setColumnByUID()

void Db::setColumnByUID ( const VectorDouble tab,
int  iuid,
bool  useSel = false 
)

◆ setColumnByUIDOldStyle()

void Db::setColumnByUIDOldStyle ( const double *  tab,
int  iuid,
bool  useSel = false 
)

Update the contents of an already existing variable in a Db

Parameters
tabVector containing the values to be written
iuidUID of the already existing variable to be written
useSelWhen TRUE, take the Selection into account (seed remarks)
Remarks
When useSel=TRUE, the input vector should be dimensioned to
the number of active samples. Only the active samples of the Db
are updated using the contents of the input 'tab' vector.

◆ setColumnsByColIdx()

void Db::setColumnsByColIdx ( const VectorDouble tabs,
const VectorInt icols,
bool  useSel = false 
)

◆ setCoordinate()

void Db::setCoordinate ( int  iech,
int  idim,
double  value 
)

◆ setCoordinates()

void Db::setCoordinates ( int  idim,
const VectorDouble coor,
bool  useSel = false 
)

◆ setFromLocator()

void Db::setFromLocator ( const ELoc &  locatorType,
int  iech,
int  locatorIndex,
double  value 
)

◆ setInterval()

void Db::setInterval ( int  iech,
int  item,
double  rklow = TEST,
double  rkup = TEST 
)

◆ setItem() [1/6]

int Db::setItem ( const ELoc &  locatorType,
const VectorVectorDouble values,
bool  useSel = false 
)

◆ setItem() [2/6]

int Db::setItem ( const String colname,
const VectorDouble values,
bool  useSel = false 
)

◆ setItem() [3/6]

int Db::setItem ( const VectorInt rows,
const ELoc &  locatorType,
const VectorVectorDouble values,
bool  useSel = false 
)

◆ setItem() [4/6]

int Db::setItem ( const VectorInt rows,
const String colname,
const VectorDouble values,
bool  useSel = false 
)

◆ setItem() [5/6]

int Db::setItem ( const VectorInt rows,
const VectorString colnames,
const VectorVectorDouble values,
bool  useSel = false 
)

◆ setItem() [6/6]

int Db::setItem ( const VectorString colnames,
const VectorVectorDouble values,
bool  useSel = false 
)

◆ setLocator()

void Db::setLocator ( const String name,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

Define the Locator(s) for the given variable(s)

Parameters
nameVariable name
locatorTypeLocator Type
locatorIndexLocator Index (for the first variable) (starting from 0)
cleanSameLocatorWhen TRUE, clean variables with same locator beforehand

◆ setLocatorByColIdx()

void Db::setLocatorByColIdx ( int  icol,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

◆ setLocatorByUID()

void Db::setLocatorByUID ( int  iuid,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

Setting the locator for a variable designated by its UID

Parameters
iuidIndex of the UID
locatorTypeType of locator (include ELoc::UNKNOWN)
locatorIndexRank in the Locator (starting from 0)
cleanSameLocatorWhen TRUE, clean variables with same locator beforehand
Remarks
: At this stage, no check is performed to see if items
: are consecutive and all defined
: This allow using this function in any order.

◆ setLocators()

void Db::setLocators ( const VectorString names,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

Setting the locator for a set of variables designated by their names

Parameters
namesVector of variable names
locatorTypeLocator type (include ELoc::UNKNOWN)
locatorIndexStarting locator rank (starting from 0)
cleanSameLocatorWhen TRUE, clean variables with same locator beforehand

◆ setLocatorsByColIdx()

void Db::setLocatorsByColIdx ( const VectorInt icols,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

◆ setLocatorsByUID() [1/2]

void Db::setLocatorsByUID ( const VectorInt iuids,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

◆ setLocatorsByUID() [2/2]

void Db::setLocatorsByUID ( int  number,
int  iuid,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)

Set the Locators for a set of variables identified by their UID

Parameters
numberNumber of variables to be set
iuidIndex of the first UID
locatorTypeType of the Locator (include ELoc::UNKNOWN)
locatorIndexRank of the first Locator index (starting from 0)
cleanSameLocatorWhen TRUE, clean variables with same locator beforehand

◆ setLocVariables()

void Db::setLocVariables ( const ELoc &  loctype,
int  iech,
const VectorDouble values 
)

◆ setSampleCoordinates()

void Db::setSampleCoordinates ( int  iech,
const VectorDouble coor 
)

◆ setValue()

void Db::setValue ( const String name,
int  iech,
double  value 
)

Sets the value of the 'iech' sample of the variable 'name'

This function does not use 'ids' mechanism in order to allow referring to a non-existing variable

◆ setValueByColIdx()

void Db::setValueByColIdx ( int  iech,
int  icol,
double  value 
)

◆ setValuesByColIdx()

void Db::setValuesByColIdx ( const VectorInt iechs,
const VectorInt icols,
const VectorDouble values,
bool  bySample = false 
)

◆ setValuesByNames()

void Db::setValuesByNames ( const VectorInt iechs,
const VectorString names,
const VectorDouble values,
bool  bySample = false 
)

◆ setZVariable()

void Db::setZVariable ( int  iech,
int  item,
double  value 
)

◆ shrinkToValidCols()

VectorInt Db::shrinkToValidCols ( const VectorInt cols) const

◆ shrinkToValidRows()

VectorInt Db::shrinkToValidRows ( const VectorInt rows) const

◆ switchLocator()

void Db::switchLocator ( const ELoc &  locatorType_in,
const ELoc &  locatorType_out 
)

◆ toString()

String Db::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

ICloneable interface.

AStringable Interface

Reimplemented from AStringable.

Reimplemented in DbMeshTurbo, DbMeshStandard, DbLine, DbGrid, and DbGraphO.

◆ updArray()

void Db::updArray ( int  iech,
int  iuid,
const EOperator &  oper,
double  value 
)

◆ updArrayVec()

void Db::updArrayVec ( const VectorInt iechs,
int  iuid,
const EOperator &  oper,
VectorDouble values 
)

◆ updZVariable()

void Db::updZVariable ( int  iech,
int  item,
const EOperator &  oper,
double  value 
)

Member Data Documentation

◆ DECLARE_TOTL

Db::DECLARE_TOTL

Has a specific implementation in the Target language.


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