#include "geoslib_f_private.h"
#include "Enum/ELoc.hpp"
#include "Basic/NamingConvention.hpp"
#include "Basic/OptDbg.hpp"
#include "Calculators/CalcMigrate.hpp"
#include "Calculators/ACalcDbToDb.hpp"
#include "Db/DbGrid.hpp"
#include "Db/Db.hpp"
#include "Morpho/Morpho.hpp"
#include "Tree/Ball.hpp"
#include "Tree/KNN.hpp"
#include "geoslib_old_f.h"
#include <math.h>
Macros | |
#define | RES(nval, idim) (res[(idim) + (ndim+1) * (nval)]) |
Functions | |
void | st_get_closest_sample (DbGrid *dbgrid, int ig, Db *dbpoint, int ip, int flag_aniso, int iatt_time, int iatt_angle, int iatt_scaleu, int iatt_scalev, int iatt_scalew, int *ipmin, double *ddmin, VectorDouble &dvect) |
int | st_next_sample (int ip0_init, const VectorInt &rank, const VectorDouble &xtab, double xtarget) |
int | migrate (Db *dbin, Db *dbout, const String &name, int dist_type, const VectorDouble &dmax, bool flag_fill, bool flag_inter, bool flag_ball, const NamingConvention &namconv) |
int | migrateMulti (Db *dbin, Db *dbout, const VectorString &names, int dist_type, const VectorDouble &dmax, bool flag_fill, bool flag_inter, bool flag_ball, const NamingConvention &namconv) |
int | migrateByAttribute (Db *dbin, Db *dbout, const VectorInt &atts, int dist_type, const VectorDouble &dmax, bool flag_fill, bool flag_inter, bool flag_ball, const NamingConvention &namconv) |
int | migrateByLocator (Db *dbin, Db *dbout, const ELoc &locatorType, int dist_type, const VectorDouble &dmax, bool flag_fill, bool flag_inter, bool flag_ball, const NamingConvention &namconv) |
int | manageExternalInformation (int mode, const ELoc &locatorType, Db *dbin, Db *dbout, bool *flag_created) |
int | interpolateVariableToPoint (DbGrid *db_grid, int iatt, int np, double *xp, double *yp, double *zp, double *tab) |
double * | dbgridLineSampling (DbGrid *dbgrid, double *x1, double *x2, int ndisc, int ncut, double *cuts, int *nval_ret) |
int | expandPointToGrid (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 | expandPointToCoor (const Db *db1, int iatt, const VectorVectorDouble &coords, VectorDouble &tab) |
int | pointToBlock (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 | migrateGridToCoor (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) |
#define RES | ( | nval, | |
idim | |||
) | (res[(idim) + (ndim+1) * (nval)]) |
double* dbgridLineSampling | ( | 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 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 expandPointToCoor | ( | 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 expandPointToGrid | ( | 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 interpolateVariableToPoint | ( | 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 manageExternalInformation | ( | int | mode, |
const ELoc & | locatorType, | ||
Db * | dbin, | ||
Db * | dbout, | ||
bool * | flag_created | ||
) |
Derive the external information(s) from the Output db (if Grid) to the Input Db
int migrate | ( | Db * | dbin, |
Db * | dbout, | ||
const String & | name, | ||
int | dist_type, | ||
const VectorDouble & | dmax, | ||
bool | flag_fill, | ||
bool | flag_inter, | ||
bool | flag_ball, | ||
const NamingConvention & | namconv | ||
) |
Migrates a variable from one Db to another one
[in] | dbin | Descriptor of the input Db |
[in] | dbout | Descriptor of the output Db |
[in] | name | Name of the attribute to be migrated |
[in] | dist_type | 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 BallTree sorting algorithm when available |
[in] | namconv | Naming convention |
int migrateByAttribute | ( | Db * | dbin, |
Db * | dbout, | ||
const VectorInt & | atts, | ||
int | dist_type, | ||
const VectorDouble & | dmax, | ||
bool | flag_fill, | ||
bool | flag_inter, | ||
bool | flag_ball, | ||
const NamingConvention & | namconv | ||
) |
Migrates a variable from one Db to another one
[in] | dbin | Descriptor of the input Db |
[in] | dbout | Descriptor of the output Db |
[in] | atts | Array of attributes to be migrated |
[in] | dist_type | 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 BallTree sorting algorithm when available |
[in] | namconv | Naming Convention |
int migrateByLocator | ( | Db * | dbin, |
Db * | dbout, | ||
const ELoc & | locatorType, | ||
int | dist_type, | ||
const VectorDouble & | dmax, | ||
bool | flag_fill, | ||
bool | flag_inter, | ||
bool | flag_ball, | ||
const NamingConvention & | namconv | ||
) |
Migrates all z-locator variables from one Db to another one
[in] | dbin | Descriptor of the input Db |
[in] | dbout | Descriptor of the output Db |
[in] | locatorType | Locator Type |
[in] | dist_type | 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 BallTree sorting algorithm when available |
[in] | namconv | Naming convention |
int migrateGridToCoor | ( | 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 migrateMulti | ( | Db * | dbin, |
Db * | dbout, | ||
const VectorString & | names, | ||
int | dist_type, | ||
const VectorDouble & | dmax, | ||
bool | flag_fill, | ||
bool | flag_inter, | ||
bool | flag_ball, | ||
const NamingConvention & | namconv | ||
) |
Migrates a set of variables from one Db to another one
[in] | dbin | Descriptor of the input Db |
[in] | dbout | Descriptor of the output Db |
[in] | names | Name of the attribute to be migrated |
[in] | dist_type | 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 BallTree sorting algorithm when available |
[in] | namconv | Naming convention |
int pointToBlock | ( | 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) |
void st_get_closest_sample | ( | DbGrid * | dbgrid, |
int | ig, | ||
Db * | dbpoint, | ||
int | ip, | ||
int | flag_aniso, | ||
int | iatt_time, | ||
int | iatt_angle, | ||
int | iatt_scaleu, | ||
int | iatt_scalev, | ||
int | iatt_scalew, | ||
int * | ipmin, | ||
double * | ddmin, | ||
VectorDouble & | dvect | ||
) |
Update minimum distance and rank of the corresponding sample
[in] | dbgrid | Descriptor of the grid parameters |
[in] | ig | Rank of the sample in the Grid file |
[in] | dbpoint | Descriptor of the point parameters |
[in] | ip | Rank of the sample in the Point file |
[in] | flag_aniso | 1 if anisotropic distance must be calculated |
[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,out] | ipmin | Rank of the Point sample |
[in,out] | ddmin | Minimum distance |
[out] | dvect | Working vector |
int st_next_sample | ( | int | ip0_init, |
const VectorInt & | rank, | ||
const VectorDouble & | xtab, | ||
double | xtarget | ||
) |
Get the rank of the next sample just above the target To speed up the process, this operation is performed starting from the rank assigned to the previous sample (this assumes that samples are treated by increasing coordinate)
ip0_init | Rank of the previous sample |
rank | Array of sample ordering |
xtab | Array of sample coordinates |
xtarget | Target coordinate |