1.5.1
CCC
 
geoslib_f.h File Reference
#include "Covariances/CovAniso.hpp"
#include "gstlearn_export.hpp"
#include "geoslib_d.h"
#include "Basic/NamingConvention.hpp"
#include "Db/DbGrid.hpp"
#include "Matrix/MatrixRectangular.hpp"
#include "Model/Model.hpp"
#include "Model/Constraints.hpp"
#include "Model/Option_AutoFit.hpp"
#include "Model/Option_VarioFit.hpp"
#include "Stats/Selectivity.hpp"
#include "Variogram/DirParam.hpp"

Functions

GSTLEARN_EXPORT Variovariogram_pgs (Db *db, const VarioParam *varioparam, const RuleProp *ruleprop, int flag_rho=false, int opt_correl=2)
 
GSTLEARN_EXPORT int model_auto_fit (Vario *vario, Model *model, bool verbose=false, const Option_AutoFit &mauto_arg=Option_AutoFit(), const Constraints &cons_arg=Constraints(), const Option_VarioFit &optvar_arg=Option_VarioFit())
 
GSTLEARN_EXPORT int vmap_auto_fit (const DbGrid *dbmap, Model *model, bool verbose=false, const Option_AutoFit &mauto_arg=Option_AutoFit(), const Constraints &cons_arg=Constraints(), const Option_VarioFit &optvar_arg=Option_VarioFit())
 
GSTLEARN_EXPORT void set_test_discrete (bool flag_discret)
 
GSTLEARN_EXPORT Variomodel_pgs (Db *db, const VarioParam *varioparam, const RuleProp *ruleprop, const Model *model1, const Model *model2=nullptr)
 
GSTLEARN_EXPORT Cheb_Elemspde_cheb_manage (int mode, int verbose, double power, const VectorDouble &blin, MatrixSparse *S, Cheb_Elem *cheb_old)
 
GSTLEARN_EXPORT int spde_chebychev_operate (MatrixSparse *S, Cheb_Elem *cheb_elem, const VectorDouble &lambda, const VectorDouble &x, VectorDouble &y)
 
GSTLEARN_EXPORT int krigsum (Db *dbin, Db *dbout, Model *model, ANeigh *neigh, bool flag_positive=false, const NamingConvention &namconv=NamingConvention("KrigSum"))
 
GSTLEARN_EXPORT int declustering (Db *db, Model *model, int method, ANeigh *neigh=nullptr, DbGrid *dbgrid=nullptr, const VectorDouble &radius=VectorDouble(), const VectorInt &ndisc=VectorInt(), int flag_sel=false, bool verbose=false)
 
GSTLEARN_EXPORT int simpgs (Db *dbin, Db *dbout, RuleProp *ruleprop, Model *model1, Model *model2=nullptr, ANeigh *neigh=nullptr, int nbsimu=1, int seed=1321421, int flag_gaus=false, int flag_prop=false, int flag_check=false, int flag_show=false, int nbtuba=100, int gibbs_nburn=10, int gibbs_niter=100, double percent=5., const NamingConvention &namconv=NamingConvention("Facies", true, true, true, ELoc::fromKey("FACIES")))
 
GSTLEARN_EXPORT int simbipgs (Db *dbin, Db *dbout, RuleProp *ruleprop, Model *model11, Model *model12=nullptr, Model *model21=nullptr, Model *model22=nullptr, ANeigh *neigh=nullptr, int nbsimu=1, int seed=43243, int flag_gaus=false, int flag_prop=false, int flag_check=false, int flag_show=false, int nbtuba=100, int gibbs_nburn=10, int gibbs_niter=100, double percent=5., const NamingConvention &namconv=NamingConvention("Facies", true, true, true, ELoc::fromKey("FACIES")))
 
GSTLEARN_EXPORT VectorDouble simsph_mesh (MeshSpherical *mesh, Model *model, const SimuSphericalParam &sphepar, int seed=54523, int verbose=false)
 
GSTLEARN_EXPORT MatrixRectangular fluid_extract (DbGrid *dbgrid, const String &name_facies, const String &name_fluid, const String &name_poro, const String &name_date, int nfacies, int nfluids, int facies0, int fluid0, int ntime, double time0, double dtime, bool verbose=false)
 
GSTLEARN_EXPORT int simpgs_spde (Db *dbin, Db *dbout, RuleProp *ruleprop, Model *model1, Model *model2, const String &triswitch, const VectorDouble &gext, int flag_gaus, int flag_prop, int flag_check, int flag_show, int nfacies, int seed, int nbsimu, int gibbs_nburn, int gibbs_niter, int ngibbs_int, int verbose, double percent)
 
GSTLEARN_EXPORT int db_proportion_estimate (Db *dbin, DbGrid *dbout, Model *model, int niter=100, bool verbose=false, const NamingConvention &namconv=NamingConvention("Prop", true, true, true, ELoc::fromKey("P")))
 
GSTLEARN_EXPORT int gibbs_sampler (Db *dbin, Model *model, int nbsimu, int seed, int gibbs_nburn, int gibbs_niter, bool flag_moving, bool flag_norm, bool flag_multi_mono, bool flag_propagation, bool flag_sym_neigh, int gibbs_optstats, double percent, bool flag_ce, bool flag_cstd, bool verbose=false, const NamingConvention &namconv=NamingConvention("Gibbs"))
 

Function Documentation

◆ db_proportion_estimate()

GSTLEARN_EXPORT int db_proportion_estimate ( Db dbin,
DbGrid dbout,
Model model,
int  niter,
bool  verbose,
const NamingConvention namconv 
)

Standard Kriging

Returns
Error return code
Parameters
[in]dbinInput Db structure
[in]dboutOutput Db structure
[in]modelModel structure
[in]niterNumber of iterations
[in]verboseVerbose flag
[in]namconvNaming convention
Remarks
The procedure uses the FIRST covariance of the Model
to describe the spatial structure

◆ declustering()

GSTLEARN_EXPORT int declustering ( Db dbin,
Model model,
int  method,
ANeigh neigh,
DbGrid dbgrid,
const VectorDouble radius,
const VectorInt ndiscs,
int  flag_sel,
bool  verbose 
)

Perform the Declustering task

Returns
Error return code
Parameters
[in]dbininput Db structure
[in]modelModel structure
[in]methodMethod for declustering
[in]neighANeigh structure
[in]dbgridGrid auxiliary Db structure
[in]radiusArray of neighborhood radius
[in]ndiscsArray of discretization
[in]flag_sel1 to mask off samples with zero weight
[in]verboseVerbose option

◆ fluid_extract()

GSTLEARN_EXPORT MatrixRectangular fluid_extract ( DbGrid dbgrid,
const String name_facies,
const String name_fluid,
const String name_poro,
const String name_date,
int  nfacies,
int  nfluids,
int  facies0,
int  fluid0,
int  ntime,
double  time0,
double  dtime,
bool  verbose 
)

Extract time charts from the fluid propagation block

Returns
The returned matrix
Parameters
[in]dbgridDb grid structure
[in]name_faciesName of variable containing Facies
[in]name_fluidName of variable containing Fluid
[in]name_poroName of variable containing Porosity (optional)
[in]name_dateName of variable containing Date
[in]nfaciesnumber of facies (facies 0 excluded)
[in]nfluidsnumber of fluids
[in]facies0Value of the target facies
[in]fluid0Value of the target fluid
[in]ntimeNumber of Time intervals
[in]time0Starting time
[in]dtimeTime interval
[in]verbose1 for a verbose option

◆ gibbs_sampler()

GSTLEARN_EXPORT int gibbs_sampler ( Db dbin,
Model model,
int  nbsimu,
int  seed,
int  gibbs_nburn,
int  gibbs_niter,
bool  flag_moving,
bool  flag_norm,
bool  flag_multi_mono,
bool  flag_propagation,
bool  flag_sym_neigh,
int  gibbs_optstats,
double  percent,
bool  flag_ce,
bool  flag_cstd,
bool  verbose,
const NamingConvention namconv 
)

Perform the Gibbs sampler

Returns
Error return code
Parameters
[in]dbinDb structure
[in]modelModel structure
[in]nbsimuNumber of simulations
[in]seedSeed for random number generator
[in]gibbs_nburnInitial number of iterations for bootstrapping
[in]gibbs_niterMaximum number of iterations
[in]flag_moving1 for Moving
[in]flag_norm1 if the Model must be normalized
[in]flag_multi_mono1 for the Multi_mono algorithm
[in]flag_propagation1 for the propagation algorithm
[in]flag_sym_neighDeprecated argument
[in]gibbs_optstats0: No stats - 1: Print - 2: Save Neutral file
[in]percentAmount of nugget effect added to too continuous model (expressed in percentage of total variance)
[in]flag_ce1 if the conditional expectation should be returned instead of simulations
[in]flag_cstd1 if the conditional standard deviation should be returned instead of simulations
[in]verboseVerbose flag
[in]namconvNaming convention

◆ krigsum()

GSTLEARN_EXPORT int krigsum ( Db dbin,
Db dbout,
Model model,
ANeigh neigh,
bool  flag_positive,
const NamingConvention namconv 
)

Punctual Multivariate Kriging under a constraint

Returns
Error return code
Parameters
[in]dbininput Db structure
[in]dboutoutput Db structure
[in]modelModel structure (univariate)
[in]neighANeigh structure
[in]flag_positive1 for a positive constraints
[in]namconvNaming convention
Remarks
All the variables are estimated using the same model
In this procedure, we assume that:
- the problem is multivariate ("z" variables)
- the constraints is stored in "sum" (only used in dbout)

◆ model_auto_fit()

GSTLEARN_EXPORT int model_auto_fit ( Vario vario,
Model model,
bool  verbose,
const Option_AutoFit mauto_arg,
const Constraints cons_arg,
const Option_VarioFit optvar_arg 
)

Automatic model fitting

Returns
Error returned code
Parameters
[in]varioVario structure containing the exp. variogram
[in]modelModel structure containing the basic structures
[in]verboseVerbose flag
[in]mauto_argOption_AutoFit structure
[in]cons_argConstraints structure
[in]optvar_argOpt_Vario structure

◆ model_pgs()

GSTLEARN_EXPORT Vario* model_pgs ( Db db,
const VarioParam varioparam,
const RuleProp ruleprop,
const Model model1,
const Model model2 
)

Evaluate the experimental variogram of indicators in PluriGaussian case

Returns
Error return code
Parameters
[in]dbDb descriptor
[in]varioparamVarioParam structure
[in]rulepropRuleProp structure
[in]model1First Model structure
[in]model2Second Model structure (optional)

◆ set_test_discrete()

GSTLEARN_EXPORT void set_test_discrete ( bool  flag_discret)

◆ simbipgs()

GSTLEARN_EXPORT int simbipgs ( Db dbin,
Db dbout,
RuleProp ruleprop,
Model model11,
Model model12,
Model model21,
Model model22,
ANeigh neigh,
int  nbsimu,
int  seed,
int  flag_gaus,
int  flag_prop,
int  flag_check,
int  flag_show,
int  nbtuba,
int  gibbs_nburn,
int  gibbs_niter,
double  percent,
const NamingConvention namconv 
)

Perform the conditional or non-conditional Bi Pluri-gaussian simulations

Returns
Error return code
Parameters
[in]dbinInput Db structure (optional)
[in]dboutOutput Db structure
[in]rulepropRuleprop definition
[in]model11First Model structure for First Lithotype Rule
[in]model12Second Model structure for First Lithotype Rule
[in]model21First Model structure for Second Lithotype Rule
[in]model22Second Model structure for Second Lithotype Rule
[in]neighANeigh structure
[in]nbsimuNumber of simulations
[in]seedSeed for random number generator
[in]flag_gaus1 gaussian results; otherwise facies
[in]flag_prop1 for facies proportion
[in]flag_check1 if the facies at data must be checked against the closest simulated grid node
[in]flag_show1 if the grid node which coincides with the data should be represented with the data facies (only if flag_cond && !flag_gaus)
[in]nbtubaNumber of turning bands
[in]gibbs_nburnNumber of bootstrap iterations
[in]gibbs_niterMaximum number of iterations
[in]percentAmount of nugget effect added to too continuous model (expressed in percentage of the total variance)
[in]namconvNaming convention
Remarks
When conditional, the two first variables in the input Db
should correspond to the two facies indices (starting from 1)
The argument 'dbin' is optional: it must be defined only for
conditional simulations
The proportions (nfac1 * nfac2) must be ordered as follows:
f1af2a, f1bf2a, f1cf2a, ..., f1bf2a, f1bf2b, ..., f1nf2m

◆ simpgs()

GSTLEARN_EXPORT int simpgs ( Db dbin,
Db dbout,
RuleProp ruleprop,
Model model1,
Model model2,
ANeigh neigh,
int  nbsimu,
int  seed,
int  flag_gaus,
int  flag_prop,
int  flag_check,
int  flag_show,
int  nbtuba,
int  gibbs_nburn,
int  gibbs_niter,
double  percent,
const NamingConvention namconv 
)

Perform the conditional or non-conditional Pluri-gaussian simulations

Returns
Error return code
Parameters
[in]dbinInput Db structure (optional)
[in]dboutOutput Db structure
[in]rulepropRuleProp structure
[in]model1First Model structure
[in]model2Second Model structure (optional)
[in]neighANeigh structure
[in]nbsimuNumber of simulations
[in]seedSeed for random number generator
[in]flag_gaus1 if results must be gaussian; otherwise facies
[in]flag_prop1 for facies proportion
[in]flag_check1 if the facies at data must be checked against the closest simulated grid node
[in]flag_show1 if the grid node which coincides with the data should be represented with the data facies (only if flag_cond && !flag_gaus)
[in]nbtubaNumber of turning bands
[in]gibbs_nburnNumber of bootstrap iterations
[in]gibbs_niterMaximum number of iterations
[in]percentAmount of nugget effect added to too much continous model (expressed in percentage of the total variance)
[in]namconvNaming convention
Remarks
When conditional, the unique variable in the input Db structure
should correspond to the facies index (starting from 1)
The argument 'dbin' is optional: it must be defined only for
conditional simulations

◆ simpgs_spde()

GSTLEARN_EXPORT int simpgs_spde ( Db dbin,
Db dbout,
RuleProp ruleprop,
Model model1,
Model model2,
const String triswitch,
const VectorDouble gext,
int  flag_gaus,
int  flag_prop,
int  flag_check,
int  flag_show,
int  nfacies,
int  seed,
int  nbsimu,
int  gibbs_nburn,
int  gibbs_niter,
int  ngibbs_int,
int  verbose,
double  percent 
)

Perform the conditional Pluri-gaussian simulations using spde

Returns
Error return code
Parameters
[in]dbinInput Db structure (optional)
[in]dboutOutput Db structure
[in]rulepropRuleProp definition
[in]model1First Model structure
[in]model2Second Model structure (optional)
[in]triswitchMeshing option
[in]gextArray of domain dilation
[in]flag_gaus1 if results must be gaussian; otherwise facies
[in]flag_prop1 for facies proportion
[in]flag_check1 if the facies at data must be checked against the closest simulated grid node
[in]flag_show1 if the grid node which coincides with the data should be represented with the data facies
[in]nfaciesNumber of facies
[in]seedSeed for random number generator
[in]nbsimuNumber of simulations
[in]gibbs_nburnNumber of iterations (Burning step)
[in]gibbs_niterMaximum number of iterations
[in]ngibbs_intNumber of iterations internal to Gibbs (SPDE)
[in]verboseVerbose flag
[in]percentAmount of nugget effect added to too continous model (expressed in percentage of the total variance)
Remarks
When conditional, the unique variable in the input Db structure
should correspond to the facies index (starting from 1)

◆ simsph_mesh()

GSTLEARN_EXPORT VectorDouble simsph_mesh ( MeshSpherical mesh,
Model model,
const SimuSphericalParam sphepar,
int  seed,
int  verbose 
)

Simulates the random function on the sphere

Returns
The Vector simulated values
Parameters
[in]meshMeshSpherical object
[in]modelModel (defined in Euclidean space) to be used
[in]spheparSimuSphericalParam structure
[in]seedSeed for random number generation
[in]verboseVerbose flag

◆ spde_cheb_manage()

GSTLEARN_EXPORT Cheb_Elem* spde_cheb_manage ( int  mode,
int  verbose,
double  power,
const VectorDouble blin,
MatrixSparse S,
Cheb_Elem cheb_old 
)

Manage Cheb_Elem structure

Returns
Error return code
Parameters
[in]mode1 for allocation; -1 for deallocation
[in]verboseVerbose flag
[in]powerParameter passed to Chebychev function
[in]blinArray of coefficients for Linear combinaison
[in]SShift operator
[in]cheb_oldCheb_Elem to be freed (only for mode=-1)
Remarks
Arguments 'power', 'nblin', 'blin' and 'B' are used if mode=1
Argument 'cheb_old' is used if mode=-1

◆ spde_chebychev_operate()

GSTLEARN_EXPORT int spde_chebychev_operate ( MatrixSparse S,
Cheb_Elem cheb_elem,
const VectorDouble lambda,
const VectorDouble x,
VectorDouble y 
)

Perform the Chebychev polynomial procedure on an input vector

Returns
Error return code
Parameters
[in]SShift operator
[in]cheb_elemCheb_Elem structure
[in]lambdaScaling vector
[in]xInput array (Dimension: nvertex)
[out]yOutput array (Dimension: nvertex)

◆ variogram_pgs()

GSTLEARN_EXPORT Vario* variogram_pgs ( Db db,
const VarioParam varioparam,
const RuleProp ruleprop,
int  flag_rho,
int  opt_correl 
)

Calculate the Gaussian variograms

Returns
Error return code
Parameters
[in]dbDb structure
[in]varioparamVarioParam structure for the GRFs
[in]rulepropRuleProp structure
[in]flag_rho1 if the correlation coefficient must be regressed
[in]opt_correl0 full model; 1 symmetrical; 2 residuals
Remarks
This is simply a routine dispatching between the stationary function
and the non-stationary one

◆ vmap_auto_fit()

GSTLEARN_EXPORT int vmap_auto_fit ( const DbGrid dbmap,
Model model,
bool  verbose,
const Option_AutoFit mauto_arg,
const Constraints cons_arg,
const Option_VarioFit optvar_arg 
)

Automatic model fitting

Returns
Error returned code
Parameters
[in]dbmapDb Grid structure containing the Vmap
[in]modelModel structure containing the basic structures
[in]verboseVerbose flag
[in]mauto_argOption_AutoFit structure
[in]cons_argConstraints structure
[in]optvar_argOpt_Vario structure