gstlearn
1.0.0
CCC
|
#include "geoslib_f.h"
#include "geoslib_old_f.h"
#include "geoslib_f_private.h"
#include "Enum/EJustify.hpp"
#include "Mesh/MeshETurbo.hpp"
#include "LinearOp/ShiftOpCs.hpp"
#include "LinearOp/PrecisionOp.hpp"
#include "LinearOp/ProjMatrix.hpp"
#include "LinearOp/OptimCostColored.hpp"
#include "Stats/Classical.hpp"
#include "Morpho/Morpho.hpp"
#include "Covariances/CovAniso.hpp"
#include "Model/ANoStat.hpp"
#include "Model/NoStatArray.hpp"
#include "Model/Model.hpp"
#include "Model/CovInternal.hpp"
#include "Db/Db.hpp"
#include "Basic/Law.hpp"
#include "Basic/NamingConvention.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/String.hpp"
#include "Basic/File.hpp"
#include "Basic/VectorHelper.hpp"
#include "Basic/PolyLine2D.hpp"
#include "Basic/OptDbg.hpp"
#include "Polygon/Polygons.hpp"
#include "Skin/ISkinFunctions.hpp"
#include "Skin/Skin.hpp"
#include "Geometry/GeometryHelper.hpp"
#include "Tree/Ball.hpp"
#include "Tree/KNN.hpp"
#include <math.h>
#include <string.h>
Classes | |
class | LocalSkin |
Functions | |
int | migrate_grid_to_coor (const DbGrid *db_grid, int iatt, const VectorVectorDouble &coords, VectorDouble &tab) |
int | expand_point_to_coor (const Db *db1, int iatt, const VectorVectorDouble &coords, VectorDouble &tab) |
int | db_tool_duplicate (Db *db1, Db *db2, bool flag_same, bool verbose, int opt_code, double tolcode, const VectorDouble &dist, VectorDouble &sel) |
int | db_duplicate (Db *db, bool verbose, const VectorDouble &dist, int opt_code, double tolcode, const NamingConvention &namconv) |
int | surface (Db *db_point, DbGrid *db_grid, int, double dlim, double *dtab, double *gtab) |
int | db_edit (Db *db, int *flag_valid) |
int | db_normalize (Db *db, const char *oper, int ncol, int *cols, double center, double stdv) |
int | db_grid_fill (DbGrid *dbgrid, int mode, int seed, int radius, bool verbose, const NamingConvention &namconv) |
int | _db_category (Db *db, int iatt, const VectorDouble &mini, const VectorDouble &maxi, const VectorBool &incmini, const VectorBool &incmaxi, const NamingConvention &namconv) |
int | _db_indicator (Db *db, int iatt, int flag_indic, const VectorDouble &mini, const VectorDouble &maxi, const VectorBool &incmini, const VectorBool &incmaxi, bool flagBelow, bool flagAbove, const NamingConvention &namconv) |
VectorDouble | _db_limits_statistics (Db *db, int iatt, const VectorDouble &mini, const VectorDouble &maxi, const VectorBool &incmini, const VectorBool &incmaxi, int optionStat, bool flagBelow, bool flagAbove) |
int | interpolate_variable_to_point (DbGrid *db_grid, int iatt, int np, double *xp, double *yp, double *zp, double *tab) |
void | ut_trace_discretize (int nseg, double *trace, double disc, int *np_arg, double **xp_arg, double **yp_arg, double **dd_arg, double **del_arg, double *dist_arg) |
void | ut_trace_sample (Db *db, const ELoc &ptype, int np, double *xp, double *yp, double *dd, double radius, int *ns_arg, double **xs_arg, double **ys_arg, int **rks_arg, int **lys_arg, int **typ_arg) |
int | manage_external_info (int mode, const ELoc &locatorType, Db *dbin, Db *dbout, int *istart) |
int | manage_nostat_info (int mode, Model *model, Db *dbin, Db *dbout) |
int | db_center_point_to_grid (Db *db_point, DbGrid *db_grid, double eps_random) |
DbGrid * | db_grid_sample (DbGrid *dbin, const VectorInt &nmult) |
int | st_next_sample (int ip0_init, int np, const VectorInt &order, const VectorDouble &xtab, double xtarget) |
int | expand_point_to_grid (Db *db_point, DbGrid *db_grid, int iatt, int iatt_time, int iatt_angle, int iatt_scaleu, int iatt_scalev, int iatt_scalew, int flag_index, int distType, const VectorDouble &dmax, VectorDouble &tab) |
int | db_compositional_transform (Db *db, int verbose, int mode, int type, int number, int *iatt_in, int *iatt_out, int *numout) |
int | points_to_block (Db *dbpoint, DbGrid *dbgrid, int option, int flag_size, int iatt_time, int iatt_size, int iatt_angle, int iatt_scaleu, int iatt_scalev, int iatt_scalew) |
int | db_resind (Db *db, int ivar, int ncut, double *zcut) |
int | db_gradient_components (DbGrid *dbgrid) |
int | db_streamline (DbGrid *dbgrid, Db *dbpoint, int niter, double step, int flag_norm, int use_grad, int save_grad, int *nbline_loc, int *npline_loc, double **line_loc) |
int | db_model_nostat (Db *db, Model *model, int icov, const NamingConvention &namconv) |
int | db_smooth_vpc (DbGrid *db, int width, double range) |
Db * | db_extract (Db *db, int *ranks) |
Db * | db_regularize (Db *db, DbGrid *dbgrid, int flag_center) |
double * | db_grid_sampling (DbGrid *dbgrid, double *x1, double *x2, int ndisc, int ncut, double *cuts, int *nval_ret) |
int | db_grid2point_sampling (DbGrid *dbgrid, int nvar, int *vars, int *npacks, int npcell, int nmini, int *nech_ret, double **coor_ret, double **data_ret) |
Db * | db_point_init (int nech, const VectorDouble &coormin, const VectorDouble &coormax, DbGrid *dbgrid, bool flag_exact, bool flag_repulsion, double range, double beta, double extend, int seed, int flag_add_rank) |
int | db_grid1D_fill (DbGrid *dbgrid, int mode, int seed, const NamingConvention &namconv) |
int | _migrate (Db *db1, Db *db2, int iatt1, int iatt2, int distType, const VectorDouble &dmax, bool flag_fill, bool flag_inter, bool flag_ball) |
int | db_proportion_estimate (Db *dbin, DbGrid *dbout, Model *model, int niter, bool verbose, const NamingConvention &namconv) |
int _db_category | ( | Db * | db, |
int | iatt, | ||
const VectorDouble & | mini, | ||
const VectorDouble & | maxi, | ||
const VectorBool & | incmini, | ||
const VectorBool & | incmaxi, | ||
const NamingConvention & | namconv | ||
) |
Convert the contents of the ivar-th continuous variable into a categorical array
[in] | db | Db structure |
[in] | iatt | Rank of the attribute |
[in] | mini | Array containing the minima per class |
[in] | maxi | Array containing the maxima per class |
[in] | incmini | Array containing the inclusive flag for minima per class |
[in] | incmaxi | Array containing the inclusive flag for maxima per class |
[in] | namconv | Naming convention |
int _db_indicator | ( | Db * | db, |
int | iatt, | ||
int | flag_indic, | ||
const VectorDouble & | mini, | ||
const VectorDouble & | maxi, | ||
const VectorBool & | incmini, | ||
const VectorBool & | incmaxi, | ||
bool | flagBelow, | ||
bool | flagAbove, | ||
const NamingConvention & | namconv | ||
) |
Create indicator variables
[in] | db | Db structure |
[in] | iatt | Rank of the target variable |
[in] | flag_indic | Type of variable(s) to be stored: 1 the indicator variable 0 the mean variable per class |
[in] | mini | Array containing the minima per class |
[in] | maxi | Array containing the maxima per class |
[in] | incmini | Array containing the inclusive flag for minima per class |
[in] | incmaxi | Array containing the inclusive flag for maxima per class |
[in] | flagBelow | If True, consider the values below the lower bound |
[in] | flagAbove | If True, consider the values above the upper bound |
[in] | namconv | Naming convention |
VectorDouble _db_limits_statistics | ( | Db * | db, |
int | iatt, | ||
const VectorDouble & | mini, | ||
const VectorDouble & | maxi, | ||
const VectorBool & | incmini, | ||
const VectorBool & | incmaxi, | ||
int | optionStat, | ||
bool | flagBelow, | ||
bool | flagAbove | ||
) |
Calculate statistics per class
[in] | db | Db structure |
[in] | iatt | Rank of the target variable |
[in] | mini | Array containing the minima per class |
[in] | maxi | Array containing the maxima per class |
[in] | incmini | Array containing the inclusive flag for minima per class |
[in] | incmaxi | Array containing the inclusive flag for maxima per class |
[in] | optionStat | 1 for Proportions; 2 for Mean |
[in] | flagBelow | If True, consider the values below the lower bound |
[in] | flagAbove | If True, consider the values above the upper bound |
int _migrate | ( | Db * | db1, |
Db * | db2, | ||
int | iatt1, | ||
int | iatt2, | ||
int | distType, | ||
const VectorDouble & | dmax, | ||
bool | flag_fill, | ||
bool | flag_inter, | ||
bool | flag_ball | ||
) |
Migrates a variable from one Db to another one
[in] | db1 | descriptor of the input Db |
[in] | db2 | descriptor of the output Db |
[in] | iatt1 | Attribute in Db1 to be migrated |
[in] | iatt2 | Attribute in Db2 where the result must be stored |
[in] | distType | Type of distance for calculating maximum distance 1 for L1 and 2 for L2 distance |
[in] | dmax | Array of maximum distances (optional) |
[in] | flag_fill | Filling option |
[in] | flag_inter | Interpolation |
[in] | flag_ball | Use the BallTree sort for speeding up calculations |
Centers the samples of a Db to the center of blocks of a grid Db
[in] | db_point | descriptor of the point parameters |
[in] | db_grid | descriptor of the grid parameters |
[in] | eps_random | Randomisation Epsilon |
int db_compositional_transform | ( | Db * | db, |
int | verbose, | ||
int | mode, | ||
int | type, | ||
int | number, | ||
int * | iatt_in, | ||
int * | iatt_out, | ||
int * | numout | ||
) |
Translate a set of compositional variables into auxiliary variables
[in] | db | Db characteristics |
[in] | verbose | 1 for a Verbose option |
[in] | mode | 1 for Forward and -1 for Backward transformation |
[in] | type | Type of conversion
|
[in] | number | Number of input attributes |
[in] | iatt_in | Array of the input attribute |
[in] | iatt_out | Array of the output attribute |
[out] | numout | Number of variables in output |
int db_duplicate | ( | Db * | db, |
bool | verbose, | ||
const VectorDouble & | dist, | ||
int | opt_code, | ||
double | tolcode, | ||
const NamingConvention & | namconv | ||
) |
Look for duplicates within a Db
[in] | db | Db Structure |
[in] | verbose | True for verbose output |
[in] | dist | Array of the minimum distance |
[in] | opt_code | code selection option (if code is defined)
|
[in] | tolcode | Code tolerance |
[in] | namconv | Naming convention |
int db_edit | ( | Db * | db, |
int * | flag_valid | ||
) |
Extract a new Db from an old Db using a sample seleciton vector
[in] | db | Initial Db |
[in] | ranks | Vector of selected ranks |
int db_gradient_components | ( | DbGrid * | dbgrid | ) |
Calculate the gradient over a grid
[in] | dbgrid | Db structure (grid organized) |
int db_grid1D_fill | ( | DbGrid * | dbgrid, |
int | mode, | ||
int | seed, | ||
const NamingConvention & | namconv | ||
) |
Fill an incomplete 1-D grid
[in] | dbgrid | Db grid structure |
[in] | mode | Type of interpolation
|
[in] | seed | Seed used for the random number generation |
[in] | namconv | Naming convention |
int db_grid2point_sampling | ( | DbGrid * | dbgrid, |
int | nvar, | ||
int * | vars, | ||
int * | npacks, | ||
int | npcell, | ||
int | nmini, | ||
int * | nech_ret, | ||
double ** | coor_ret, | ||
double ** | data_ret | ||
) |
Sampling a fine grid in a coarser set of cells
[in] | dbgrid | reference Grid |
[in] | nvar | Number of variables |
[in] | vars | Array of variable ranks |
[in] | npacks | Vector of packing factors |
[in] | npcell | Number of samples per cell |
[in] | nmini | Minimum number of nodes before drawing |
[out] | nech_ret | Number of selected samples |
[out] | coor_ret | Array of coordinates |
[out] | data_ret | Array of variables |
int db_grid_fill | ( | DbGrid * | dbgrid, |
int | mode, | ||
int | seed, | ||
int | radius, | ||
bool | verbose, | ||
const NamingConvention & | namconv | ||
) |
Fill an incomplete grid
[in] | dbgrid | Db grid structure |
[in] | mode | Type of interpolation
|
[in] | seed | Seed used for the random number generation |
[in] | radius | Radius of the neighborhood |
[in] | verbose | Verbose flag |
[in] | namconv | Naming convention |
Sample a grid into a finer subgrid (all variables)
[in] | dbin | Descriptor of the grid parameters |
[in] | nmult | Array of multiplicity coefficients |
double* db_grid_sampling | ( | DbGrid * | dbgrid, |
double * | x1, | ||
double * | x2, | ||
int | ndisc, | ||
int | ncut, | ||
double * | cuts, | ||
int * | nval_ret | ||
) |
Sampling vertices within a Grid between two points
[in] | dbgrid | reference Grid |
[in] | x1 | Array giving the coordinates of the first point |
[in] | x2 | Array giving the coordinates of the second point |
[in] | ndisc | Number of discretized points in the segment |
[in] | ncut | Number of cutoffs |
[in] | cuts | Array of cutoffs |
[out] | nval_ret | Number of samples in the output array |
int db_model_nostat | ( | Db * | db, |
Model * | model, | ||
int | icov, | ||
const NamingConvention & | namconv | ||
) |
Calculate and store new variables in the Db which contain the non-stationary Model component
[in] | db | Db structure |
[in] | model | Model structure |
[in] | icov | Rank of the Basic structure |
[in] | namconv | Naming convention |
int db_normalize | ( | Db * | db, |
const char * | oper, | ||
int | ncol, | ||
int * | cols, | ||
double | center, | ||
double | stdv | ||
) |
Normalize a set of variables
[in] | db | Db structure |
[in] | oper | Name of the operator
|
[in] | ncol | Number of variables |
[in] | cols | Ranks of the variables |
[in] | center | Theoretical Mean value |
[in] | stdv | Theoretical Standard Deviation value |
Db* db_point_init | ( | int | nech, |
const VectorDouble & | coormin, | ||
const VectorDouble & | coormax, | ||
DbGrid * | dbgrid, | ||
bool | flag_exact, | ||
bool | flag_repulsion, | ||
double | range, | ||
double | beta, | ||
double | extend, | ||
int | seed, | ||
int | flag_add_rank | ||
) |
Create a new Data Base with points generated at random
[in] | nech | Expected number of samples |
[in] | coormin | Vector of lower coordinates |
[in] | coormax | Vector of upper coordinates |
[in] | dbgrid | Descriptor of the Db grid parameters |
[in] | flag_exact | True if the number of samples is dran from Poisson |
[in] | flag_repulsion | Use repulsion (need: 'range' and 'beta') |
[in] | range | Repulsion range |
[in] | beta | Bending coefficient |
[in] | extend | Extension of the bounding box (when positive) |
[in] | seed | Seed for the random number generator |
[in] | flag_add_rank | 1 if the Rank must be generated in the output Db |
int db_proportion_estimate | ( | Db * | dbin, |
DbGrid * | dbout, | ||
Model * | model, | ||
int | niter, | ||
bool | verbose, | ||
const NamingConvention & | namconv | ||
) |
Standard Kriging
[in] | dbin | Input Db structure |
[in] | dbout | Output Db structure |
[in] | model | Model structure |
[in] | niter | Number of iterations |
[in] | verbose | Verbose flag |
[in] | namconv | Naming convention |
Regularize variables along vertical wells
[in] | db | Initial Db |
[in] | dbgrid | Reference Grid |
[in] | flag_center | When TRUE, the sample is centered in the layer to which it belongs |
int db_resind | ( | Db * | db, |
int | ivar, | ||
int | ncut, | ||
double * | zcut | ||
) |
int db_smooth_vpc | ( | DbGrid * | db, |
int | width, | ||
double | range | ||
) |
Smooth out the VPC
[in] | db | 3-D Db structure containing the VPCs |
[in] | width | Width of the Filter |
[in] | range | Range of the Gaussian Weighting Function |
int db_streamline | ( | DbGrid * | dbgrid, |
Db * | dbpoint, | ||
int | niter, | ||
double | step, | ||
int | flag_norm, | ||
int | use_grad, | ||
int | save_grad, | ||
int * | nbline_loc, | ||
int * | npline_loc, | ||
double ** | line_loc | ||
) |
Calculate the streamlines
[in] | dbgrid | Db structure (grid organized) |
[in] | dbpoint | Db structure for control points |
[in] | niter | Maximum number of iterations |
[in] | step | Progress step |
[in] | flag_norm | 1 if the gradients must be normalized |
[in] | use_grad | 1 if the existing gradients must be used 0 the gradients must be calculated here |
[in] | save_grad | 1 save the gradients generated in this function 0 delete gradients when calculated here |
[out] | nbline_loc | Number of streamline steps |
[out] | npline_loc | Number of values per line vertex |
[out] | line_loc | Array of streamline steps (Dimension: 5 * nbline) |
int db_tool_duplicate | ( | Db * | db1, |
Db * | db2, | ||
bool | flag_same, | ||
bool | verbose, | ||
int | opt_code, | ||
double | tolcode, | ||
const VectorDouble & | dist, | ||
VectorDouble & | sel | ||
) |
Look for duplicates
[in] | db1 | First Db |
[in] | db2 | Second Db |
[in] | flag_same | True if the two Db files are the same |
[in] | verbose | True for verbose output |
[in] | opt_code | code selection option (if code is defined)
|
[in] | tolcode | Code tolerance |
[in] | dist | Array of the minimum distance (or NULL) |
[out] | sel | Array containing the selection |
int expand_point_to_coor | ( | const Db * | db1, |
int | iatt, | ||
const VectorVectorDouble & | coords, | ||
VectorDouble & | tab | ||
) |
Expands a variable from one point Db into a variable at points defined by coordinate vectors (maximum 3D)
[in] | db1 | descriptor of the input parameters |
[in] | iatt | rank of the input attribute |
[in] | coords | Array of coordinates |
[out] | tab | Output array (Dimension: number of discretized points) |
int expand_point_to_grid | ( | Db * | db_point, |
DbGrid * | db_grid, | ||
int | iatt, | ||
int | iatt_time, | ||
int | iatt_angle, | ||
int | iatt_scaleu, | ||
int | iatt_scalev, | ||
int | iatt_scalew, | ||
int | flag_index, | ||
int | distType, | ||
const VectorDouble & | dmax, | ||
VectorDouble & | tab | ||
) |
Expands a variable from the point structure into a variable in the grid structure
[in] | db_point | Descriptor of the point parameters |
[in] | db_grid | Descriptor of the grid parameters |
[in] | iatt | Rank of the point attribute |
[in] | iatt_time | Optional variable for Time shift |
[in] | iatt_angle | Optional variable for anisotropy angle (around Z) |
[in] | iatt_scaleu | Optional variable for anisotropy scale factor (U) |
[in] | iatt_scalev | Optional variable for anisotropy scale factor (V) |
[in] | iatt_scalew | Optional variable for anisotropy scale factor (W) |
[in] | flag_index | 1 if the Index must be assigned to grid node 0 the 'iatt' attribute is assigned instead |
[in] | distType | Type of distance for calculating maximum distance 1 for L1 and 2 for L2 distance |
[in] | dmax | Array of maximum distances (optional) |
[out] | tab | Output array |
int interpolate_variable_to_point | ( | DbGrid * | db_grid, |
int | iatt, | ||
int | np, | ||
double * | xp, | ||
double * | yp, | ||
double * | zp, | ||
double * | tab | ||
) |
Interpolate a variable from a grid Db on discretization points
[in] | db_grid | Descriptor of the grid parameters |
[in] | iatt | Rank of the attribute in db_grid |
[in] | np | Number of discretized points |
[in] | xp | Array of first coordinates |
[in] | yp | Array of second coordinates |
[in] | zp | Array of third coordinates |
[out] | tab | Output array |
int manage_external_info | ( | int | mode, |
const ELoc & | locatorType, | ||
Db * | dbin, | ||
Db * | dbout, | ||
int * | istart | ||
) |
Derive the external information(s) from the Output db (if Grid) to the Input Db
int migrate_grid_to_coor | ( | const DbGrid * | db_grid, |
int | iatt, | ||
const VectorVectorDouble & | coords, | ||
VectorDouble & | tab | ||
) |
Migrates a variable from the grid structure into a variable at points defined by coordinate vectors
[in] | db_grid | descriptor of the grid parameters |
[in] | iatt | rank of the grid attribute |
[in] | coords | Array of coordinates (dimension: ndim, np) |
[out] | tab | Output array (Dimension: number of discretized points) |
int points_to_block | ( | Db * | dbpoint, |
DbGrid * | dbgrid, | ||
int | option, | ||
int | flag_size, | ||
int | iatt_time, | ||
int | iatt_size, | ||
int | iatt_angle, | ||
int | iatt_scaleu, | ||
int | iatt_scalev, | ||
int | iatt_scalew | ||
) |
Plunge a set of isolated points within a discretization grid in order to compute the voronoi of the points and derive:
[in] | dbpoint | Descriptor of the point parameters |
[in] | dbgrid | Descriptor of the grid parameters |
[in] | option | Connectivity option (0 for cross and 1 for block) |
[in] | flag_size | When 1, the border pixels report the border thickness When 0, the border pixels are painted in 1 |
[in] | iatt_time | Attribute of 'dbpoint'for Time shift (optional) |
[in] | iatt_size | Attribute of 'dbpoint' giving size (optional) |
[in] | iatt_angle | Optional variable for anisotropy angle (around Z) |
[in] | iatt_scaleu | Optional variable for anisotropy scale factor (U) |
[in] | iatt_scalev | Optional variable for anisotropy scale factor (V) |
[in] | iatt_scalew | Optional variable for anisotropy scale factor (W) |
int st_next_sample | ( | int | ip0_init, |
int | np, | ||
const VectorInt & | order, | ||
const VectorDouble & | xtab, | ||
double | xtarget | ||
) |
Calculate the (discretized) surface of influence
[in] | db_point | Db containing the data points |
[in] | db_grid | Db containing the discretization grid |
[in] | dlim | Maximum distance (TEST if not defined) |
[out] | dtab | Array containing the surface of influence (Dimension = Number of samples in db_point) |
[out] | gtab | Array containing the surface of influence of the polygon to which it belongs (or TEST) (Dimension = Number of samples in db_grid) |
void ut_trace_discretize | ( | int | nseg, |
double * | trace, | ||
double | disc, | ||
int * | np_arg, | ||
double ** | xp_arg, | ||
double ** | yp_arg, | ||
double ** | dd_arg, | ||
double ** | del_arg, | ||
double * | dist_arg | ||
) |
Generates the discretized points along the trace
[in] | nseg | Number of vertices along the trace |
[in] | trace | Array defining the trace (Dimension: 2 * nseg) |
[in] | disc | Discretization distance |
[out] | np_arg | Number of discretized points |
[out] | xp_arg | Array of first coordinates |
[out] | yp_arg | Array of second coordinates |
[out] | dd_arg | Array of distances between discretized points |
[out] | del_arg | Array of distances between vertices |
[out] | dist_arg | Total distance of the trace |
void ut_trace_sample | ( | Db * | db, |
const ELoc & | ptype, | ||
int | np, | ||
double * | xp, | ||
double * | yp, | ||
double * | dd, | ||
double | radius, | ||
int * | ns_arg, | ||
double ** | xs_arg, | ||
double ** | ys_arg, | ||
int ** | rks_arg, | ||
int ** | lys_arg, | ||
int ** | typ_arg | ||
) |
Sample the point Db close to discretized points of the trace
[in] | db | Db to be sampled |
[in] | ptype | Type of locator |
[in] | np | Number of discretized points |
[in] | xp | Array of first coordinates |
[in] | yp | Array of second coordinates |
[in] | dd | Array of distances |
[in] | radius | Neighborhood radius |
[out] | ns_arg | Number of sampled points |
[out] | xs_arg | Array of first coordinates of sampled points |
[out] | ys_arg | Array of second coordinates of sampled points |
[out] | rks_arg | Array of sample indices (starting from 1) |
[out] | lys_arg | Array of layer indices of sampled points |
[out] | typ_arg | Array of data type 1 for hard data in Z or TIME 2 for lower bound 3 for upper bound |