#include "Gibbs/AGibbs.hpp"
#include "geoslib_f.h"
#include "geoslib_old_f.h"
#include "Enum/EProcessOper.hpp"
#include "Enum/ERule.hpp"
#include "Calculators/CalcMigrate.hpp"
#include "Gibbs/GibbsUMultiMono.hpp"
#include "Gibbs/GibbsUPropMono.hpp"
#include "Gibbs/GibbsMMulti.hpp"
#include "Gibbs/GibbsFactory.hpp"
#include "Covariances/CovAniso.hpp"
#include "Basic/NamingConvention.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/Law.hpp"
#include "Basic/OptDbg.hpp"
#include "LithoRule/PropDef.hpp"
#include "LithoRule/Rule.hpp"
#include "LithoRule/RuleShift.hpp"
#include "LithoRule/RuleShadow.hpp"
#include "LithoRule/RuleProp.hpp"
#include "Db/Db.hpp"
#include "Model/Model.hpp"
#include "Neigh/NeighUnique.hpp"
#include "Neigh/NeighMoving.hpp"
#include "Simulation/CalcSimuTurningBands.hpp"
#include "Simulation/SimuBoolean.hpp"
#include "Simulation/SimuSpherical.hpp"
#include "Simulation/SimuSphericalParam.hpp"
#include "Simulation/CalcSimuRefine.hpp"
#include "Simulation/CalcSimuEden.hpp"
#include "Simulation/CalcSimuFFT.hpp"
#include "Basic/Memory.hpp"
#include "Core/Keypair.hpp"
#include <math.h>
#include <string.h>
Functions | |
static void | st_simulation_environment (void) |
static int | st_facies (PropDef *propdef, int ipgs, int ifac) |
void | simu_func_categorical_transf (Db *db, int verbose, int isimu, int nbsimu) |
void | simu_func_continuous_update (Db *db, int verbose, int isimu, int nbsimu) |
void | simu_func_categorical_update (Db *db, int verbose, int isimu, int nbsimu) |
void | simu_func_continuous_scale (Db *db, int verbose, int nbsimu) |
void | simu_func_categorical_scale (Db *db, int verbose, int nbsimu) |
void | check_mandatory_attribute (const char *method, Db *db, const ELoc &locatorType) |
static int | st_keep (int flag_gaus, int flag_prop, int file, int type) |
static int | st_check_simtub_environment (Db *dbin, Db *dbout, Model *model, ANeigh *neigh) |
int | get_rank_from_propdef (PropDef *propdef, int ipgs, int igrf) |
static void | st_suppress_added_samples (Db *db, int nech) |
static void | st_check_facies_data2grid (Db *dbin, Db *dbout, int flag_check, int flag_show, int ipgs, int nechin, int nfacies, int nbsimu) |
static void | st_init_gibbs_params (double rho) |
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) |
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) |
int | db_simulations_to_ce (Db *db, const ELoc &locatorType, int nbsimu, int nvar, int *iptr_ce_arg, int *iptr_cstd_arg) |
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) |
int | simtub_constraints (Db *dbin, Db *dbout, Model *model, ANeigh *neigh, int seed, int nbtuba, int nbsimu_min, int nbsimu_quant, int niter_max, VectorInt &cols, int(*func_valid)(int flag_grid, int nDim, int nech, int *nx, double *dx, double *x0, double nonval, double percent, VectorDouble &tab)) |
static int | st_maxstable_mask (Db *dbout, double seuil, double scale, int iptrv, int iptrs) |
static void | st_maxstable_combine (Db *dbout, double scale, int iter0, int iptrg, int iptrv, int iptrr, int *last) |
int | simmaxstable (Db *dbout, Model *model, double ratio, int seed, int nbtuba, int flag_simu, int flag_rank, int verbose) |
static double | st_quantile (Db *dbout, double proba, double *sort) |
int | simRI (Db *dbout, Model *model, int ncut, double *zcut, double *wcut, int seed, int nbtuba, int verbose) |
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) |
int | simcond (Db *dbin, Db *dbout, Model *model, int seed, int nbsimu, int nbtuba, int gibbs_nburn, int gibbs_niter, int flag_check, int flag_ce, int flag_cstd, int verbose) |
int | simsph (DbGrid *db, Model *model, const SimuSphericalParam &sphepar, int seed, bool verbose, const NamingConvention &namconv) |
VectorDouble | simsph_mesh (MeshSpherical *mesh, Model *model, const SimuSphericalParam &sphepar, int seed, int verbose) |
static int | st_getTimeInterval (double date, int ntime, double time0, double dtime) |
static int | st_getFACIES (const DbGrid *dbgrid, int nfacies, int indFacies, int iech) |
static double | st_getPORO (const DbGrid *dbgrid, int indPoro, int iech) |
static double | st_getDATE (const DbGrid *dbgrid, int indDate, int iech) |
static int | st_getFLUID (const DbGrid *dbgrid, int nfluids, int indFluid, int iech) |
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) |
Variables | |
static double | GIBBS_RHO |
static double | GIBBS_SQR |
static Modif_Categorical | ModCat = { 0, { 0, 0 }, NULL, NULL } |
void check_mandatory_attribute | ( | const char * | method, |
Db * | db, | ||
const ELoc & | locatorType | ||
) |
Check for the presence of mandatory attributes
[in] | method | Name of the method |
[in] | db | Db structure |
[in] | locatorType | Mandatory attribute type |
int db_simulations_to_ce | ( | Db * | db, |
const ELoc & | locatorType, | ||
int | nbsimu, | ||
int | nvar, | ||
int * | iptr_ce_arg, | ||
int * | iptr_cstd_arg | ||
) |
Convert series of simulations to conditional expectation and variance
[in] | db | Db structure |
[in] | locatorType | Type of pointer containing the simulations |
[in] | nbsimu | Number of simulations |
[in] | nvar | Number of variables |
[out] | iptr_ce_arg | Pointer to the Conditional Expectation attributes |
[out] | iptr_cstd_arg | Pointer to the Conditional St. Dev. attributes |
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
[in] | dbgrid | Db grid structure |
[in] | name_facies | Name of variable containing Facies |
[in] | name_fluid | Name of variable containing Fluid |
[in] | name_poro | Name of variable containing Porosity (optional) |
[in] | name_date | Name of variable containing Date |
[in] | nfacies | number of facies (facies 0 excluded) |
[in] | nfluids | number of fluids |
[in] | facies0 | Value of the target facies |
[in] | fluid0 | Value of the target fluid |
[in] | ntime | Number of Time intervals |
[in] | time0 | Starting time |
[in] | dtime | Time interval |
[in] | verbose | 1 for a verbose option |
int get_rank_from_propdef | ( | PropDef * | propdef, |
int | ipgs, | ||
int | igrf | ||
) |
Give the rank of a "variable" for a given GRF and PGS
[in] | propdef | PropDef structure |
[in] | ipgs | Rank of the GS |
[in] | igrf | Rank of the Gaussian |
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
[in] | dbin | Db structure |
[in] | model | Model structure |
[in] | nbsimu | Number of simulations |
[in] | seed | Seed for random number generator |
[in] | gibbs_nburn | Initial number of iterations for bootstrapping |
[in] | gibbs_niter | Maximum number of iterations |
[in] | flag_moving | 1 for Moving |
[in] | flag_norm | 1 if the Model must be normalized |
[in] | flag_multi_mono | 1 for the Multi_mono algorithm |
[in] | flag_propagation | 1 for the propagation algorithm |
[in] | flag_sym_neigh | Deprecated argument |
[in] | gibbs_optstats | 0: No stats - 1: Print - 2: Save Neutral file |
[in] | percent | Amount of nugget effect added to too continuous model (expressed in percentage of total variance) |
[in] | flag_ce | 1 if the conditional expectation should be returned instead of simulations |
[in] | flag_cstd | 1 if the conditional standard deviation should be returned instead of simulations |
[in] | verbose | Verbose flag |
[in] | namconv | Naming convention |
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
[in] | dbin | Input Db structure (optional) |
[in] | dbout | Output Db structure |
[in] | ruleprop | Ruleprop definition |
[in] | model11 | First Model structure for First Lithotype Rule |
[in] | model12 | Second Model structure for First Lithotype Rule |
[in] | model21 | First Model structure for Second Lithotype Rule |
[in] | model22 | Second Model structure for Second Lithotype Rule |
[in] | neigh | ANeigh structure |
[in] | nbsimu | Number of simulations |
[in] | seed | Seed for random number generator |
[in] | flag_gaus | 1 gaussian results; otherwise facies |
[in] | flag_prop | 1 for facies proportion |
[in] | flag_check | 1 if the facies at data must be checked against the closest simulated grid node |
[in] | flag_show | 1 if the grid node which coincides with the data should be represented with the data facies (only if flag_cond && !flag_gaus) |
[in] | nbtuba | Number of turning bands |
[in] | gibbs_nburn | Number of bootstrap iterations |
[in] | gibbs_niter | Maximum number of iterations |
[in] | percent | Amount of nugget effect added to too continuous model (expressed in percentage of the total variance) |
[in] | namconv | Naming convention |
int simcond | ( | Db * | dbin, |
Db * | dbout, | ||
Model * | model, | ||
int | seed, | ||
int | nbsimu, | ||
int | nbtuba, | ||
int | gibbs_nburn, | ||
int | gibbs_niter, | ||
int | flag_check, | ||
int | flag_ce, | ||
int | flag_cstd, | ||
int | verbose | ||
) |
Perform the conditional simulations under inequality constraints
[in] | dbin | Input Db structure (optional) |
[in] | dbout | Output Db structure |
[in] | model | Model structure |
[in] | seed | Seed for random number generator |
[in] | nbsimu | Number of simulations |
[in] | nbtuba | Number of turning bands |
[in] | gibbs_nburn | Initial number of iterations for bootstrapping |
[in] | gibbs_niter | Maximum number of iterations |
[in] | flag_check | 1 to check the proximity in Gaussian scale |
[in] | flag_ce | 1 if the conditional expectation should be returned instead of simulations |
[in] | flag_cstd | 1 if the conditional standard deviation should be returned instead of simulations |
[in] | verbose | Verbose flag |
int simmaxstable | ( | Db * | dbout, |
Model * | model, | ||
double | ratio, | ||
int | seed, | ||
int | nbtuba, | ||
int | flag_simu, | ||
int | flag_rank, | ||
int | verbose | ||
) |
Perform the non-conditional simulation of the Max-Stable Model
[in] | dbout | Output Db structure |
[in] | model | Model structure |
[in] | ratio | Ratio modifying the range at each iteration |
[in] | seed | Seed for random number generator |
[in] | nbtuba | Number of turning bands |
[in] | flag_simu | 1 if the simulation must be stored |
[in] | flag_rank | 1 if the iteration rank must be stored |
[in] | verbose | Verbose flag |
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
[in] | dbin | Input Db structure (optional) |
[in] | dbout | Output Db structure |
[in] | ruleprop | RuleProp structure |
[in] | model1 | First Model structure |
[in] | model2 | Second Model structure (optional) |
[in] | neigh | ANeigh structure |
[in] | nbsimu | Number of simulations |
[in] | seed | Seed for random number generator |
[in] | flag_gaus | 1 if results must be gaussian; otherwise facies |
[in] | flag_prop | 1 for facies proportion |
[in] | flag_check | 1 if the facies at data must be checked against the closest simulated grid node |
[in] | flag_show | 1 if the grid node which coincides with the data should be represented with the data facies (only if flag_cond && !flag_gaus) |
[in] | nbtuba | Number of turning bands |
[in] | gibbs_nburn | Number of bootstrap iterations |
[in] | gibbs_niter | Maximum number of iterations |
[in] | percent | Amount of nugget effect added to too much continous model (expressed in percentage of the total variance) |
[in] | namconv | Naming convention |
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
[in] | dbin | Input Db structure (optional) |
[in] | dbout | Output Db structure |
[in] | ruleprop | RuleProp definition |
[in] | model1 | First Model structure |
[in] | model2 | Second Model structure (optional) |
[in] | triswitch | Meshing option |
[in] | gext | Array of domain dilation |
[in] | flag_gaus | 1 if results must be gaussian; otherwise facies |
[in] | flag_prop | 1 for facies proportion |
[in] | flag_check | 1 if the facies at data must be checked against the closest simulated grid node |
[in] | flag_show | 1 if the grid node which coincides with the data should be represented with the data facies |
[in] | nfacies | Number of facies |
[in] | seed | Seed for random number generator |
[in] | nbsimu | Number of simulations |
[in] | gibbs_nburn | Number of iterations (Burning step) |
[in] | gibbs_niter | Maximum number of iterations |
[in] | ngibbs_int | Number of iterations internal to Gibbs (SPDE) |
[in] | verbose | Verbose flag |
[in] | percent | Amount of nugget effect added to too continous model (expressed in percentage of the total variance) |
int simRI | ( | Db * | dbout, |
Model * | model, | ||
int | ncut, | ||
double * | zcut, | ||
double * | wcut, | ||
int | seed, | ||
int | nbtuba, | ||
int | verbose | ||
) |
Perform the non-conditional simulation of the Orthogonal Residual Model
int simsph | ( | DbGrid * | db, |
Model * | model, | ||
const SimuSphericalParam & | sphepar, | ||
int | seed, | ||
bool | verbose, | ||
const NamingConvention & | namconv | ||
) |
Simulates the random function on the sphere
[in] | db | Data base containing the coordinates of target points These coordinates must be expressed in long/lat |
[in] | model | Model (defined in Euclidean space) to be used |
[in] | sphepar | SimuSphericalParam structure |
[in] | seed | Seed for random number generation |
[in] | verbose | Verbose flag |
[in] | namconv | Naming convention |
VectorDouble simsph_mesh | ( | MeshSpherical * | mesh, |
Model * | model, | ||
const SimuSphericalParam & | sphepar, | ||
int | seed, | ||
int | verbose | ||
) |
Simulates the random function on the sphere
[in] | mesh | MeshSpherical object |
[in] | model | Model (defined in Euclidean space) to be used |
[in] | sphepar | SimuSphericalParam structure |
[in] | seed | Seed for random number generation |
[in] | verbose | Verbose flag |
int simtub_constraints | ( | Db * | dbin, |
Db * | dbout, | ||
Model * | model, | ||
ANeigh * | neigh, | ||
int | seed, | ||
int | nbtuba, | ||
int | nbsimu_min, | ||
int | nbsimu_quant, | ||
int | niter_max, | ||
VectorInt & | cols, | ||
int(*)(int flag_grid, int nDim, int nech, int *nx, double *dx, double *x0, double nonval, double percent, VectorDouble &tab) | func_valid | ||
) |
Perform a set of valid conditional or non-conditional simulations
[in] | dbin | Input Db structure (optional) |
[in] | dbout | Output Db structure |
[in] | model | Model structure |
[in] | neigh | ANeigh structure (optional) |
[in] | seed | Seed for random number generator |
[in] | nbtuba | Number of turning bands |
[in] | nbsimu_min | Minimum number of simulations |
[in] | nbsimu_quant | Additional quantum of simulations |
[in] | niter_max | Maximum number of iterations |
[in] | cols | Vector of column indices |
[in] | func_valid | Testing function |
void simu_func_categorical_scale | ( | Db * | db, |
int | verbose, | ||
int | nbsimu | ||
) |
Scaling function for the Modification categorical case
[in] | db | Db structure |
[in] | verbose | 1 for the verbose flag |
[in] | nbsimu | Number of simulations |
void simu_func_categorical_transf | ( | Db * | db, |
int | verbose, | ||
int | isimu, | ||
int | nbsimu | ||
) |
Transformation function for the Modification categorical case
[in] | db | Db structure |
[in] | verbose | 1 for the verbose flag |
[in] | isimu | Rank of the current simulation |
[in] | nbsimu | Number of simulations |
void simu_func_categorical_update | ( | Db * | db, |
int | verbose, | ||
int | isimu, | ||
int | nbsimu | ||
) |
Updating function for the Modification categorical case
[in] | db | Db structure |
[in] | verbose | 1 for the verbose flag |
[in] | isimu | Rank of the current simulation |
[in] | nbsimu | Number of simulations (stored) |
void simu_func_continuous_scale | ( | Db * | db, |
int | verbose, | ||
int | nbsimu | ||
) |
Scaling function for the Modification continuous case
[in] | db | Db structure |
[in] | verbose | 1 for the verbose flag |
[in] | nbsimu | Number of simulations |
void simu_func_continuous_update | ( | Db * | db, |
int | verbose, | ||
int | isimu, | ||
int | nbsimu | ||
) |
Updating function for the Modification continuous case
[in] | db | Db structure |
[in] | verbose | 1 for the verbose flag |
[in] | isimu | Rank of the current simulation |
[in] | nbsimu | Number of simulations (stored) |
|
static |
Check/Show the data against facies at the closest grid node
[in] | dbin | Input Db structure |
[in] | dbout | Output Db grid structure |
[in] | flag_check | 1 check the consistency between data and grid |
[in] | flag_show | 1 show the data on grid |
[in] | ipgs | Rank of the PGS |
[in] | nechin | Initial number of data |
[in] | nfacies | Number of facies |
[in] | nbsimu | Number of simulations |
|
static |
Give the rank of a proportion for a given GRF and PGS
[in] | propdef | PropDef structure |
[in] | ifac | Rank of the facies |
[in] | ipgs | Rank of the GS |
|
static |
|
static |
|
static |
|
static |
|
static |
Check if the sample belongs to the time slice
[in] | date | Date attached to a sample |
[in] | ntime | Number of time intervals |
[in] | time0 | Origin of the first time interval |
[in] | dtime | Time interval |
|
static |
Initialize the Gibbs internal parameters
[in] | rho | Correlation between the two underlying GRF |
|
static |
Check if the field must be kept
[in] | flag_gaus | 1 gaussian results; otherwise facies |
[in] | flag_prop | 1 for facies proportion |
[in] | file | DATA or RESULT |
[in] | type | 0 for gaussian; 1 for facies; 2 for proportion |
|
static |
Combine the simulations of the max-stable process
[in] | dbout | Output Db structure |
[in] | scale | Scaling factor for the new simulation |
[in] | iter0 | Rank of the current iteration |
[in] | iptrg | Pointer to the newly simulated outcome |
[in] | iptrv | Pointer to the max-stable outcome |
[in] | iptrr | Pointer to the max-stable rank outcome |
[in,out] | last | Rank of Iteration where the last grid node is covered |
|
static |
Mask the grid nodes whose value is already too large
[in] | dbout | Output Db structure |
[in] | seuil | Threshold |
[in] | scale | Scaling factor for the new simulation |
[in] | iptrv | Pointer to the max-stable outcome |
[in] | iptrs | Pointer to the current selection |
|
static |
Calculate the quantile for a given array
[in] | dbout | Output Db structure |
[in] | proba | Probability |
[out] | sort | Sorting array |
|
static |
Initialize the global values
|
static |
Suppresses the added samples
[in] | db | Db structure |
[in] | nech | initial number of samples |
|
static |
|
static |
|
static |