1.2.0
CCC
 
Db Class Reference

Class containing the Data Information. More...

#include <Db.hpp>

Inheritance diagram for Db:
AStringable ASerializable ICloneable DbGrid

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 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(), int flag_add_rank=1)
 
int resetFromCSV (const String &filename, bool verbose, const CSVformat &csvfmt, int ncol_max=-1, int nrow_max=-1, int flag_add_rank=1)
 
int resetFromBox (int nech, const VectorDouble &coormin, const VectorDouble &coormax, int ndim=2, double extend=0., int seed=321415, int flag_add_rank=1)
 
int resetFromOnePoint (const VectorDouble &tab=VectorDouble(), int flag_add_rank=1)
 
int resetSamplingDb (const Db *dbin, double proportion=0, int number=0, const VectorString &names=VectorString(), int seed=23241, bool verbose=false, int flag_add_rank=1)
 
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)
 
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
 
VectorString expandNameList (const VectorString &names) const
 
VectorString expandNameList (const String &names) const
 
VectorString identifyNames (const VectorString &names) 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
 
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< SpacePointgetSamplesAsSP (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 getSelectionRanks () 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
 
- 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(), int flag_add_rank=1)
 
static DbcreateFromCSV (const String &filename, const CSVformat &csv=CSVformat(), bool verbose=false, int ncol_max=-1, int nrow_max=-1, int flag_add_rank=1)
 
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., int flag_add_rank=1)
 
static DbcreateFromOnePoint (const VectorDouble &tab=VectorDouble(), int flag_add_rank=1)
 
static DbcreateSamplingDb (const Db *dbin, double proportion=0., int number=0, const VectorString &names=VectorString(), int seed=23241, bool verbose=false, int flag_add_rank=1)
 
static DbcreateFromDbGrid (int nech, DbGrid *dbgrid, int seed=432423, bool flag_exact=true, bool flag_repulsion=false, double range=0., double beta=0., int flag_add_rank=1)
 
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, int flag_add_rank=1)
 
- 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...
 

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.

Constructor & Destructor Documentation

Db::Db ( )
Db::Db ( const Db r)
Db::~Db ( )
virtual

Member Function Documentation

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.
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
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)

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
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)
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)
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
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
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
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
bool Db::areSame ( const String name1,
const String name2,
double  eps = EPSILON3,
bool  useSel = true,
bool  verbose = false 
)
void Db::clearLocators ( const ELoc &  locatorType)
void Db::clearSelection ( )
inline
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
Db * Db::create ( )
static
Db * 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,
int  flag_add_rank = 1 
)
static

Creating a new Db loaded with random values

Parameters
ndatNumber of samples
ndimDimension of the space
nvarNumber of variables
nfexNumber of external drift functions
ncodeNumber of codes (no code when 0)
varmaxMaximum value for the measurement error
selRatioPercentage of samples that must be masked off
heteroRatioVector of proportions of NA to be generated per variable
coorminVector of minima of the rectangle containing data (0s if not defined)
coormaxVector of maxima of the rectangle containing data (1s if not defined)
seedValue for the Random Generator seed
flag_add_rank1 if the sample rank must be generated
Returns
A pointer to the newly created Db
Remarks
The coordinates are generated uniformly within [0,1] The variance of measurement error is created only if 'varmax' is positive. Then a field is created for each variable. this field is filled with random values uniformly generated in [0, varmax] The external drift values are generated according to Normal distribution.
Db * 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.,
int  flag_add_rank = 1 
)
static
Db * Db::createFromCSV ( const String filename,
const CSVformat csv = CSVformat(),
bool  verbose = false,
int  ncol_max = -1,
int  nrow_max = -1,
int  flag_add_rank = 1 
)
static
Db * Db::createFromDbGrid ( int  nech,
DbGrid dbgrid,
int  seed = 432423,
bool  flag_exact = true,
bool  flag_repulsion = false,
double  range = 0.,
double  beta = 0.,
int  flag_add_rank = 1 
)
static

Create a new Data Base with points generated at random

Returns
Pointer for the new Db structure
Parameters
[in]nechExpected number of samples
[in]dbgridDescriptor of the Db grid parameters
[in]seedSeed for the random number generator
[in]flag_exactTrue if the number of samples must not be drawn
[in]flag_repulsionTrue if repulsion is processed
[in]rangeRepulsion range
[in]betaBending coefficient
[in]flag_add_rank1 if the Rank must be generated in the output Db
Db * Db::createFromNF ( const String neutralFilename,
bool  verbose = true 
)
static
Db * Db::createFromOnePoint ( const VectorDouble tab = VectorDouble(),
int  flag_add_rank = 1 
)
static
Db * Db::createFromSamples ( int  nech,
const ELoadBy &  order = ELoadBy::fromKey("SAMPLE"),
const VectorDouble tab = VectorDouble(),
const VectorString names = VectorString(),
const VectorString locatorNames = VectorString(),
int  flag_add_rank = 1 
)
static
Db * Db::createReduce ( const Db dbin,
const VectorString names = VectorString(),
const VectorInt ranks = VectorInt(),
bool  verbose = false 
)
static
Db * Db::createSamplingDb ( const Db dbin,
double  proportion = 0.,
int  number = 0,
const VectorString names = VectorString(),
int  seed = 23241,
bool  verbose = false,
int  flag_add_rank = 1 
)
static
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
int Db::deleteSamples ( const VectorInt e_dels)
void Db::duplicateColumnByUID ( int  iuid_in,
int  iuid_out 
)
VectorString Db::expandNameList ( const VectorString names) const
VectorString Db::expandNameList ( const String names) const
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
void Db::generateRank ( const String radix = "rank")
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
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
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())

Returns
Number of active samples
Remarks
This method is deprecated and should be replaced by a call to getSampleNumber()
VectorVectorDouble Db::getAllCoordinates ( bool  useSel = false) const

Constitute a Vector of Vector of coordinates at a given sample, for all (active) samples

  • the first dimension is the space dimension
  • the second dimension is the number of (active) samples
    Parameters
    useSel
    Returns
VectorString Db::getAllNames ( bool  excludeRankAndCoordinates = false,
bool  verbose = false 
) const
VectorInt Db::getAllUIDs ( ) const
double Db::getArray ( int  iech,
int  iuid 
) const

Return the value defined by Sample and UID

Parameters
iechSample Index
iuidUID Index
Returns
VectorDouble Db::getArrayBySample ( int  iech) const
VectorDouble Db::getArrayByUID ( int  iuid,
bool  useSel = false 
) const
const VectorDouble& Db::getArrays ( ) const
inline
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
VectorDouble Db::getCodeList ( void  )

Returns the list of Unique codes

Returns
Pointer to the array containing a single occurence of each code
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
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
int Db::getColIdxByUID ( int  iuid) const
VectorInt Db::getColIdxs ( const String name) const
VectorInt Db::getColIdxs ( const VectorString names) const
VectorInt Db::getColIdxsByLocator ( const ELoc &  locatorType) const
VectorInt Db::getColIdxsByUID ( const VectorInt  iuids) const
int Db::getColumnNumber ( ) const
inline
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.

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
void Db::getCoordinatesPerSampleInPlace ( int  iech,
VectorDouble coor,
bool  flag_rotate = true 
) const
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

Returns
Cosine of the angle
Parameters
[in]iech1rank of the first sample
[in]iech2rank of the second sample
[in]codirDirection 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

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
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 VectorInt rows,
const VectorString colnames,
bool  useSel = false 
) const
VectorVectorDouble Db::getItem ( const VectorInt rows,
const String colname,
bool  useSel = false 
) const
VectorVectorDouble Db::getItem ( const VectorInt rows,
const ELoc &  locatorType,
bool  useSel = false 
) const
VectorVectorDouble Db::getItem ( const VectorString colnames,
bool  useSel = false 
) const
VectorVectorDouble Db::getItem ( const String colname,
bool  useSel = false 
) const
VectorVectorDouble Db::getItem ( const ELoc &  locatorType,
bool  useSel = false 
) const
VectorString Db::getItemNames ( const VectorString colnames)
VectorString Db::getItemNames ( const String colname)
VectorString Db::getItemNames ( const ELoc &  locatorType)
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

Parameters
number0 designates the last, 1 the one before last...
Returns
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
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
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
VectorString Db::getName ( const String name) const
String Db::getNameByColIdx ( int  icol) const
String Db::getNameByLocator ( const ELoc &  locatorType,
int  locatorIndex = 0 
) const
String Db::getNameByUID ( int  iuid) const
VectorString Db::getNames ( const VectorString names) const
VectorString Db::getNamesByColIdx ( const VectorInt icols) const
VectorString Db::getNamesByLocator ( const ELoc &  locatorType) const
VectorString Db::getNamesByUID ( const VectorInt iuids) const
int Db::getNDim ( ) const
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

Parameters
itemRank of the Z-locator
Returns
int Db::getRankAbsoluteToRelative ( int  iabs) const
int Db::getRankRelativeToAbsolute ( int  irel) const

Return the absolute rank of a sample from its relative rank

Parameters
irelRelative rank
Returns
void Db::getSampleAsST ( int  iech,
SpaceTarget P 
) const

Load a Space Target with all possible contents gathered from Db

Parameters
iechRank of the target sample
PSpace 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

Parameters
useSelWhen FALSE returns the total sample number. When TRUE returns the number of active samples
Returns
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
std::vector< SpacePoint > Db::getSamplesAsSP ( bool  useSel = false) const
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.
VectorInt Db::getSelectionRanks ( ) const
VectorDouble Db::getSelections ( void  ) const
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
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

Parameters
nameName to be searched for
Returns
Rank of the UID or -1
int Db::getUIDByColIdx ( int  icol) const
int Db::getUIDByLocator ( const ELoc &  locatorType,
int  locatorIndex = 0 
) const
int Db::getUIDMaxNumber ( ) const
inline
VectorInt Db::getUIDs ( const VectorString names) const
VectorInt Db::getUIDsByColIdx ( const VectorInt icols) const
VectorInt Db::getUIDsByLocator ( const ELoc &  locatorType) const
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.

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'

Parameters
dbauxSecond Db
Returns
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
bool Db::hasSameDimension ( const Db dbaux) const
VectorString Db::identifyNames ( const VectorString names) const

Identify the list of names. These names are searched in the following order:

  • within the list of input variable names (possibly expanded)
  • within the names of the locators
    Parameters
    namesNames to be be identified
    Returns
    List of variable names
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
virtual bool Db::isGrid ( ) const
inlinevirtual

Interface for Db.

Reimplemented in DbGrid.

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

Parameters
iechRank of the sample
nvar_maxMaximum number of variables to be checked (or -1)
Returns
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
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'

  • 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'
virtual bool Db::mayChangeSampleNumber ( ) const
inlinevirtual

Reimplemented in DbGrid.

Db & Db::operator= ( const Db r)
void Db::resetDims ( int  ncol,
int  nech 
)
virtual

Reimplemented in DbGrid.

int Db::resetFromBox ( int  nech,
const VectorDouble coormin,
const VectorDouble coormax,
int  ndim = 2,
double  extend = 0.,
int  seed = 321415,
int  flag_add_rank = 1 
)

Create a Db generating samples randomly

Parameters
nechNumber of samples to be generated
coorminVector giving the smallest values of the coordinates
coormaxVector giving the largest values for the coordinates
ndimSpace dimension (used if 'coormin' and 'coormax' are empty)
extendExtension of the bounding box (if positive)
seedSeed for the random number generator
flag_add_rank1 if the Sample ranks must be generated
int Db::resetFromCSV ( const String filename,
bool  verbose,
const CSVformat csvfmt,
int  ncol_max = -1,
int  nrow_max = -1,
int  flag_add_rank = 1 
)

Creating a Db by reading a CSV file

Parameters
filenameName of the CSV file
verboseVerbose flag
csvfmtDescription of the CSV format
ncol_maxMaximum number of columns
nrow_maxMaximum number of rows
flag_add_rank1 if the sample rank must be generated
int Db::resetFromOnePoint ( const VectorDouble tab = VectorDouble(),
int  flag_add_rank = 1 
)

Create a Db from a single sample whose coordinates are provided in 'tab'

Parameters
tabArray containing the coordinates of the single sample
flag_add_rank1 if the Sample ranks must be generated
int Db::resetFromSamples ( int  nech,
const ELoadBy &  order = ELoadBy::fromKey("SAMPLE"),
const VectorDouble tab = VectorDouble(),
const VectorString names = VectorString(),
const VectorString locatorNames = VectorString(),
int  flag_add_rank = 1 
)
int Db::resetReduce ( const Db dbin,
const VectorString names = VectorString(),
const VectorInt ranks = VectorInt(),
bool  verbose = false 
)
int Db::resetSamplingDb ( const Db dbin,
double  proportion = 0,
int  number = 0,
const VectorString names = VectorString(),
int  seed = 23241,
bool  verbose = false,
int  flag_add_rank = 1 
)

Sampling an input Db to create the output Db by selecting a subset of samples

Parameters
dbinPointer to the input Db
proportionProportion of samples to be retained
numberNumber of samples to be retained
namesVector of Names to be copied (empty: all names)
seedSeed used for the random number generator
verboseVerbose flag
flag_add_rank1 if the sample rank must be generated
Remarks
A possible selection in 'dbin' will not be taken into account
You can use either 'proportion' or 'number'
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
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
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

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
void Db::setBound ( int  iech,
int  item,
double  lower = TEST,
double  upper = TEST 
)
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
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

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.
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 
)
void Db::setInterval ( int  iech,
int  item,
double  rklow = TEST,
double  rkup = TEST 
)
int Db::setItem ( const VectorInt rows,
const VectorString colnames,
const VectorVectorDouble values,
bool  useSel = false 
)
int Db::setItem ( const VectorInt rows,
const ELoc &  locatorType,
const VectorVectorDouble values,
bool  useSel = false 
)
int Db::setItem ( const VectorString colnames,
const VectorVectorDouble values,
bool  useSel = false 
)
int Db::setItem ( 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 String colname,
const VectorDouble 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)

Parameters
nameVariable name
locatorTypeLocator Type
locatorIndexLocator Index (for the first variable) (starting from 0)
cleanSameLocatorWhen 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

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.
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 if variable names
locatorTypeLocator type (include ELoc::UNKNOWN)
locatorIndexStarting locator rank (starting from 0)
cleanSameLocatorWhen 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 ( 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
void Db::setLocatorsByUID ( const VectorInt iuids,
const ELoc &  locatorType = ELoc::fromKey("UNKNOWN"),
int  locatorIndex = 0,
bool  cleanSameLocator = false 
)
void Db::setName ( const String old_name,
const String name 
)
void Db::setName ( const VectorString  list,
const String name 
)
void Db::setNameByColIdx ( int  icol,
const String name 
)
void Db::setNameByLocator ( const ELoc &  locatorType,
const String name 
)
void Db::setNameByUID ( int  iuid,
const String name 
)
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 
)
VectorInt Db::shrinkToValidCols ( const VectorInt cols)
VectorInt Db::shrinkToValidRows ( const VectorInt rows)
void Db::switchLocator ( const ELoc &  locatorTypein,
const ELoc &  locatorTypeout 
)
String Db::toString ( const AStringFormat strfmt = nullptr) const
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 
)

Member Data Documentation

Db::DECLARE_TOTL

Has a specific implementation in the Target language.


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