Class containing the Data Information. More...
#include <Db.hpp>
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:
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:
Each variable (or column) can be designated:
Public Member Functions | |
Db () | |
Db (const Db &r) | |
Db & | operator= (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 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) |
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 VectorDouble & | getArrays () 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 | getNEloc () 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 &locatorTypein, const ELoc &locatorTypeout) |
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) |
VectorString | getItemNames (const String &colname) |
VectorString | getItemNames (const ELoc &locatorType) |
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 |
int | getFaciesNumber (void) const |
bool | hasLocatorDefined (const String &name, const ELoc &locatorType, int locatorIndex=0) const |
VectorDouble | getSampleCoordinates (int iech) const |
void | getSampleCoordinatesAsSPInPlace (int iech, SpacePoint &P) const |
void | getSampleAsST (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) |
double | getDistance1D (int iech, int jech, int idim=0, bool flagAbs=false) const |
double | getDistance (int iech, int jech) const |
int | getDistanceVec (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< SpacePoint > | getSamplesAsSP (bool useSel=false) 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) |
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) |
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, const VectorInt &nbgh, bool useSel=true, bool useVerr=false) const |
double | getWeight (int iech) const |
VectorDouble | getWeights (bool useSel=false) const |
int | getSimRank (int isimu, int ivar, int icase, int nbsimu, int nvar) 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 |
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 | getColumnsByColIdxInterval (int icol_beg, int icol_end, bool useSel=false, bool flagCompress=true) const |
VectorDouble | getColumnsByLocator (const ELoc &locatorType, bool useSel=false, bool flagCompress=true) const |
VectorDouble | getColumnsByUID (const VectorInt &iuids, bool useSel=false, bool flagCompress=true) const |
VectorDouble | getColumnsByUIDRange (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) |
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 useSel=false) |
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) |
VectorInt | shrinkToValidCols (const VectorInt &cols) |
void | statisticsBySample (const VectorString &names, const std::vector< EStatOption > &opers=EStatOption::fromKeys({ "MEAN" }), bool flagIso=true, double vmin=TEST, double vmax=TEST, double proba=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) |
VectorInt | filter (const String &name, const Interval &interval, int belowRow=ITEST, int aboveRow=ITEST) const |
VectorInt | getSampleRanks () const |
![]() | |
AStringable () | |
AStringable (const AStringable &r) | |
AStringable & | operator= (const AStringable &r) |
virtual | ~AStringable () |
virtual void | display (const AStringFormat *strfmt=nullptr) const final |
virtual void | display (int level) const final |
![]() | |
ASerializable () | |
ASerializable (const ASerializable &r) | |
ASerializable & | operator= (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 |
![]() | |
ICloneable () | |
virtual | ~ICloneable () |
virtual ICloneable * | clone () const =0 |
Static Public Member Functions | |
static Db * | create () |
static Db * | createFromNF (const String &neutralFilename, bool verbose=true) |
static Db * | createFromSamples (int nech, const ELoadBy &order=ELoadBy::fromKey("SAMPLE"), const VectorDouble &tab=VectorDouble(), const VectorString &names=VectorString(), const VectorString &locatorNames=VectorString(), bool flagAddSampleRank=true) |
static Db * | createFromCSV (const String &filename, const CSVformat &csv=CSVformat(), bool verbose=false, int ncol_max=-1, int nrow_max=-1, bool flagAddSampleRank=true) |
static Db * | createFromBox (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 Db * | createFromOnePoint (const VectorDouble &tab=VectorDouble(), bool flagAddSampleRank=true) |
static Db * | createSamplingDb (const Db *dbin, double proportion=0., int number=0, const VectorString &names=VectorString(), int seed=23241, bool verbose=false, bool flagAddSampleRank=true) |
static Db * | createFromDbGrid (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 Db * | createReduce (const Db *dbin, const VectorString &names=VectorString(), const VectorInt &ranks=VectorInt(), bool verbose=false) |
static Db * | createFillRandom (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 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 String & | getContainerName () |
static const String & | getPrefixName () |
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... | |
Db::Db | ( | ) |
Db::Db | ( | const Db & | r | ) |
|
virtual |
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'.
tab | Array to be loaded |
radix | Generic name for the newly created variables |
locatorType | Generic locator assigned to new variables |
locatorIndex | Locator index (starting from 0) |
useSel | true if the Selection must be taken into account |
valinit | initial value (for unselected samples) |
nvar | Number of variables loaded |
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
nadd | Number of variables to be added |
valinit | Value to be used for variable initialization |
radix | Generic radix given to the newly created variables |
locatorType | Generic locator assigned to new variables |
locatorIndex | Locator index (starting from 0) |
nechInit | Number of samples (used only if the Db is initially empty) |
void Db::addColumnsByVVD | ( | const VectorVectorDouble | tab, |
const String & | radix, | ||
const ELoc & | locatorType, | ||
int | locatorIndex = 0 , |
||
bool | useSel = false |
||
) |
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)
nadd | Number of variables to be added |
radix | Generic radix given to the newly created variables |
locatorType | Generic locator assigned to new variables |
locatorIndex | Locator index (starting from 0) |
seed | Seed value |
nechInit | Number of samples (used only if the Db is initially empty) |
int Db::addSamples | ( | int | nadd, |
double | valinit = TEST |
||
) |
Add samples to the Data Base
nadd | Number of samples to be added |
valinit | Default value given to the added samples |
int Db::addSelection | ( | const VectorDouble & | tab = VectorDouble() , |
const String & | name = "NewSel" , |
||
const String & | combine = "set" |
||
) |
Add the contents of the 'tab' as a Selection
tab | Input array |
name | Name given to the newly created Selection variable |
combine | How to combine with an already existing selection (see combineSelection() for details) |
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
testvar | Name of the target variable |
limits | Limits defining the Definition Domain to be tested (optional) |
name | Name of the newly created selection |
combine | How to combine with an already existing selection (see combineSelection() for details) |
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)
ranks | Vector of ranks of active samples |
name | Name given to the newly created Selection variable |
combine | How to combine with an already existing selection (see combineSelection() for details) |
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'
db | Data Base providing the (active) samples |
dilate | The convex hull can be dilated: this gives the radius |
verbose | Verbose option |
namconv | Naming Convention |
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
prop | Proportion of active samples (between 0 and 1) |
seed | Seed for the random number generator |
name | Name of the newly created selection |
combine | How to combine with an already existing selection (see combineSelection() for details) |
bool Db::areSame | ( | const String & | name1, |
const String & | name2, | ||
double | eps = EPSILON3 , |
||
bool | useSel = true , |
||
bool | verbose = false |
||
) |
void Db::clearLocators | ( | const ELoc & | locatorType | ) |
|
inline |
void Db::combineSelection | ( | VectorDouble & | sel, |
const String & | combine = "set" |
||
) | const |
Combine 'sel' input argument with an already existing selection (if any)
sel | Input selection (only 0 and 1) |
combine | Type of combination: "set", "not", "or", "and", "xor" |
int Db::deleteSample | ( | int | e_del | ) |
Deleting a sample
e_del | Index of the sample to be deleted |
int Db::deleteSamples | ( | const VectorInt & | e_dels | ) |
void Db::duplicateColumnByUID | ( | int | iuid_in, |
int | iuid_out | ||
) |
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
name | Name of the Target variable |
interval | Interval definition |
belowRow | If specified, search must be performed below this row |
aboveRow | If specified, search must be performed above this row |
void Db::generateRank | ( | const String & | radix = "rank" | ) |
int Db::getActiveAndDefinedNumber | ( | const String & | name | ) | const |
Returns the number of active samples for which the variable 'name' is defined
name | Name of the Target variable |
int Db::getActiveAndDefinedNumber | ( | int | item | ) | const |
Returns the number of active samples for which the target variable (ELoc::Z) is defined
item | Rank of the ELoc::Z variable |
VectorBool Db::getActiveArray | ( | ) | const |
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())
VectorVectorDouble Db::getAllCoordinates | ( | bool | useSel = false | ) | const |
Constitute a Vector of Vector of coordinates for all (active) samples
useSel |
MatrixRectangular Db::getAllCoordinatesMat | ( | ) | const |
Constitute a Matrix of coordinates for all (active) samples
VectorInt Db::getAllUIDs | ( | ) | const |
double Db::getArray | ( | int | iech, |
int | iuid | ||
) | const |
Return the value defined by Sample and UID
iech | Sample Index |
iuid | UID Index |
VectorDouble Db::getArrayBySample | ( | int | iech | ) | const |
VectorDouble Db::getArrayByUID | ( | int | iuid, |
bool | useSel = false |
||
) | const |
|
inline |
void Db::getArrayVec | ( | const VectorInt & | iechs, |
int | iuid, | ||
VectorDouble & | values | ||
) | const |
Get the values of a series of samples
iechs | List of sample indices |
iuid | Index of the UID |
values | List of values to be written |
VectorDouble Db::getCodeList | ( | void | ) |
Returns the list of Unique codes
int Db::getColIdx | ( | const String & | name | ) | const |
Returns the rank of the Single Column corresponding to 'name'
name | Named for the searched column |
int Db::getColIdxByLocator | ( | const ELoc & | locatorType, |
int | locatorIndex = 0 |
||
) | const |
Find Column for a given Locator characteristics
locatorType | Locator type |
locatorIndex | Locator index (starting from 0) |
int Db::getColIdxByUID | ( | int | iuid | ) | const |
VectorInt Db::getColIdxs | ( | const VectorString & | names | ) | const |
VectorInt Db::getColIdxsByLocator | ( | const ELoc & | locatorType | ) | const |
|
inline |
|
virtual |
VectorDouble Db::getCoordinates | ( | int | idim, |
bool | useSel = false , |
||
bool | flag_rotate = true |
||
) | const |
Returns the vector of coordinates along a given Space Dimension
idim | Rank of the Space dimension |
useSel | Use the Data Selection |
flag_rotate | Flag for rotation (only for Grid) |
|
virtual |
Reimplemented in DbGrid.
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
[in] | iech1 | rank of the first sample |
[in] | iech2 | rank of the second sample |
[in] | codir | Direction coefficient |
double Db::getDistance | ( | int | iech, |
int | jech | ||
) | const |
double Db::getDistance1D | ( | int | iech, |
int | jech, | ||
int | idim = 0 , |
||
bool | flagAbs = false |
||
) | const |
int Db::getDistanceVec | ( | int | iech, |
int | jech, | ||
VectorDouble & | dd, | ||
const Db * | db2 = nullptr |
||
) | const |
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
double Db::getFromLocator | ( | const ELoc & | locatorType, |
int | iech, | ||
int | locatorIndex = 0 |
||
) | const |
int Db::getFromLocatorNumber | ( | const ELoc & | locatorType | ) | const |
VectorDouble Db::getGradient | ( | int | item, |
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getIncrements | ( | const VectorInt & | iechs, |
const VectorInt & | jechs | ||
) | const |
int Db::getIntervalNumber | ( | ) | const |
VectorVectorDouble Db::getItem | ( | const ELoc & | locatorType, |
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getItem | ( | const String & | colname, |
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getItem | ( | const VectorInt & | rows, |
const ELoc & | locatorType, | ||
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getItem | ( | const VectorInt & | rows, |
const String & | colname, | ||
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getItem | ( | const VectorInt & | rows, |
const VectorString & | colnames, | ||
bool | useSel = false |
||
) | const |
VectorVectorDouble Db::getItem | ( | const VectorString & | colnames, |
bool | useSel = false |
||
) | const |
VectorString Db::getItemNames | ( | const ELoc & | locatorType | ) |
VectorString Db::getItemNames | ( | const String & | colname | ) |
VectorString Db::getItemNames | ( | const VectorString & | colnames | ) |
String Db::getLastName | ( | int | number = 0 | ) | const |
int Db::getLastUID | ( | int | number = 0 | ) | const |
Returns the rank of (one of) the lastly added UID in the Db
number | 0 designates the last, 1 the one before last... |
bool Db::getLocator | ( | const String & | name, |
ELoc * | ret_locatorType, | ||
int * | ret_locatorIndex | ||
) | const |
Return the locator information corresponding to the input variable
name | Input variable name (unique) |
ret_locatorType | Locator Type |
ret_locatorIndex | Locator Index (starting from 0) |
bool Db::getLocatorByColIdx | ( | int | icol, |
ELoc * | ret_locatorType, | ||
int * | ret_locatorIndex | ||
) | const |
Find the locator characteristics of a given Column
icol | Index of the target column |
ret_locatorType | Locator type |
ret_locatorIndex | Locator index (starting from 0) |
bool Db::getLocatorByUID | ( | int | iuid, |
ELoc * | ret_locatorType, | ||
int * | ret_locatorIndex | ||
) | const |
int Db::getLocatorNumber | ( | const ELoc & | locatorType | ) | const |
VectorString Db::getLocators | ( | bool | anyLocator = true , |
const ELoc & | locatorType = ELoc::fromKey("UNKNOWN") |
||
) | const |
VectorVectorInt Db::getMultipleRanksActive | ( | const VectorInt & | ivars, |
const VectorInt & | nbgh, | ||
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)
ivars | Vector giving the indices of the variables of interest |
nbgh | Vector giving the ranks of the elligible samples (optional) |
useSel | Discard the masked samples (if True) |
useVerr | Discard the samples where Verr (if it exists) is not correctly defined |
|
virtual |
Reimplemented in DbGrid.
int Db::getNEloc | ( | ) | const |
int Db::getNumberActiveAndDefined | ( | int | item | ) | const |
Returns the number of samples active and whose Z-value(item) is defined
item | Rank of the Z-locator |
int Db::getRankAbsoluteToRelative | ( | int | iabs | ) | const |
int Db::getRankRelativeToAbsolute | ( | int | irel | ) | const |
Return the absolute rank of a sample from its relative rank
irel | Relative rank |
VectorInt Db::getRanksActive | ( | const VectorInt & | nbgh = VectorInt() , |
int | item = -1 , |
||
bool | useSel = true , |
||
bool | useVerr = false |
||
) | const |
void Db::getSampleAsST | ( | int | iech, |
SpaceTarget & | P | ||
) | const |
Load a Space Target with all possible contents gathered from Db
iech | Rank of the target sample |
P | Space Target (used to store information) |
VectorDouble Db::getSampleCoordinates | ( | int | iech | ) | const |
void Db::getSampleCoordinatesAsSPInPlace | ( | int | iech, |
SpacePoint & | P | ||
) | const |
void Db::getSampleCoordinatesInPlace | ( | int | iech, |
VectorDouble & | coor | ||
) | const |
VectorDouble Db::getSampleLocators | ( | const ELoc & | locatorType, |
int | iech | ||
) | const |
int Db::getSampleNumber | ( | bool | useSel = false | ) | const |
Returns the Number of samples
useSel | When FALSE returns the total sample number. When TRUE returns the number of active samples |
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
std::vector< SpacePoint > Db::getSamplesAsSP | ( | bool | useSel = false | ) | const |
int Db::getSelection | ( | int | iech | ) | const |
Return the Selection value at Sample 'iech'
iech | Sample number |
VectorDouble Db::getSelections | ( | void | ) | const |
VectorInt Db::getSortArray | ( | ) | const |
Return the vector of ordered samples by increasing coordinate along X
VectorDouble Db::getTangent | ( | int | item, |
bool | useSel = false |
||
) | const |
int Db::getUID | ( | const String & | name | ) | const |
Returns the Single UID which corresponds to the searched name
name | Name to be searched for |
int Db::getUIDByColIdx | ( | int | icol | ) | const |
int Db::getUIDByLocator | ( | const ELoc & | locatorType, |
int | locatorIndex = 0 |
||
) | const |
|
inline |
VectorInt Db::getUIDs | ( | const VectorString & | names | ) | const |
VectorInt Db::getUIDsByLocator | ( | const ELoc & | locatorType | ) | const |
|
virtual |
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
double Db::getValueByColIdx | ( | int | iech, |
int | icol | ||
) | const |
VectorDouble Db::getValuesByColIdx | ( | const VectorInt & | iechs, |
const VectorInt & | icols, | ||
bool | bySample = false |
||
) | const |
VectorDouble Db::getValuesByNames | ( | const VectorInt & | iechs, |
const VectorString & | names, | ||
bool | bySample = false |
||
) | const |
double Db::getWeight | ( | int | iech | ) | const |
VectorDouble Db::getWeights | ( | bool | useSel = false | ) | const |
VectorDouble Db::getWithinBounds | ( | int | item, |
bool | useSel = false |
||
) | const |
bool Db::hasLargerDimension | ( | const Db * | dbaux | ) | const |
Check if the Space Dimension of 'dbaux' is larger (or equal) than the one of 'this'
dbaux | Second Db |
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
name | Name of the target Variable |
locatorType | Characteristics of the required Locator Type |
locatorIndex | Index of the required Locator (or -1) |
bool Db::hasSameDimension | ( | const Db * | dbaux | ) | const |
bool Db::isActive | ( | int | iech | ) | const |
bool Db::isActiveAndDefined | ( | int | iech, |
int | item | ||
) | const |
bool Db::isActiveDomain | ( | int | iech | ) | const |
bool Db::isAllIsotopic | ( | ) | const |
Check that all the active samples are isotopic
bool Db::isAllUndefined | ( | int | iech | ) | const |
bool Db::isAllUndefinedByType | ( | const ELoc & | loctype, |
int | iech | ||
) | const |
bool Db::isIsotopic | ( | int | iech, |
int | nvar_max = -1 |
||
) | const |
Check if the information (ELOC.Z) for a sample is isotopic or not Isotopic means that all variables (for this sample) are defined
iech | Rank of the sample |
nvar_max | Maximum number of variables to be checked (or -1) |
bool Db::isUIDDefined | ( | int | iuid | ) | const |
bool Db::isVariableNumberComparedTo | ( | int | nvar, |
int | compare = 0 |
||
) | const |
Checks the number of variables in 'this' compared to the required 'nvar'
|
inlinevirtual |
Reimplemented in DbGrid.
|
virtual |
Reimplemented in DbGrid.
void Db::setAllColumns | ( | const VectorVectorDouble & | tabs | ) |
Setting the contents of all the Columns of a Db
tabs | Vector of vectors containing the values to be assigned |
void Db::setArray | ( | int | iech, |
int | iuid, | ||
double | value | ||
) |
Set the value by Sample and UID
iech | Index of the Sample |
iuid | Index of the UID |
value | Value to be assigned |
void Db::setArrayBySample | ( | int | iech, |
const VectorDouble & | vec | ||
) |
void Db::setArrayVec | ( | const VectorInt & | iechs, |
int | iuid, | ||
const VectorDouble & | values | ||
) |
Set the values of a series of samples
iechs | List of sample indices |
iuid | Index of the UID |
values | List of values to be written |
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
tab | Array of values to be stored in the target Column |
name | Name of the Column |
locatorType | Locator type |
locatorIndex | Locator index (starting from 0) |
useSel | Should an already existing Selection be taken into account |
void Db::setColumnByColIdx | ( | const VectorDouble & | tab, |
int | icol, | ||
bool | useSel = false |
||
) |
void Db::setColumnByColIdxOldStyle | ( | const double * | tab, |
int | icol, | ||
bool | useSel = false |
||
) |
void Db::setColumnByUID | ( | const VectorDouble & | tab, |
int | iuid, | ||
bool | useSel = false |
||
) |
void Db::setColumnByUIDOldStyle | ( | const double * | tab, |
int | iuid, | ||
bool | useSel = false |
||
) |
Update the contents of an already existing variable in a Db
tab | Vector containing the values to be written |
iuid | UID of the already existing variable to be written |
useSel | When TRUE, take the Selection into account (seed remarks) |
void Db::setColumnsByColIdx | ( | const VectorDouble & | tabs, |
const VectorInt & | icols, | ||
bool | useSel = false |
||
) |
void Db::setCoordinate | ( | int | iech, |
int | idim, | ||
double | value | ||
) |
void Db::setFromLocator | ( | const ELoc & | locatorType, |
int | iech, | ||
int | locatorIndex, | ||
double | value | ||
) |
int Db::setItem | ( | const ELoc & | locatorType, |
const VectorVectorDouble & | values, | ||
bool | useSel = false |
||
) |
int Db::setItem | ( | const String & | colname, |
const VectorDouble & | values, | ||
bool | useSel = false |
||
) |
int Db::setItem | ( | const VectorInt & | rows, |
const ELoc & | locatorType, | ||
const VectorVectorDouble & | values, | ||
bool | useSel = false |
||
) |
int Db::setItem | ( | const VectorInt & | rows, |
const String & | colname, | ||
const VectorDouble & | values, | ||
bool | useSel = false |
||
) |
int Db::setItem | ( | const VectorInt & | rows, |
const VectorString & | colnames, | ||
const VectorVectorDouble & | values, | ||
bool | useSel = false |
||
) |
int Db::setItem | ( | const VectorString & | colnames, |
const VectorVectorDouble & | values, | ||
bool | useSel = false |
||
) |
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)
name | Variable name |
locatorType | Locator Type |
locatorIndex | Locator Index (for the first variable) (starting from 0) |
cleanSameLocator | When TRUE, clean variables with same locator beforehand |
void Db::setLocatorByColIdx | ( | int | icol, |
const ELoc & | locatorType = ELoc::fromKey("UNKNOWN") , |
||
int | locatorIndex = 0 , |
||
bool | cleanSameLocator = false |
||
) |
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
iuid | Index of the UID |
locatorType | Type of locator (include ELoc::UNKNOWN) |
locatorIndex | Rank in the Locator (starting from 0) |
cleanSameLocator | When TRUE, clean variables with same locator beforehand |
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
names | Vector if variable names |
locatorType | Locator type (include ELoc::UNKNOWN) |
locatorIndex | Starting locator rank (starting from 0) |
cleanSameLocator | When TRUE, clean variables with same locator beforehand |
void Db::setLocatorsByColIdx | ( | const VectorInt & | icols, |
const ELoc & | locatorType = ELoc::fromKey("UNKNOWN") , |
||
int | locatorIndex = 0 , |
||
bool | cleanSameLocator = false |
||
) |
void Db::setLocatorsByUID | ( | const VectorInt & | iuids, |
const ELoc & | locatorType = ELoc::fromKey("UNKNOWN") , |
||
int | locatorIndex = 0 , |
||
bool | cleanSameLocator = false |
||
) |
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
number | Number of variables to be set |
iuid | Index of the first UID |
locatorType | Type of the Locator (include ELoc::UNKNOWN) |
locatorIndex | Rank of the first Locator index (starting from 0) |
cleanSameLocator | When TRUE, clean variables with same locator beforehand |
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
void Db::setValueByColIdx | ( | int | iech, |
int | icol, | ||
double | value | ||
) |
void Db::setValuesByColIdx | ( | const VectorInt & | iechs, |
const VectorInt & | icols, | ||
const VectorDouble & | values, | ||
bool | bySample = false |
||
) |
void Db::setValuesByNames | ( | const VectorInt & | iechs, |
const VectorString & | names, | ||
const VectorDouble & | values, | ||
bool | bySample = false |
||
) |
void Db::switchLocator | ( | const ELoc & | locatorTypein, |
const ELoc & | locatorTypeout | ||
) |
|
overridevirtual |
ICloneable interface.
AStringable Interface
Reimplemented from AStringable.
Reimplemented in DbGrid.
void Db::updArray | ( | int | iech, |
int | iuid, | ||
const EOperator & | oper, | ||
double | value | ||
) |
void Db::updArrayVec | ( | const VectorInt & | iechs, |
int | iuid, | ||
const EOperator & | oper, | ||
VectorDouble & | values | ||
) |
Db::DECLARE_TOTL |
Has a specific implementation in the Target language.