1.11.1
CCC
 
Loading...
Searching...
No Matches
gstlrn::Rule Class Reference

Lithological Rule which describes the arrangement of facies in the MonoGaussian or the biGaussian space. More...

#include <Rule.hpp>

Inheritance diagram for gstlrn::Rule:
gstlrn::AStringable gstlrn::ASerializable gstlrn::ICloneable gstlrn::RuleShadow gstlrn::RuleShift

Detailed Description

Lithological Rule which describes the arrangement of facies in the MonoGaussian or the biGaussian space.

Let us first describe the structure of the Rule in the MonoGaussian case. The Rule is defined by a set of codes that constitue a grammar, explained hereafter. The idea is to consider an axis (representing the Gaussian scale) and to define thresholds along this axis.

Each threshold is coded using "S" symbol. It is followed by the description of the Rule contents on the left side of the threshold first, then on its right side. On any side, we can imagine to define another threshold (using the code "S" again) or a Facies (using the code "F" followed by the Facies rank).

In the following example, we consider the following string (set of codes): "S1", "S2", "F4", "F1", "S3", "F3", "F2" (Note that the symbol "S" has been 'decorated' by an optional rank). This corresponds to the following arrangement:

  • Define Threshold S1 first
  • On the left of S1, define Threshold S2
  • On the left of S2, define Facies F4
  • On the right of S2 (and left of S1), define Facies F1
  • On the right of S1, define Threshold S3
  • On the left of S3 (and the right of S1), define Facies F3
  • On the right of S3, define Facies F2 This is one way to define following arrangement of Facies and Thresholds along the Gaussian axis: F4 | S2 | F1 | S1 | F3 | S3 | F2 Note that the same result would be obtained with the following string: "S1", "S3", "F2", "F3", "S2", "F1", "F4"

In the BiGaussian case, the Rule is defined with a string (set of codes) that is similar to the one used in the MonoGaussian case, but with the addition of a new symbol "T" that is used to define thresholds along the second Gaussian axis. When a "T" threshold is used, it must be followed by the description of the Rule contents on the left side of the threshold first, then on its right side.

Note that a convenient representation of the Rule is to consider it as a Square with the first Gaussian axis as the horizontal axis and the second Gaussian axis as the vertical axis. Due to this representation, we must switch from "left and right" to "below and above" when describing the Rule contents on the two sides of a "T" threshold.

The following simple BiGaussian example is considered: "S1", "T1", "F4", "F1", "T2", "F3", "F2" This corresponds to the following arrangement:

  • Define Threshold S1 first (vertical split of the Square)
  • On the left of S1, define Threshold T1 (horizontal split of the left part of the Square)
  • On the bottom of T1 (and left of S1), define Facies F4
  • On the top of T1 (and left of S1), define Facies F1
  • On the right of S1, define Threshold T2 (horizontal split of the right part of the Square)
  • On the bottom of T2 (and right of S1), define Facies F3
  • On the top of T2 (and right of S1), define Facies F2 This is one way to define following arrangement of Facies and Thresholds along the two Gaussian axes: F1 | S1 | F3 —+-—+— T1 | | T2 —+-—+— F4 | S1 | F2 —+-—+—

Public Member Functions

 Rule (double rho=0.)
 
 Rule (const 1 &icodes)
 Create a Rule from a vector of integers.
 
 Rule (const Rule &m)
 
Ruleoperator= (const Rule &m)
 
virtual ~Rule ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable Interface.
 
String getNFName () const override
 ASerializable Interface.
 
Id resetFromNames (const VectorString &nodnames, double rho=0.)
 
Id resetFromFaciesCount (Id nfacies, double rho=0.)
 
virtual String displaySpecific () const
 
virtual Id particularities (Db *db, const Db *dbprop, Model *model, Id flag_grid_check, Id flag_stat) const
 
virtual bool checkModel (const Model *model, Id nvar=0) const
 
virtual Id gaus2facData (const PropDef &propdef, Db *dbin, Db *dbout, const VectorBool &flag_used, Id ipgs, Id isimu, Id nbsimu) const
 
virtual Id gaus2facResult (const PropDef &propdef, Db *dbout, const VectorBool &flag_used, Id ipgs, Id isimu, Id nbsimu) const
 
virtual Id evaluateBounds (const PropDef &propdef, Db *dbin, Db *dbout, Id isimu, Id igrf, Id ipgs, Id nbsimu) const
 
Id getFlagProp () const
 
const ERule & getModeRule () const
 
double getRho () const
 
const NodegetMainNode () const
 
void setFlagProp (Id flagProp)
 
void setRho (double rho) const
 
void setModeRule (const ERule &modeRule)
 TODO : Check if mutable is really necessary.
 
Id setProportions (const 1 &proportions=1(), bool flagGaussian=true) const
 
Id statistics (Id verbose, Id *node_tot, Id *nfac_tot, Id *nmax_tot, Id *ny1_tot, Id *ny2_tot, double *prop_tot) const
 
Id getNFacies () const
 
Id getNGRF () const
 
Id getNY1 () const
 
Id getNY2 () const
 
bool isYUsed (Id igrf) const
 
VectorBool whichGRFUsed () const
 
double getProportion (Id facies)
 
std::array< double, 4 > getThresh (Id facies) const
 
 getThreshFromRectangle (Id rect, Id *facies)
 
Id getFaciesFromGaussian (double y1, double y2) const
 
 getNodes () const
 
void updateShift () const
 
VectorString getFaciesNames () const
 
 getFaciesColors () const
 
 getFaciesValues () const
 
String getFaciesName (Id facies) const
 
Id getFaciesColor (Id facies) const
 
Id getFaciesValue (Id facies) const
 
String getFaciesColorName (Id facies) const
 
double getScore () const
 
void setFaciesNames (const VectorString &facnames)
 
void setFaciesColors (const 1 &faccols)
 
void setFaciesValues (const 1 &facvalues)
 
void setFaciesName (Id facies, const String &name)
 
void setFaciesValue (Id facies, Id value)
 
void setFaciesColorByName (Id facies, const String &color)
 
void setFaciesColorByHexa (Id facies, const String &hexa)
 
void setFaciesColorByInt (Id facies, const Id &value)
 
void setCharacteristics (Id facies, const String &name=String(), const String &color=String(), Id value=ITEST)
 Define the characteristics of a given facies.
 
void setScore (double score)
 
String namesPrint () const
 
- Public Member Functions inherited from gstlrn::AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (Id level) const final
 
void printConcreteClassName () const
 
- Public Member Functions inherited from gstlrn::ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)=default
 
ASerializableoperator= (const ASerializable &r)=default
 
 ASerializable (ASerializable &&r) noexcept=default
 
ASerializableoperator= (ASerializable &&r) noexcept=default
 
virtual ~ASerializable ()=default
 
bool dumpToNF (const String &NFFilename, const EFormatNF &format=EFormatNF::fromKey("DEFAULT")) const
 Dump the contents of an object into an Output File using a given Output NF Format.
 
void setDefaultFormatNF (const EFormatNF &format)
 
- Public Member Functions inherited from gstlrn::ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 
std::shared_ptr< ICloneablecloneShared () const
 
std::unique_ptr< ICloneablecloneUnique () const
 

Static Public Member Functions

static Rulecreate (double rho=0.)
 
static RulecreateFromNF (const String &NFFilename, bool verbose=true)
 
static RulecreateFromNames (const VectorString &nodnames, double rho=0.)
 
static RulecreateFromFaciesCount (Id nfacies, double rho=0.)
 
- Static Public Member Functions inherited from gstlrn::ASerializable
static String buildFileName (Id status, const String &filename, bool ensureDirExist=false)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetPrefixName ()
 

Constructor & Destructor Documentation

◆ Rule() [1/3]

gstlrn::Rule::Rule ( double  rho = 0.)

◆ Rule() [2/3]

gstlrn::Rule::Rule ( const 1 &  icodes)

Create a Rule from a vector of integers.

Parameters
icodesVector on integers representing the Rule. Each integer can be:
  • the rank of the Facies (when < 1000)
  • 1001: represents a threshold along Y1
  • 1002: represents a threshold along Y2

◆ Rule() [3/3]

gstlrn::Rule::Rule ( const Rule m)

◆ ~Rule()

gstlrn::Rule::~Rule ( )
virtual

Member Function Documentation

◆ checkModel()

bool gstlrn::Rule::checkModel ( const Model model,
Id  nvar = 0 
) const
virtual

Reimplemented in gstlrn::RuleShift.

◆ create()

Rule * gstlrn::Rule::create ( double  rho = 0.)
static

◆ createFromFaciesCount()

Rule * gstlrn::Rule::createFromFaciesCount ( Id  nfacies,
double  rho = 0. 
)
static

◆ createFromNames()

Rule * gstlrn::Rule::createFromNames ( const VectorString nodnames,
double  rho = 0. 
)
static

◆ createFromNF()

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

◆ displaySpecific()

String gstlrn::Rule::displaySpecific ( ) const
virtual

Reimplemented in gstlrn::RuleShadow, and gstlrn::RuleShift.

◆ evaluateBounds()

Id gstlrn::Rule::evaluateBounds ( const PropDef propdef,
Db dbin,
Db dbout,
Id  isimu,
Id  igrf,
Id  ipgs,
Id  nbsimu 
) const
virtual

Set the bounds and possibly add replicates

Returns
Error return code
Parameters
[in]propdefPropDef structure
[in]dbinDb structure
[in]dboutDb grid structure
[in]isimuRank of the simulation (if EProcessOper::CONDITIONAL)
[in]igrfRank of the GRF
[in]ipgsRank of the GS
[in]nbsimuNumber of simulations (if EProcessOper::CONDITIONAL)

Reimplemented in gstlrn::RuleShadow, and gstlrn::RuleShift.

◆ gaus2facData()

Id gstlrn::Rule::gaus2facData ( const PropDef propdef,
Db dbin,
Db dbout,
const VectorBool flag_used,
Id  ipgs,
Id  isimu,
Id  nbsimu 
) const
virtual

Combine the underlying GRF into a facies value at data points

Returns
Error return code
Parameters
[in]propdefPropDef structure
[in]dbinDb input structure
[in]dboutDb output structure
[in]flag_usedTrue if the gaussian is used; False otherwise
[in]ipgsRank of the PGS
[in]isimuRank of the simulation
[in]nbsimuNumber of simulations
Remarks
Attributes ELoc::GAUSFAC are mandatory
Attributes ELoc::FACIES are mandatory

Reimplemented in gstlrn::RuleShadow.

◆ gaus2facResult()

Id gstlrn::Rule::gaus2facResult ( const PropDef propdef,
Db dbout,
const VectorBool flag_used,
Id  ipgs,
Id  isimu,
Id  nbsimu 
) const
virtual

Combine the underlying GRF into a facies value

Returns
Error return code
Parameters
[in]propdefPropDef structure
[in]dboutDb output structure
[in]flag_usedTrue if the gaussian is used; False otherwise
[in]ipgsRank of the PGS
[in]isimuRank of the simulation
[in]nbsimuNumber of simulations
Remarks
Attributes ELoc::FACIES and ELoc::SIMU are mandatory

Reimplemented in gstlrn::RuleShadow, and gstlrn::RuleShift.

◆ getFaciesColor()

Id gstlrn::Rule::getFaciesColor ( Id  facies) const

◆ getFaciesColorName()

String gstlrn::Rule::getFaciesColorName ( Id  facies) const

◆ getFaciesColors()

gstlrn::Rule::getFaciesColors ( ) const
inline

◆ getFaciesFromGaussian()

Id gstlrn::Rule::getFaciesFromGaussian ( double  y1,
double  y2 
) const

Convert the two underlying GRFs into facies

Returns
The facies rank (starting from 1) or 0 (facies not found)
Parameters
[in]y1Value of the first underlying GRF
[in]y2Value of the second underlying GRF
Remarks
If one of the two GRF is undefined, the resulting facies is 0

◆ getFaciesName()

String gstlrn::Rule::getFaciesName ( Id  facies) const

◆ getFaciesNames()

VectorString gstlrn::Rule::getFaciesNames ( ) const
inline

◆ getFaciesValue()

Id gstlrn::Rule::getFaciesValue ( Id  facies) const

◆ getFaciesValues()

gstlrn::Rule::getFaciesValues ( ) const
inline

◆ getFlagProp()

Id gstlrn::Rule::getFlagProp ( ) const
inline

◆ getMainNode()

const Node * gstlrn::Rule::getMainNode ( ) const
inline

◆ getModeRule()

const ERule & gstlrn::Rule::getModeRule ( ) const
inline

◆ getNFacies()

Id gstlrn::Rule::getNFacies ( ) const

◆ getNFName()

String gstlrn::Rule::getNFName ( ) const
inlineoverridevirtual

ASerializable Interface.

Implements gstlrn::ASerializable.

Reimplemented in gstlrn::RuleShadow, and gstlrn::RuleShift.

◆ getNGRF()

Id gstlrn::Rule::getNGRF ( ) const

◆ getNodes()

gstlrn::Rule::getNodes ( ) const

◆ getNY1()

Id gstlrn::Rule::getNY1 ( ) const

◆ getNY2()

Id gstlrn::Rule::getNY2 ( ) const

◆ getProportion()

double gstlrn::Rule::getProportion ( Id  facies)

Returns the proportion of a given facies

Parameters
faciesFacies rank (starting from 1)
Returns
Proportion of the given Facies

◆ getRho()

double gstlrn::Rule::getRho ( ) const
inline

◆ getScore()

double gstlrn::Rule::getScore ( ) const
inline

◆ getThresh()

std::array< double, 4 > gstlrn::Rule::getThresh ( Id  facies) const

Return the vector of bounds for a given facies

Parameters
faciesRank of the target facies (starting from 1)
Returns
The vector of bounds organized as [t1min, t1max, t2min, t2max]

◆ getThreshFromRectangle()

gstlrn::Rule::getThreshFromRectangle ( Id  rect,
Id facies 
)

◆ isYUsed()

bool gstlrn::Rule::isYUsed ( Id  igrf) const

◆ namesPrint()

String gstlrn::Rule::namesPrint ( ) const

◆ operator=()

Rule & gstlrn::Rule::operator= ( const Rule m)

◆ particularities()

Id gstlrn::Rule::particularities ( Db db,
const Db dbprop,
Model model,
Id  flag_grid_check,
Id  flag_stat 
) const
virtual

Define the particularities of the PGS model

Returns
Error return code
Parameters
[in]dbDb structure
[in]dbpropDb structure used for proportions
[in]modelModel structure (only used for shift option)
[in]flag_grid_check1 if grid is compulsory; 0 otherwise (only for SHIFT)
[in]flag_stat1 for stationary; 0 otherwise

Reimplemented in gstlrn::RuleShadow, and gstlrn::RuleShift.

◆ resetFromFaciesCount()

Id gstlrn::Rule::resetFromFaciesCount ( Id  nfacies,
double  rho = 0. 
)

◆ resetFromNames()

Id gstlrn::Rule::resetFromNames ( const VectorString nodnames,
double  rho = 0. 
)

◆ setCharacteristics()

void gstlrn::Rule::setCharacteristics ( Id  facies,
const String name = String(),
const String color = String(),
Id  value = ITEST 
)

Define the characteristics of a given facies.

Parameters
faciesRank of the facies (0 based)
nameName assigned to the target facies (or String() to keep the current name)
colorColor assigned to the target facies (or String() to keep the current color)
valueValue assigned to the target facies (or ITEST to keep the current value)

◆ setFaciesColorByHexa()

void gstlrn::Rule::setFaciesColorByHexa ( Id  facies,
const String hexa 
)

◆ setFaciesColorByInt()

void gstlrn::Rule::setFaciesColorByInt ( Id  facies,
const Id value 
)

◆ setFaciesColorByName()

void gstlrn::Rule::setFaciesColorByName ( Id  facies,
const String color 
)

◆ setFaciesColors()

void gstlrn::Rule::setFaciesColors ( const 1 &  faccols)
inline

◆ setFaciesName()

void gstlrn::Rule::setFaciesName ( Id  facies,
const String name 
)

◆ setFaciesNames()

void gstlrn::Rule::setFaciesNames ( const VectorString facnames)
inline

◆ setFaciesValue()

void gstlrn::Rule::setFaciesValue ( Id  facies,
Id  value 
)

◆ setFaciesValues()

void gstlrn::Rule::setFaciesValues ( const 1 &  facvalues)
inline

◆ setFlagProp()

void gstlrn::Rule::setFlagProp ( Id  flagProp)
inline

◆ setModeRule()

void gstlrn::Rule::setModeRule ( const ERule &  modeRule)
inline

TODO : Check if mutable is really necessary.

◆ setProportions()

Id gstlrn::Rule::setProportions ( const 1 &  proportions = 1(),
bool  flagGaussian = true 
) const

Define constant proportions

Parameters
proportionsThe vector of constant proportions.
flagGaussianIf true, the proportions are defined in Gaussian space.

Note: 'proportions' should be dimensioned to the number of facies. If absent, all proportions are considered equal.

Returns

◆ setRho()

void gstlrn::Rule::setRho ( double  rho) const
inline

◆ setScore()

void gstlrn::Rule::setScore ( double  score)
inline

◆ statistics()

Id gstlrn::Rule::statistics ( Id  verbose,
Id node_tot,
Id nfac_tot,
Id nmax_tot,
Id ny1_tot,
Id ny2_tot,
double *  prop_tot 
) const

Calculates the statistics from the Lithotype Rule

Returns
Error return code
Parameters
[in]verbose1 for a verbose output; 0 otherwise
[out]node_totNumber of nodes
[out]nfac_totNumber of facies
[out]nmax_totNumber of (different) facies
[out]ny1_totNumber of thresholds for Y1
[out]ny2_totNumber of thresholds for Y2
[out]prop_totTotal proportion
Remarks
The tolerance on the sum of the proportions can be defined
using set_keypair("TolSumProportions",newtol)

◆ toString()

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

ICloneable Interface.

AStringable Interface

Reimplemented from gstlrn::AStringable.

◆ updateShift()

void gstlrn::Rule::updateShift ( ) const

◆ whichGRFUsed()

VectorBool gstlrn::Rule::whichGRFUsed ( ) const

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