1.4.1
CCC
 
thresh.cpp File Reference
#include "geoslib_old_f.h"
#include "Basic/Utilities.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Basic/VectorHelper.hpp"
#include "LithoRule/RuleProp.hpp"
#include "LithoRule/PropDef.hpp"
#include "LithoRule/Rule.hpp"
#include "LithoRule/RuleShift.hpp"
#include "LithoRule/RuleShadow.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Variogram/Vario.hpp"
#include "Model/Model.hpp"

Functions

Rulerule_free (const Rule *rule)
 
static int st_proportion_locate (PropDef *propdef, int ifac_ref)
 
static int st_proportion_transform (PropDef *propdef)
 
void proportion_rule_process (PropDef *propdef, const EProcessOper &mode)
 
void proportion_print (PropDef *propdef)
 
static int st_proportion_changed (PropDef *propdef)
 
static int st_proportion_define (PropDef *propdef, const Db *db, int iech, int isimu, int nbsimu, int *jech)
 
int rule_thresh_define_shadow (PropDef *propdef, Db *db, const RuleShadow *rule, int facies, int iech, int isimu, int nbsimu, double *t1min, double *t1max, double *t2min, double *t2max, double *sh_dsup, double *sh_down)
 
int rule_thresh_define (PropDef *propdef, Db *db, const Rule *rule, int facies, int iech, int isimu, int nbsimu, int flag_check, double *t1min, double *t1max, double *t2min, double *t2max)
 
int db_rule_shadow (Db *db, Db *dbprop, RuleShadow *rule, Model *model, const VectorDouble &props, int flag_stat, int nfacies)
 
int _db_rule (Db *db, const RuleProp *ruleprop, Model *model, const NamingConvention &namconv)
 
int db_bounds_shadow (Db *db, Db *dbprop, RuleShadow *rule, Model *model, const VectorDouble &props, int flag_stat, int nfacies)
 
int _db_bounds (Db *db, const RuleProp *ruleprop, Model *model, const NamingConvention &namconv)
 
void propdef_reset (PropDef *propdef)
 
PropDefproportion_manage (int mode, int flag_facies, int flag_stat, int ngrf1, int ngrf2, int nfac1, int nfac2, Db *db, const Db *dbprop, const VectorDouble &propcst, PropDef *proploc)
 
int _db_threshold (Db *db, const RuleProp *ruleprop, Model *model, const NamingConvention &namconv)
 
Modelmodel_rule_combine (const Model *model1, const Model *model2, const Rule *rule)
 

Function Documentation

◆ _db_bounds()

int _db_bounds ( Db db,
const RuleProp ruleprop,
Model model,
const NamingConvention namconv 
)

Apply the Rule transformation to derive the bounds variables for a Db

Returns
Error return code
Parameters
[in]dbDb structure
[in]rulepropRuleProp structure
[in]modelFirst Model structure (only for SHIFT)
[in]namconvNaming convention

◆ _db_rule()

int _db_rule ( Db db,
const RuleProp ruleprop,
Model model,
const NamingConvention namconv 
)

Apply the Rule transformation to convert a set of Gaussian vectors into the corresponding Facies in a Db

Returns
Error return code
Parameters
[in]dbOutput Db structure
[in]rulepropRuleProp structure
[in]modelFirst Model structure (only for SHIFT)
[in]namconvNaming convention
Remarks
The input variable must be locatorized as Z or ELoc::SIMU

◆ _db_threshold()

int _db_threshold ( Db db,
const RuleProp ruleprop,
Model model,
const NamingConvention namconv 
)

Calculate all the thresholds at each sample of a Db

Returns
Error return code
Parameters
[in]dbDb structure
[in]rulepropRuleProp structure
[in]modelFirst Model structure (only for SHIFT)
[in]namconvNaming Convention

◆ db_bounds_shadow()

int db_bounds_shadow ( Db db,
Db dbprop,
RuleShadow rule,
Model model,
const VectorDouble props,
int  flag_stat,
int  nfacies 
)

Apply the Rule transformation to derive the bounds variables for a Db (Shadow case)

Returns
Error return code
Parameters
[in]dbDb structure
[in]dbpropDb structure used for proportions (non-stationary case)
[in]ruleLithotype Rule definition
[in]modelFirst Model structure (only for SHIFT)
[in]propsArray of proportions for the facies
[in]flag_stat1 for stationary; 0 otherwise
[in]nfaciesNumber of facies

◆ db_rule_shadow()

int db_rule_shadow ( Db db,
Db dbprop,
RuleShadow rule,
Model model,
const VectorDouble props,
int  flag_stat,
int  nfacies 
)

Apply the Rule transformation to the GRFs of a Db (Shadow case)

Returns
Error return code
Parameters
[in]dbOutput Db structure
[in]dbpropDb structure used for proportions (non-stationary case)
[in]ruleLithotype Rule definition
[in]modelFirst Model structure (only for SHIFT)
[in]propsArray of proportions for the facies
[in]flag_stat1 for stationary; 0 otherwise
[in]nfaciesNumber of facies
Remarks
The input variable must be locatorized as Z or ELoc::SIMU
It will be changed in this function to locator ELoc::SIMU

◆ model_rule_combine()

Model* model_rule_combine ( const Model model1,
const Model model2,
const Rule rule 
)

Combine two basic models into a bivariate model (residuals model)

Returns
The newly Model structure
Parameters
[in]model1First input Model
[in]model2Second input Model
[in]ruleRule
Remarks
: The drift is not copied into the new model

◆ propdef_reset()

void propdef_reset ( PropDef propdef)

Set memory proportion so as to provoke the update at first usage

Parameters
[in]propdefPointer to Propdef structure

◆ proportion_manage()

PropDef* proportion_manage ( int  mode,
int  flag_facies,
int  flag_stat,
int  ngrf1,
int  ngrf2,
int  nfac1,
int  nfac2,
Db db,
const Db dbprop,
const VectorDouble propcst,
PropDef proploc 
)

Allocate or deallocate a proportion array

Returns
Pointer on the returned PropDef structure
Parameters
[in]mode1 for allocation; -1 for deallocation
[in]flag_facies1 if Gibbs is used for facies
[in]flag_stat1 if the proportions are stationary
[in]ngrf1Number of GRFs for the first PGS
[in]ngrf2Number of GRFs for the second PGS
[in]nfac1Number of facies for the first PGS
[in]nfac2Number of facies for the second PGS
[in]dbDb structure containing the data
[in]dbpropDb structure containing the proportions (only used in the non-stationary case)
[in]propcstConstant set of proportions (used if flag_stat)
[in]proplocPropDef structure (used for mode<0)

◆ proportion_print()

void proportion_print ( PropDef propdef)

Print the (non-stationary) proportions

Parameters
[in]propdefPropDef structure

◆ proportion_rule_process()

void proportion_rule_process ( PropDef propdef,
const EProcessOper &  mode 
)

Set the method to compute Proportions

Parameters
[in]propdefPropDef structure
[in]modeType of operation (EProcessOper)

◆ rule_free()

Rule* rule_free ( const Rule rule)

Free a Rule structure

Returns
Pointer to the newly freed Rule structure
Parameters
[in]ruleRule structure to be freed

◆ rule_thresh_define()

int rule_thresh_define ( PropDef propdef,
Db db,
const Rule rule,
int  facies,
int  iech,
int  isimu,
int  nbsimu,
int  flag_check,
double *  t1min,
double *  t1max,
double *  t2min,
double *  t2max 
)

Set the (non-stationary) proportions and define thresholds

Returns
Error return code
Parameters
[in]propdefPropDef structure
[in]dbDb input structure
[in]ruleRule structure
[in]faciesFacies of interest (or ITEST) starting from 1
[in]iechRank of the data in the input Db
[in]isimuRank of the simulation (EProcessOper::CONDITIONAL)
[in]nbsimuNumber of simulations
[in]flag_check1 if the consistency check with the actual proportion of the current facies must be done
[out]t1minMinimum threshold for Y1
[out]t1maxMaximum threshold for Y1
[out]t2minMinimum threshold for Y2
[out]t2maxMaximum threshold for Y2

◆ rule_thresh_define_shadow()

int rule_thresh_define_shadow ( PropDef propdef,
Db db,
const RuleShadow rule,
int  facies,
int  iech,
int  isimu,
int  nbsimu,
double *  t1min,
double *  t1max,
double *  t2min,
double *  t2max,
double *  sh_dsup,
double *  sh_down 
)

Set the (non-stationary) proportions and define thresholds (for shadow only)

Returns
Error return code
Parameters
[in]propdefPropDef structure
[in]dbDb input structure
[in]ruleRule structure
[in]faciesFacies of interest (or GV_ITEST)
[in]iechRank of the data in the input Db
[in]isimuRank of the simulation (EProcessOper::CONDITIONAL)
[in]nbsimuNumber of simulations (EProcessOper::CONDITIONAL)
[out]t1minMinimum threshold for Y1
[out]t1maxMaximum threshold for Y1
[out]t2minMinimum threshold for Y2
[out]t2maxMaximum threshold for Y2
[out]sh_dsupLocal or global upwards shift (shadow)
[out]sh_downLocal or global downwards shift (shadow)

◆ st_proportion_changed()

static int st_proportion_changed ( PropDef propdef)
static

Check if the proportion has changed since the previous usage and store the current proportions for future comparison

Returns
1 if the proportions are unchanged; 0 otherwise
Parameters
[in]propdefPropDef structure

◆ st_proportion_define()

static int st_proportion_define ( PropDef propdef,
const Db db,
int  iech,
int  isimu,
int  nbsimu,
int *  jech 
)
static

Set the (non-stationary) proportions

Returns
Error return code
- the target point does not lie within the proportion grid
- in conditional processing, the reference facies does not exist
Parameters
[in]propdefPropDef structure
[in]dbDb input structure
[in]iechRank of the data in the input Db
[in]isimuRank of the simulation (EProcessOper::CONDITIONAL)
[in]nbsimuNumber of simulations
[out]jechRank of the auxiliary data in the input Db
Remarks
At the end of this function, the local proportions are stored
in the array proploc of the structure PropDef
The argument 'isimu' is only used for
propdef->mode == EProcessOper::CONDITIONAL (simbipgs)

◆ st_proportion_locate()

static int st_proportion_locate ( PropDef propdef,
int  ifac_ref 
)
static

Locate the current proportions

Parameters
[in]propdefPropDef structure
[in]ifac_refConditional (first variable) facies (Only used for EProcessOper::CONDITIONAL)

◆ st_proportion_transform()

static int st_proportion_transform ( PropDef propdef)
static

Transform the proportions (from CST to WRK)

Returns
-1 if the proportion is not defined; 0 otherwise
Parameters
[in]propdefPropDef structure