gstlearn  1.0.0
CCC
ANoStat Class Referenceabstract

NoStat is defined as a series of codes. Each code follows the following syntax with three parts: More...

#include <ANoStat.hpp>

Inheritance diagram for ANoStat:
AStringable ICloneable NoStatArray NoStatFunctional

Public Member Functions

 ANoStat ()
 
 ANoStat (const VectorString &codes)
 
 ANoStat (const ANoStat &m)
 
ANoStatoperator= (const ANoStat &m)
 
virtual ~ANoStat ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 
bool isNotEmpty () const
 
bool isDefinedByCov (int icov=-1, int igrf=-1) const
 
bool isDefinedByType (const EConsElem &type, int igrf=-1) const
 
bool isDefinedByCovType (const EConsElem &type, int icov=-1, int igrf=-1) const
 
bool isDefined (const EConsElem &type, int icov=0, int iv1=-1, int iv2=-1, int igrf=-1) const
 
bool isDefinedforAnisotropy (int icov=-1, int igrf=-1) const
 
bool isDefinedforRotation (int icov=-1, int igrf=-1) const
 
virtual double getValue (const EConsElem &type, int icas, int rank, int icov=0, int iv1=-1, int iv2=-1, int igrf=-1) const =0
 
virtual double getValueByParam (int ipar, int icas, int rank) const =0
 
virtual int attachToMesh (const AMesh *mesh, bool verbose=false) const
 
virtual void detachFromMesh () const
 
virtual int attachToDb (Db *db, int icas, bool verbose=false) const
 
virtual void detachFromDb (Db *db, int icas) const
 
int addNoStatElem (int igrf, int icov, const EConsElem &type, int iv1, int iv2)
 
int addNoStatElemByItem (const CovParamId &item)
 
int addNoStatElems (const VectorString &codes)
 
void deleteNoStatElem (int ipar)
 
void deleteAllNoStatElem ()
 
int getRank (const EConsElem &type, int icov, int iv1=-1, int iv2=-1, int igrf=-1) const
 
int getIGrf (int ipar) const
 
int getICov (int ipar) const
 
const EConsElem & getType (int ipar) const
 
int getIV1 (int ipar) const
 
int getIV2 (int ipar) const
 
int getNoStatElemNumber () const
 
const std::vector< CovParamId > & getNoStats () const
 
const CovParamId getNoStat (int ipar) const
 
int attachModel (const Model *model)
 
bool matchIGrf (int ipar, int igrf0) const
 
bool matchICov (int ipar, int icov0) const
 
bool matchType (int ipar, const EConsElem &type0) const
 
bool matchIV1 (int ipar, int iv10) const
 
bool matchIV2 (int ipar, int iv20) const
 
const std::vector< CovParamId > & getAllItems () const
 
const CovParamId getItems (int ipar) const
 
void updateModel (Model *model, int icas1, int iech1, int icas2, int iech2) const
 
void updateModelByMesh (Model *model, int imesh) 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 ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Protected Member Functions

void _setAmesh (const AMesh *amesh) const
 
void _setDbin (const Db *dbin) const
 
void _setDbout (const Db *dbout) const
 
bool _isValid (int icas, int rank) const
 

Protected Attributes

const AMesh_amesh
 
const Db_dbin
 
const Db_dbout
 

Private Member Functions

int _understandCode (const String &code, int *igrf, int *icov, EConsElem *type, int *iv1, int *iv2)
 
void _updateFromModel (const Model *model)
 
bool _getInfoFromDb (int ipar, int icas1, int iech1, int icas2, int iech2, double *val1, double *val2) const
 
bool _checkConsistency () const
 

Private Attributes

std::vector< CovParamId_items
 

Detailed Description

NoStat is defined as a series of codes. Each code follows the following syntax with three parts:

G<igrf>M<icov>R<idir>

Example:

G1M0R2: Range in the third direction, for the first covariance of the second GRF
M1A: First anisotropy direction angle, for the second covariance of the first GRF

Notes:

  • All numbering is 0-based
  • First two parts can be omitted: we consider G0 and M0
  • The keyword for the last part is chosen among:
          R : Range
          A : Angle
          P : Third parameter
          V : Sill
          S : Scale
          T : Tapering range
          C : Velocity (advection)
          I : Rotation angle for Sphere
          H : Anisotropy matrix terms
    

Constructor & Destructor Documentation

◆ ANoStat() [1/3]

ANoStat::ANoStat ( )

◆ ANoStat() [2/3]

ANoStat::ANoStat ( const VectorString codes)

◆ ANoStat() [3/3]

ANoStat::ANoStat ( const ANoStat m)

◆ ~ANoStat()

ANoStat::~ANoStat ( )
virtual

Member Function Documentation

◆ _checkConsistency()

bool ANoStat::_checkConsistency ( ) const
private

This function is meant to check the consistency of the different non-stationary parameters, i.e:

  • HH is incompatible with (angle / range/ scale)
    Returns

◆ _getInfoFromDb()

bool ANoStat::_getInfoFromDb ( int  ipar,
int  icas1,
int  iech1,
int  icas2,
int  iech2,
double *  val1,
double *  val2 
) const
private

Get the information from the storage in Dbin and/or Dbout

Parameters
iparRank of the non-stationary parameter
icas1Type of first Db: 1 for Input; 2 for Output
iech1Rank of the first sample (in Dbin)
icas2Type of first Db: 1 for Input; 2 for Output
iech2Rank of the second sample (in Dbout)
val1Returned value at first sample
val2Returned value at the second sample
Returns
true if the two values are different

◆ _isValid()

bool ANoStat::_isValid ( int  icas,
int  rank 
) const
protected

This (temporary) function checks the validity between arguments 'icas' and 'rank'

Parameters
icasSource definition: 0 : from Meshing (rank: absolute rank to be converted into relative) 1 : from Dbin 2 : from Dbout
rankRank of the target
Returns

◆ _setAmesh()

void ANoStat::_setAmesh ( const AMesh amesh) const
inlineprotected

◆ _setDbin()

void ANoStat::_setDbin ( const Db dbin) const
inlineprotected

◆ _setDbout()

void ANoStat::_setDbout ( const Db dbout) const
inlineprotected

◆ _understandCode()

int ANoStat::_understandCode ( const String code,
int *  igrf,
int *  icov,
EConsElem *  type,
int *  iv1,
int *  iv2 
)
private

Decoding a NoStat Element code which should follow the following syntax

Parameters
codeInput code
igrfRank of the GRF
icovRank of the Covariance
typeType of parameter ("R","A","P","V","S","T","C","I","H") G : Rank of the GRF M : Rank of the Structure R : Range A : Angle P : Third parameter V : Sill S : Scale T : Tapering range C : Velocity (advection) I : Rotation angle for Sphere H : Anisotropy matrix terms
iv1Rank of the first variable
iv2Rank of the second variable
Returns
0 if a valid constraint has been defined; 1 otherwise

◆ _updateFromModel()

void ANoStat::_updateFromModel ( const Model model)
private

The Model may contain some non-stationary parameters already initialized that the current structure is not aware of. They are simply duplicated here This temporary patch is applied in the following conditions: 1) the number of stationary elements in current structure is 0 2) the number of stationary elements in Model is positive

Parameters
modelInput Model

◆ addNoStatElem()

int ANoStat::addNoStatElem ( int  igrf,
int  icov,
const EConsElem &  type,
int  iv1,
int  iv2 
)

Add an element to the pile of Non-stationary parameters

Parameters
igrfRank of the Target GRF
icovRank of the target covariance
typeType of the non-stationary parameter
iv1Rank of the first designation
iv2Rank of the second designation

◆ addNoStatElemByItem()

int ANoStat::addNoStatElemByItem ( const CovParamId item)

◆ addNoStatElems()

int ANoStat::addNoStatElems ( const VectorString codes)

◆ attachModel()

int ANoStat::attachModel ( const Model model)

This function tries to attach the current Non-Stationary environment to the model, checking that references to Covariance ranks are valid

Parameters
modelModel structure
Returns
Error return code

◆ attachToDb()

int ANoStat::attachToDb ( Db db,
int  icas,
bool  verbose = false 
) const
virtual

Reimplemented in NoStatFunctional, and NoStatArray.

◆ attachToMesh()

int ANoStat::attachToMesh ( const AMesh mesh,
bool  verbose = false 
) const
virtual

Reimplemented in NoStatFunctional, and NoStatArray.

◆ deleteAllNoStatElem()

void ANoStat::deleteAllNoStatElem ( )

◆ deleteNoStatElem()

void ANoStat::deleteNoStatElem ( int  ipar)

◆ detachFromDb()

void ANoStat::detachFromDb ( Db db,
int  icas 
) const
virtual

Reimplemented in NoStatArray.

◆ detachFromMesh()

void ANoStat::detachFromMesh ( ) const
virtual

Reimplemented in NoStatArray.

◆ getAllItems()

const std::vector<CovParamId>& ANoStat::getAllItems ( ) const
inline

◆ getICov()

int ANoStat::getICov ( int  ipar) const
inline

◆ getIGrf()

int ANoStat::getIGrf ( int  ipar) const
inline

◆ getItems()

const CovParamId ANoStat::getItems ( int  ipar) const
inline

◆ getIV1()

int ANoStat::getIV1 ( int  ipar) const
inline

◆ getIV2()

int ANoStat::getIV2 ( int  ipar) const
inline

◆ getNoStat()

const CovParamId ANoStat::getNoStat ( int  ipar) const
inline

◆ getNoStatElemNumber()

int ANoStat::getNoStatElemNumber ( ) const
inline

◆ getNoStats()

const std::vector<CovParamId>& ANoStat::getNoStats ( ) const
inline

◆ getRank()

int ANoStat::getRank ( const EConsElem &  type,
int  icov,
int  iv1 = -1,
int  iv2 = -1,
int  igrf = -1 
) const

Return the rank for a Non-stationary parameter

Parameters
typeRank of Target Type (or EConsElem::UNKNOWN for any)
icovRank of the Target Covariance (or -1 for any)
iv1Rank of the first additional element designation (or -1 for any)
iv2Rank of the second additional element designation (or -1 for any)
igrfRank of Target GRF (or -1 for any)
Returns
-1 if no match is found

◆ getType()

const EConsElem& ANoStat::getType ( int  ipar) const
inline

◆ getValue()

virtual double ANoStat::getValue ( const EConsElem &  type,
int  icas,
int  rank,
int  icov = 0,
int  iv1 = -1,
int  iv2 = -1,
int  igrf = -1 
) const
pure virtual

Implemented in NoStatFunctional, and NoStatArray.

◆ getValueByParam()

virtual double ANoStat::getValueByParam ( int  ipar,
int  icas,
int  rank 
) const
pure virtual

Implemented in NoStatFunctional, and NoStatArray.

◆ isDefined()

bool ANoStat::isDefined ( const EConsElem &  type,
int  icov = 0,
int  iv1 = -1,
int  iv2 = -1,
int  igrf = -1 
) const

◆ isDefinedByCov()

bool ANoStat::isDefinedByCov ( int  icov = -1,
int  igrf = -1 
) const

Look if a Non-stationary parameter is defined

Parameters
icovRank of Target Covariance (or -1 for any)
igrfRank of Target GRF (or -1 for any)
Returns

◆ isDefinedByCovType()

bool ANoStat::isDefinedByCovType ( const EConsElem &  type,
int  icov = -1,
int  igrf = -1 
) const

Look if a Non-stationary parameter is defined

Parameters
typeRank of Target Type (or EConsElem::UNKNOWN for any)
icovRank of the Target Covariance (or -1 for any)
igrfRank of Target GRF (or -1 for any)
Returns

◆ isDefinedByType()

bool ANoStat::isDefinedByType ( const EConsElem &  type,
int  igrf = -1 
) const

Look if a Non-stationary parameter is defined

Parameters
typeRank of Target Type (or EConsElem::UNKNOWN for any)
igrfRank of Target GRF (or -1 for any)
Returns

◆ isDefinedforAnisotropy()

bool ANoStat::isDefinedforAnisotropy ( int  icov = -1,
int  igrf = -1 
) const

Look if a Non-stationary parameter for Anisotropy is defined either by Tensor or by (angle/range/scale)

Parameters
icovRank of the Target Covariance (or -1 for any)
igrfRank of Target GRF (or -1 for any)
Returns

◆ isDefinedforRotation()

bool ANoStat::isDefinedforRotation ( int  icov = -1,
int  igrf = -1 
) const

Look if a Non-stationary parameter for Anisotropy is defined only by angle / range / scale

Parameters
icovRank of the Target Covariance (or -1 for any)
igrfRank of Target GRF (or -1 for any)
Returns

◆ isNotEmpty()

bool ANoStat::isNotEmpty ( ) const
inline

◆ matchICov()

bool ANoStat::matchICov ( int  ipar,
int  icov0 
) const
inline

◆ matchIGrf()

bool ANoStat::matchIGrf ( int  ipar,
int  igrf0 
) const
inline

◆ matchIV1()

bool ANoStat::matchIV1 ( int  ipar,
int  iv10 
) const
inline

◆ matchIV2()

bool ANoStat::matchIV2 ( int  ipar,
int  iv20 
) const
inline

◆ matchType()

bool ANoStat::matchType ( int  ipar,
const EConsElem &  type0 
) const
inline

◆ operator=()

ANoStat & ANoStat::operator= ( const ANoStat m)

◆ toString()

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

Reimplemented from AStringable.

Reimplemented in NoStatFunctional, and NoStatArray.

◆ updateModel()

void ANoStat::updateModel ( Model model,
int  icas1,
int  iech1,
int  icas2,
int  iech2 
) const

Update the Model according to the Non-stationary parameters

Parameters
modelModel to be patched
icas1Type of first Db: 1 for Input; 2 for Output
iech1Rank of the target within Db1 (or -1)
icas2Type of first Db: 1 for Input; 2 for Output
iech2Rank of the target within Dbout (or -2)

◆ updateModelByMesh()

void ANoStat::updateModelByMesh ( Model model,
int  imesh 
) const

Update the Model according to the Non-stationary parameters

Parameters
modelModel to be patched
imeshRank of the target mesh

Member Data Documentation

◆ _amesh

const AMesh* ANoStat::_amesh
mutableprotected

◆ _dbin

const Db* ANoStat::_dbin
mutableprotected

◆ _dbout

const Db* ANoStat::_dbout
mutableprotected

◆ _items

std::vector<CovParamId> ANoStat::_items
private

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