#include "geoslib_old_f.h"
#include "Morpho/Morpho.hpp"
#include "Basic/VectorNumT.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/Law.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Stats/Classical.hpp"
#include "Basic/Memory.hpp"
#include "Basic/Grid.hpp"
#include "Core/Keypair.hpp"
#include <math.h>
#include <string.h>
Functions | |
static double | st_extract_subgrid (int verbose, int flag_ffff, int iech0, int nech0, int ntot, DbGrid *dbgrid, int *ind0, int *ixyz, int *nxyz, double *numtab1, double *valtab1) |
static int | st_divide_by_2 (int *nxyz, int orient) |
static void | st_mean_arith (int idim, const int *nxyz1, const int *nxyz2, const double *numtab1, double *numtab2, double *valtab1, double *valtab2) |
static void | st_mean_harmo (int idim, const int *nxyz1, const int *nxyz2, const double *numtab1, double *numtab2, double *valtab1, double *valtab2) |
static int | st_recopy (const int *nxyz1, const double *numtab1, const double *valtab1, int *nxyz2, double *numtab2, double *valtab2) |
static void | st_print_grid (const char *subtitle, int nxyz[3], double *numtab, double *valtab) |
static void | st_print_upscale (const char *title, int *nxyz, const double *valtab) |
static void | st_upscale (int orient, int *nxyz, int flag_save, double *numtab0, double *numtab1, double *numtab2, double *valtab0, double *valtab1, double *valtab2, double *res1, double *res2) |
static int | st_is_subgrid (int verbose, const char *title, DbGrid *dbgrid1, DbGrid *dbgrid2, int *ind0, int *nxyz, int *ntot) |
int | db_upscale (DbGrid *dbgrid1, DbGrid *dbgrid2, int orient, int verbose) |
static double | st_squared_distance (int orient, int ndim, const int *locini, const int *loccur) |
static void | st_sample_to_grid (int ndim, int ntot, const int *nxyz, int iech, int *indg) |
static int | st_grid_to_sample (int ndim, const int *nxyz, const int *indg) |
static int | st_fixed_position (int ntot, const double *tab, int cell) |
static int | st_find_cell (int ntot, const double *tab, double proba) |
static void | st_migrate_seed (int ndim, int n_nbgh, int *nxyz, const int *nbgh, double *valwrk, const double *valtab0, int *locwrk, int *loccur) |
static void | st_print_position (int ndim, int iseed, int iter, int *tab) |
static void | st_updiff (int orient, int ndim, int ntot, int nseed, int niter, int n_nbgh, int flag_save, double probtot, int *nxyz, int *nbgh, int *tabini, int *tabcur, int *tabwrk, double *valwrk, double *valtab0, int verbose, double *cvdist2, double *trsave) |
static void | st_update_regression (double x, double y, double *count, double *sum_x, double *sum_y, double *sum_xx, double *sum_xy) |
static double | st_get_diff_coeff (int niter, int verbose, double pmid, int flag_save, double *cvdist2, double *cvsave) |
int | db_diffusion (DbGrid *dbgrid1, DbGrid *dbgrid2, int orient, int niter, int nseed, int seed, int verbose) |
int | stats_residuals (int verbose, int nech, const double *tab, int ncut, double *zcut, int *nsorted, double *mean, double *residuals, double *T, double *Q) |
Variables | |
static int | DEBUG = 0 |
int db_diffusion | ( | DbGrid * | dbgrid1, |
DbGrid * | dbgrid2, | ||
int | orient, | ||
int | niter, | ||
int | nseed, | ||
int | seed, | ||
int | verbose | ||
) |
Calculate the diffusion factor from a grid Db into another grid Db
[in] | dbgrid1 | Db for the input grid |
[in] | dbgrid2 | Db for the output grid |
[in] | orient | Diffusion orientation (0 or the space rank dimension) |
[in] | niter | Number of iterations |
[in] | nseed | Number of seeds |
[in] | seed | Seed for the random number generation |
[in] | verbose | Verbose Option |
|
static |
Divide by 2 in integer (upper rounded value)
[in] | nxyz | Dimensions of the subgrid |
[in] | orient | Rank of the target direction |
|
static |
Load the subgrid from the Input Db
[in] | verbose | Verbose flag |
[in] | flag_ffff | 1 replace masked values by 0 0 replace masked values by FFFF |
[in] | iech0 | Rank of the output grid cell |
[in] | nech0 | Number of cells of the output grid |
[in] | ntot | Dimension of arrays 'numtab1' and 'valtab1' |
[in] | dbgrid | Db for the input grid |
[in] | ind0 | Origin of the Output Db within the Input Db |
[in] | nxyz | Mesh of the Output Db (expressed in Input Db) |
[in] | ixyz | Indices of the starting node of the Output Db |
[out] | numtab1 | Array containing the sample count |
[out] | valtab1 | Array containing the sample value |
|
static |
Find the cell linked to the probability
[in] | ntot | Number of possibilities |
[in] | tab | Array containing the sample value |
[in] | proba | Local probability |
|
static |
Find the location of the cell (within the possible cells) which is the closest to the target cell provided as argument
[in] | ntot | Number of possibilities |
[in] | tab | Array containing the sample value |
[in] | cell | Cell location |
|
static |
Derive the diffusion factor from the serie of squared distance as a function of time
|
static |
Converts from grid indices into sample index
[in] | ndim | Space dimension |
[in] | nxyz | Dimensions of the subgrid |
[in] | indg | Grid indices |
|
static |
Check if the first grid is a subgrid of the second one
|
static |
Perform the arithmetic mean
[in] | idim | Direction of calculation |
[in] | nxyz1 | Dimensions of the initial subgrid |
[in] | nxyz2 | Dimensions of the final subgrid |
[out] | numtab1 | Array containing the sample count |
[out] | numtab2 | Array containing the sample count |
[out] | valtab1 | Array containing the sample value |
[out] | valtab2 | Array containing the sample value |
|
static |
Perform the harmonic mean
[in] | idim | Direction of calculation |
[in] | nxyz1 | Dimensions of the initial subgrid |
[in] | nxyz2 | Dimensions of the final subgrid |
[out] | numtab1 | Array containing the input sample count |
[out] | numtab2 | Array containing the output sample count |
[out] | valtab1 | Array containing the input sample value |
[out] | valtab2 | Array containing the output sample value |
|
static |
Migrate the seed to one of the available neighboring cells
[in] | ndim | Space dimension |
[in] | n_nbgh | Number of neighboring cells |
[in] | nxyz | Dimensions of the subgrid |
[in] | nbgh | Array giving the neighboring cell location |
[in] | valwrk | Working array (Dimension: n_nbgh) |
[in] | valtab0 | Array containing the sample value |
[in] | locwrk | Working array for shifted seed positions |
[in,out] | loccur | Current seed position |
|
static |
|
static |
Print the position (debug option)
[in] | ndim | Space dimension |
[in] | iseed | Rank of the trajectory (from 0) |
[in] | iter | Rank of the iteration (from 0) |
[in] | tab | Array containing the coordinates of the position |
|
static |
|
static |
Update the dimensions and calculate the current number of cells
|
static |
Converts from sample index into grid indices
[in] | ndim | Space dimension |
[in] | ntot | Total number of cells in subgrid |
[in] | nxyz | Dimensions of the subgrid |
[in] | iech | Rank of the sample |
[out] | indg | Grid indices |
|
static |
Calculate the euclidean distance between current and initial seed locations
[in] | orient | Diffusion orientation (0 or the space rank dimension) |
[in] | ndim | Space dimension |
[in] | locini | Initial seed positions |
[in] | loccur | Current seed positions |
|
static |
Update the quantities needed for calculating the linear regression amongst a set of 2-D points
[in] | x | X value |
[in] | y | Y value |
[in,out] | count | Number of samples |
[in,out] | sum_x | Sum of the X variable |
[in,out] | sum_y | Sum of the Y variable |
[in,out] | sum_xx | Sum of the X*X variable |
[in,out] | sum_xy | Sum of the X*Y variable |
|
static |
Calculate the average squared distance as a function of the iteration
[in] | orient | Diffusion orientation (0 or the space rank dimension) |
[in] | ndim | Space dimension |
[in] | ntot | Total number of cells in the subgrid |
[in] | nseed | Number of seeds |
[in] | niter | Number of iterations |
[in] | n_nbgh | Number of neighboring cells |
[in] | flag_save | If the array must be saved for keypair |
[in] | probtot | Total probability of joins |
[in] | nxyz | Dimensions of the subgrid |
[in] | nbgh | Array giving the neighboring cell location |
[in] | tabini | Array of initial seed positions Dimension: nseed * ndim |
[in] | tabcur | Array of current seed positions Dimension: nseed * ndim |
[in] | tabwrk | Array of shifted seed positions Dimension: ndim |
[in] | valwrk | Working array Dimension: n_nbgh |
[in] | valtab0 | Array containing the sample value |
[in] | verbose | Verbose option |
[out] | cvdist2 | Array of squared distances by iteration |
[out] | trsave | Array of trajectories (saved only if defined) |
|
static |
Upscale the variable defined on a subgrid into one value
[in] | orient | Upscaling orientation (0 to 2) |
[in] | nxyz | Dimensions of the subgrid |
[in] | flag_save | If the array must be saved for keypair |
[out] | numtab0 | Array containing the sample count |
[out] | numtab1 | Array containing the sample count |
[out] | numtab2 | Array containing the sample count |
[out] | valtab0 | Array containing the sample value |
[out] | valtab1 | Array containing the sample value |
[out] | valtab2 | Array containing the sample value |
[out] | res1 | First result (Harmonic first) |
[out] | res2 | First result (Arithmetic first) |
int stats_residuals | ( | int | verbose, |
int | nech, | ||
const double * | tab, | ||
int | ncut, | ||
double * | zcut, | ||
int * | nsorted, | ||
double * | mean, | ||
double * | residuals, | ||
double * | T, | ||
double * | Q | ||
) |
Create residuals
[in] | verbose | Verbose flag |
[in] | nech | Number of samples |
[in] | tab | Array of sample values (Dimension: nech) |
[in] | ncut | Number of cutoffs |
[in] | zcut | Array of cutoff values (Dimension: ncut) |
[out] | nsorted | Number of sorted samples |
[out] | mean | Average of the active data |
[out] | residuals | Array of residuals (Dimension: ncut * nech) |
[out] | T | Array of for tonnage |
[out] | Q | Array of for metal quantity |
|
static |