#include "geoslib_old_f.h"
#include "Polygon/Polygons.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/Grid.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Basic/Memory.hpp"
#include <math.h>
Functions | |
int | compat_NDIM (Db *db1, Db *db2) |
void | db_grid_print (Db *db) |
int | get_LOCATOR_NITEM (const Db *db, const ELoc &locatorType) |
double | distance_inter (const Db *db1, const Db *db2, int iech1, int iech2, double *dist_vect) |
double | distance_intra (const Db *db, int iech1, int iech2, double *dist_vect) |
double | distance_grid (DbGrid *db, int flag_moins1, int iech1, int iech2, double *dist_vect) |
void | db_sample_print (Db *db, int iech, int flag_ndim, int flag_nvar, int flag_nerr) |
int | db_center (Db *db, double *center) |
int | db_grid_define_coordinates (DbGrid *db) |
int | db_gradient_update (Db *db) |
int | db_selref (int ndim, const int *nx, const int *ref, const double *tabin, double *tabout) |
int | db_locator_attribute_add (Db *db, const ELoc &locatorType, int number, int r_tem, double valinit, int *iptr) |
int | db_grid_copy (DbGrid *db1, DbGrid *db2, const int *ind1, const int *ind2, int ncol, int *cols) |
int | db_grid_copy_dilate (DbGrid *db1, int iatt1, DbGrid *db2, int iatt2, int mode, const int *nshift) |
int | point_to_point (Db *db, const double *coor) |
int | point_to_grid (const DbGrid *db, const double *coor, int flag_outside, int *indg) |
int | point_to_bench (const DbGrid *db, double *coor, int flag_outside, int *indb) |
int | index_point_to_grid (const Db *dbin, int iech, int flag_outside, const DbGrid *dbout, double *coor) |
int | point_inside_grid (Db *db, int iech, const DbGrid *dbgrid) |
void | db_monostat (Db *db, int iatt, double *wtot, double *mean, double *var, double *mini, double *maxi) |
int | db_proportion (Db *db, DbGrid *dbgrid, int nfac1max, int nfac2max, int *nclout) |
int | db_merge (Db *db, int ncol, int *cols) |
void | db_locators_correct (VectorString &strings, const VectorInt ¤t, int flag_locnew) |
int | db_prop_read (DbGrid *db, int ix, int iy, double *props) |
int | db_prop_write (DbGrid *db, int ix, int iy, double *props) |
double * | db_distances_general (Db *db1, Db *db2, int niso, int mode, int flag_same, int *n1, int *n2, double *dmin, double *dmax) |
int | is_grid_multiple (DbGrid *db1, DbGrid *db2) |
int | db_gradient_modang_to_component (Db *db, int ang_conv, int iad_mod, int iad_ang, int iad_gx, int iad_gy) |
int | db_gradient_component_to_modang (Db *db, int verbose, int iad_gx, int iad_gy, int iad_mod, int iad_ang, double scale, double ve) |
double | get_grid_value (DbGrid *dbgrid, int iptr, VectorInt &indg, int ix, int iy, int iz) |
void | set_grid_value (DbGrid *dbgrid, int iptr, VectorInt &indg, int ix, int iy, int iz, double value) |
DbGrid * | db_grid_reduce (DbGrid *db_grid, int iptr, const int *margin, const int *limmin, int flag_sel, int flag_copy, int verbose, double vmin, double vmax) |
int | db_grid_patch (DbGrid *ss_grid, DbGrid *db_grid, int iptr_ss, int iptr_db, int iptr_rank, int new_rank, int oper, int verbose) |
int | db_name_identify (Db *db, const String &string) |
static void | st_rotate (int ndim, double *rotmat, VectorDouble &coor, VectorDouble &mini, VectorDouble &maxi) |
void | db_extension_rotated (Db *db, double *rotmat, VectorDouble &mini, VectorDouble &maxi) |
void | grid_iterator_init (Grid *grid, const VectorInt &order) |
VectorInt | grid_iterator_next (Grid *grid) |
Checks if Space Dimension of the first Db is at least equal to the Space dimension of the second Db
int db_center | ( | Db * | db, |
double * | center | ||
) |
double* db_distances_general | ( | Db * | db1, |
Db * | db2, | ||
int | niso, | ||
int | mode, | ||
int | flag_same, | ||
int * | n1, | ||
int * | n2, | ||
double * | dmin, | ||
double * | dmax | ||
) |
Evaluate the array of distances between samples of two data sets Takes the selection into account (if any)
[in] | db1 | Db first descriptor |
[in] | db2 | Db second descriptor |
[in] | niso | Number of variables tested for isotopy |
[in] | mode | Type of array returned 0 : extreme distances 1 : the distance to the closest sample 2 : all point-to-point distances |
[in] | flag_same | 1 if both Db coincide |
[out] | n1 | First dimension of the returned array |
[out] | n2 | Second dimension of the returned array |
[out] | dmin | Minimum distance |
[out] | dmax | Maximum distance |
void db_extension_rotated | ( | Db * | db, |
double * | rotmat, | ||
VectorDouble & | mini, | ||
VectorDouble & | maxi | ||
) |
Returns the extension of the field (after rotation) along each axis
[in] | db | Db structure |
[in] | rotmat | Rotation matrix (optional) |
[out] | mini | Array containing the minimum (Dimension = ndim) |
[out] | maxi | Array containing the maximum (Dimension = ndim) |
int db_gradient_component_to_modang | ( | Db * | db, |
int | verbose, | ||
int | iad_gx, | ||
int | iad_gy, | ||
int | iad_mod, | ||
int | iad_ang, | ||
double | scale, | ||
double | ve | ||
) |
Transform a set of gradients defined by (gx,gy) into (module,angle) Only defined in the 2-D case
[in] | db | Initial Db |
[in] | verbose | 1 for the verbose option |
[in] | iad_gx | Rank of the 'gx' attribute (defined in degrees) |
[in] | iad_gy | Rank of the 'gy' attribute (defined in degrees) |
[in] | iad_mod | Rank of the 'modulus' attribute |
[in] | iad_ang | Rank of the 'angle' attribute (defined in degrees) |
[in] | scale | Scaling factor for the modulus |
[in] | ve | Moderation factor |
int db_gradient_modang_to_component | ( | Db * | db, |
int | ang_conv, | ||
int | iad_mod, | ||
int | iad_ang, | ||
int | iad_gx, | ||
int | iad_gy | ||
) |
Transform a set of gradients defined by (modulus,angle) into (gx,gy) Only defined in the 2-D case
[in] | db | Initial Db |
[in] | ang_conv | Convention on the angles
|
[in] | iad_mod | Rank of the 'modulus' attribute |
[in] | iad_ang | Rank of the 'angle' attribute (defined in degrees) |
[in] | iad_gx | Rank of the 'gx' attribute (defined in degrees) |
[in] | iad_gy | Rank of the 'gy' attribute (defined in degrees) |
int db_gradient_update | ( | Db * | db | ) |
Update the Data Base for Kriging with Gradient components This update is limited to the 2-D Monovariate case
[in] | db | Input/output Db |
int db_grid_copy | ( | DbGrid * | db1, |
DbGrid * | db2, | ||
const int * | ind1, | ||
const int * | ind2, | ||
int | ncol, | ||
int * | cols | ||
) |
int db_grid_copy_dilate | ( | DbGrid * | db1, |
int | iatt1, | ||
DbGrid * | db2, | ||
int | iatt2, | ||
int | mode, | ||
const int * | nshift | ||
) |
int db_grid_define_coordinates | ( | DbGrid * | db | ) |
int db_grid_patch | ( | DbGrid * | ss_grid, |
DbGrid * | db_grid, | ||
int | iptr_ss, | ||
int | iptr_db, | ||
int | iptr_rank, | ||
int | new_rank, | ||
int | oper, | ||
int | verbose | ||
) |
Patch a sub-grid within a main grid
[in] | ss_grid | Db sub-grid structure |
[in] | db_grid | Db main grid structure |
[in] | iptr_ss | Rank of the attribute in the sub-grid |
[in] | iptr_db | Rank of the attribute in the main grid |
[in] | iptr_rank | Rank of the attribute storing object rank If <0, no check is performed: always patch |
[in] | new_rank | Rank of the current object to patch in main grid |
[in] | oper | >0 for larger; <0 for smaller |
[in] | verbose | Verbose flag |
void db_grid_print | ( | Db * | db | ) |
DbGrid* db_grid_reduce | ( | DbGrid * | db_grid, |
int | iptr, | ||
const int * | margin, | ||
const int * | limmin, | ||
int | flag_sel, | ||
int | flag_copy, | ||
int | verbose, | ||
double | vmin, | ||
double | vmax | ||
) |
Extract the subgrid (from a grid) which contains the only cells where the target variable lies wuthin the target interval Selection in the input grid is taken into account
[in] | db_grid | Db structure |
[in] | iptr | Rank of the column of the target variable |
[in] | margin | Array of margins (or NULL) |
[in] | limmin | Array of minimum dimensions (or NULL) |
[in] | flag_sel | Create the selection |
[in] | flag_copy | 1 if the selection must be copied in sub-grid |
[in] | verbose | Verbose flag |
[in] | vmin | Lower bound (included) |
[in] | vmax | Upper bound (excluded) |
int db_locator_attribute_add | ( | Db * | db, |
const ELoc & | locatorType, | ||
int | number, | ||
int | r_tem, | ||
double | valinit, | ||
int * | iptr | ||
) |
Add and initiate several attributes corresponding to a given locator
[in] | db | Db structure |
[in] | locatorType | Rank of the Pointer (ELoc) |
[in] | number | Number of locators to be defined |
[in] | r_tem | Rank of the first item in the pointer |
[in] | valinit | Value to be used for initialization |
[out] | iptr | Rank of the first new attribute |
void db_locators_correct | ( | VectorString & | strings, |
const VectorInt & | current, | ||
int | flag_locnew | ||
) |
int db_merge | ( | Db * | db, |
int | ncol, | ||
int * | cols | ||
) |
void db_monostat | ( | Db * | db, |
int | iatt, | ||
double * | wtot, | ||
double * | mean, | ||
double * | var, | ||
double * | mini, | ||
double * | maxi | ||
) |
Monovariate statistics
[in] | db | Db structure |
[in] | iatt | Rank of the attribute |
[out] | wtot | Sum of the weights |
[out] | mean | Mean of the variable |
[out] | var | variance of the variable |
[out] | mini | Minimum value |
[out] | maxi | Maximum value |
Identify the attribute by its name
[in] | db | Db descriptor |
[in] | string | attribute name |
int db_prop_read | ( | DbGrid * | db, |
int | ix, | ||
int | iy, | ||
double * | props | ||
) |
int db_prop_write | ( | DbGrid * | db, |
int | ix, | ||
int | iy, | ||
double * | props | ||
) |
Calculates the proportions of facies within a grid
[in] | db | Input Db structure |
[in] | dbgrid | Output Grid Db structure |
[in] | nfac1max | Maximum number of facies for the first variable |
[in] | nfac2max | Maximum number of facies for the second variable |
[out] | nclout | Total number of classes |
void db_sample_print | ( | Db * | db, |
int | iech, | ||
int | flag_ndim, | ||
int | flag_nvar, | ||
int | flag_nerr | ||
) |
Print a sample
[in] | db | Db structure |
[in] | iech | Rank of the sample |
[in] | flag_ndim | 1 if the coordinates must be printed |
[in] | flag_nvar | 1 if the variables must be printed |
[in] | flag_nerr | 1 if the error measurement variance must be printed |
int db_selref | ( | int | ndim, |
const int * | nx, | ||
const int * | ref, | ||
const double * | tabin, | ||
double * | tabout | ||
) |
double distance_grid | ( | DbGrid * | db, |
int | flag_moins1, | ||
int | iech1, | ||
int | iech2, | ||
double * | dist_vect | ||
) |
Calculates the distance between two points in the same grid Db
[in] | db | Db structure |
[in] | flag_moins1 | 1 to use the cell center |
[in] | iech1 | rank of the first sample |
[in] | iech2 | rank of the second sample |
[out] | dist_vect | If the output vector is provided. Returns the distance as a vector |
Calculates the distance between two points
[in] | db1 | Db structure for the first sample |
[in] | db2 | Db structure for the second sample |
[in] | iech1 | rank of the first sample |
[in] | iech2 | rank of the second sample |
[out] | dist_vect | If the output vector is provided. Returns the distance as a vector |
double distance_intra | ( | const Db * | db, |
int | iech1, | ||
int | iech2, | ||
double * | dist_vect | ||
) |
Calculates the distance between two points in the same Db
[in] | db | Db structure |
[in] | iech1 | rank of the first sample |
[in] | iech2 | rank of the second sample |
[out] | dist_vect | If the output vector is provided. Returns the distance as a vector |
Returns a value from the a 3-D (maximum) grid
int get_LOCATOR_NITEM | ( | const Db * | db, |
const ELoc & | locatorType | ||
) |
Returns 1 when the last element of the iteration is reached
Increment the Grid iterator
int index_point_to_grid | ( | const Db * | dbin, |
int | iech, | ||
int | flag_outside, | ||
const DbGrid * | dbout, | ||
double * | coor | ||
) |
Find the index of the output grid file which is the closest to the sample of the input file
[in] | dbin | descriptor of the input file |
[in] | iech | Index of the data point |
[in] | flag_outside | value returned for the point outside the grid
|
[in] | dbout | descriptor of the output grid file |
[out] | coor | Working array (dimension: ndim) |
Check if a grid is a multiple of the other grid
[in] | db1 | Db1 small grid structure |
[in] | db2 | Db1 coarse grid structure |
int point_to_bench | ( | const DbGrid * | db, |
double * | coor, | ||
int | flag_outside, | ||
int * | indb | ||
) |
Converts from point coordinates to index of the bench to which it belongs
[in] | db | descriptor of the grid parameters |
[in] | coor | array of coordinates of the point |
[in] | flag_outside | value returned for the point outside the grid
|
[out] | indb | index of the bench |
int point_to_grid | ( | const DbGrid * | db, |
const double * | coor, | ||
int | flag_outside, | ||
int * | indg | ||
) |
Converts from point coordinates to nearest grid node indices
[in] | db | descriptor of the grid parameters |
[in] | coor | array of coordinates of the point |
[in] | flag_outside | value returned for the point outside the grid
|
[out] | indg | indices of the closest grid node |
int point_to_point | ( | Db * | db, |
const double * | coor | ||
) |
Returns the rank of the closest isolated point
[in] | db | descriptor of the Db |
[in] | coor | array of coordinates of the point |
void set_grid_value | ( | DbGrid * | dbgrid, |
int | iptr, | ||
VectorInt & | indg, | ||
int | ix, | ||
int | iy, | ||
int | iz, | ||
double | value | ||
) |
Set the value in the a 3-D (maximum) grid
|
static |