Loading...
Searching...
No Matches
interpf.h
Go to the documentation of this file.
/*
* modified by Brown in June 1999 - added elatt & smatt
* modified by Mitasova Nov. 9, 1999 - added parameter for dtens to output2d
*/
#include <grass/config.h>
#include <stdio.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/vector.h>
#include <grass/bitmap.h>
#include <grass/dataquad.h>
#include <grass/qtree.h>
#include <grass/dbmi.h>
#ifdef GRASS_CMAKE_BUILD
#include <export/grass_interpfl_export.h>
#else
#define GRASS_INTERPFL_EXPORT
#endif
/* for resample program */
struct fcell_triple {
double x;
double y;
FCELL z;
double smooth;
};
#ifdef POINT2D_C
GRASS_INTERPFL_EXPORT struct line_pnts *Pnts;
GRASS_INTERPFL_EXPORT struct line_cats *Cats2;
GRASS_INTERPFL_EXPORT dbDriver *driver2;
GRASS_INTERPFL_EXPORT dbString sql2;
GRASS_INTERPFL_EXPORT struct Map_info Map2;
GRASS_INTERPFL_EXPORT struct field_info *ff;
GRASS_INTERPFL_EXPORT int count;
#else
GRASS_INTERPFL_EXPORT extern struct line_pnts *Pnts;
GRASS_INTERPFL_EXPORT extern struct line_cats *Cats2;
GRASS_INTERPFL_EXPORT extern dbDriver *driver2;
GRASS_INTERPFL_EXPORT extern dbString sql2;
GRASS_INTERPFL_EXPORT extern struct Map_info Map2;
GRASS_INTERPFL_EXPORT extern struct field_info *ff;
GRASS_INTERPFL_EXPORT extern int count;
#endif
struct interp_params;
typedef int grid_calc_fn(struct interp_params *, struct quaddata *, struct BM *,
double, double, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, off_t, double);
typedef int matrix_create_fn(struct interp_params *, struct triple *, int,
double **, int *);
typedef int check_points_fn(struct interp_params *, struct quaddata *, double *,
double *, double, double, struct triple *);
typedef int secpar_fn(struct interp_params *, int, int, int, struct BM *,
double *, double *, double *, double *, double *,
double *, int, int);
typedef double interp_fn(double, double);
typedef int interpder_fn(double, double, double *, double *);
typedef int wr_temp_fn(struct interp_params *, int, int, off_t);
struct interp_params {
double zmult; /**< multiplier for z-values */
FILE *fdinp; /**< input stream */
int elatt; /**< which floating point attr to
* use? first = 1, second = 2, etc
*/
int smatt; /**< which floating point attr to use
for smoothing? first = 1, second =
2, etc */
int kmin; /**< min number of points per segment
for interpolation */
int kmax; /**< max number of points per segment
*/
char *maskmap; /**< name of mask */
int nsizr, nsizc; /**< number of rows and columns */
DCELL *az, *adx, *ady, *adxx, *adyy, *adxy;
/**< array for interpolated values */
double fi; /**< tension */
int KMAX2; /**< max num. of points for interp.
*/
int scik1, scik2, scik3; /**< multipliers for
interp. values */
double rsm; /**< smoothing */
char *elev, *slope, *aspect, *pcurv, *tcurv, *mcurv;
/**< output files */
double dmin; /**< min distance between points */
double x_orig, y_orig; /**< origin */
int deriv, cv; /**< 1 if compute partial derivs */
double theta; /**< anisotropy angle,
0=East,counter-clockwise */
double scalex; /**< anisotropy scaling factor */
struct TimeStamp *ts; /**< timestamp for raster files */
FILE *Tmp_fd_z, *Tmp_fd_dx, *Tmp_fd_dy, *Tmp_fd_xx, *Tmp_fd_yy, *Tmp_fd_xy;
/**< temp files for writing interp. values */
bool create_devi; /**< create deviations file? */
grid_calc_fn *grid_calc; /**< calculates grid for given segm */
matrix_create_fn *matrix_create; /**< creates matrix for a given segm */
check_points_fn *check_points; /**< checks interp. func. at points */
secpar_fn *secpar; /**< calculates aspect,slope,curv. */
interp_fn *interp; /**< radial based interp. function */
interpder_fn *interpder; /**< interp. func. for derivatives */
wr_temp_fn *wr_temp; /**< writes temp files */
const char *wheresql; /**< SQL statement to select input points */
};
/* distance.c */
double IL_dist_square(double *, double *, int);
/* func2d.c */
double IL_crst(double, double);
int IL_crstg(double, double, double *, double *);
/* init2d.c */
void IL_init_params_2d(struct interp_params *, FILE *, int, int, double, int,
int, char *, int, int, DCELL *, DCELL *, DCELL *,
DCELL *, DCELL *, DCELL *, double, int, int, int, int,
double, char *, char *, char *, char *, char *, char *,
double, double, double, int, double, double, FILE *,
FILE *, FILE *, FILE *, FILE *, FILE *, bool,
struct TimeStamp *, int, const char *);
void IL_init_func_2d(struct interp_params *, grid_calc_fn *, matrix_create_fn *,
check_points_fn *, secpar_fn *, interp_fn *,
interpder_fn *, wr_temp_fn *);
/* input2d.c */
int IL_input_data_2d(struct interp_params *, struct tree_info *, double *,
double *, double *, double *, double *, double *, int *);
struct BM *IL_create_bitmask(struct interp_params *);
int translate_quad(struct multtree *, double, double, double, int);
/* interp2d.c */
int IL_grid_calc_2d(struct interp_params *, struct quaddata *, struct BM *,
double, double, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
off_t, double);
/* matrix.c */
int IL_matrix_create(struct interp_params *, struct triple *, int, double **,
int *);
int IL_matrix_create_alloc(struct interp_params *, struct triple *, int,
double **, int *, double *);
/* minmax.c */
int min1(int, int);
int max1(int, int);
double amax1(double, double);
double amin1(double, double);
/* newsegm2d.c */
int IL_interp_segments_new_2d(struct interp_params *, struct tree_info *,
struct multtree *, struct BM *, double, double,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, int, int,
double);
/* output2d.c */
int IL_output_2d(struct interp_params *, struct Cell_head *, double, double,
double, double, double, double, double, double, double, double,
double, char *, double, int, int, int);
/* point2d.c */
int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *,
double *, double, double, struct triple *);
int IL_write_point_2d(struct triple, double);
/* point2d_parallel.c */
int IL_check_at_points_2d_cvdev(struct interp_params *, struct quaddata *,
double *, double *, double, double,
struct triple *);
/* resout2d.c */
/* resout2dmod.c */
int IL_resample_output_2d(struct interp_params *, double, double, double,
double, double, double, double, double, double,
double, double, char *, double *, struct Cell_head *,
struct Cell_head *, char *, int);
/* ressegm2d.c */
int IL_resample_interp_segments_2d(struct interp_params *, struct BM *, double,
double, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, off_t, double *, int,
int, int, int, int, double, double, double,
double, int);
/* secpar2d.c */
int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *,
double *, double *, double *, double *, double *,
double *, int, int);
/* segmen2d.c */
double smallest_segment(struct multtree *, int);
int IL_interp_segments_2d(struct interp_params *, struct tree_info *,
struct multtree *, struct BM *, double, double,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, int, off_t,
double);
/* segmen2d_parallel.c */
int IL_interp_segments_2d_parallel(struct interp_params *, struct tree_info *,
struct multtree *, struct BM *, double,
double, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, int, off_t, double, int);
/* vinput2d.c */
int IL_vector_input_data_2d(struct interp_params *, struct Map_info *, int,
char *, char *, struct tree_info *, double *,
double *, double *, double *, double *, double *,
int *, double *);
int process_point(double, double, double, double, struct tree_info *, double,
double *, double *, double *, double *, double *, double *,
int *, int *, int *);
/* write2d.c */
int IL_write_temp_2d(struct interp_params *, int, int, off_t);
Map2
struct Map_info Map2
amin1
double amin1(double, double)
Definition minmax.c:65
IL_grid_calc_2d
int IL_grid_calc_2d(struct interp_params *, struct quaddata *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, off_t, double)
Definition interp2d.c:61
IL_output_2d
int IL_output_2d(struct interp_params *, struct Cell_head *, double, double, double, double, double, double, double, double, double, double, double, char *, double, int, int, int)
Definition output2d.c:57
IL_interp_segments_2d
int IL_interp_segments_2d(struct interp_params *, struct tree_info *, struct multtree *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, int, off_t, double)
Definition segmen2d.c:46
IL_create_bitmask
struct BM * IL_create_bitmask(struct interp_params *)
Definition input2d.c:37
IL_resample_interp_segments_2d
int IL_resample_interp_segments_2d(struct interp_params *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, off_t, double *, int, int, int, int, int, double, double, double, double, int)
Definition ressegm2d.c:33
IL_crst
double IL_crst(double, double)
Radial basis function.
Definition func2d.c:49
interp_fn
double interp_fn(double, double)
Definition interpf.h:64
IL_dist_square
double IL_dist_square(double *, double *, int)
Definition rst/interp_float/distance.c:18
IL_interp_segments_2d_parallel
int IL_interp_segments_2d_parallel(struct interp_params *, struct tree_info *, struct multtree *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, int, off_t, double, int)
Definition segmen2d_parallel.c:36
ff
struct field_info * ff
IL_check_at_points_2d_cvdev
int IL_check_at_points_2d_cvdev(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple *)
A parallel version of IL_check_at_points_2d. Sperate the cross-validation/deviation computing part an...
Definition point2d_parallel.c:60
interpder_fn
int interpder_fn(double, double, double *, double *)
Definition interpf.h:66
secpar_fn
int secpar_fn(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition interpf.h:60
IL_input_data_2d
int IL_input_data_2d(struct interp_params *, struct tree_info *, double *, double *, double *, double *, double *, double *, int *)
IL_write_point_2d
int IL_write_point_2d(struct triple, double)
A function to write out point and deviation at point to database.
Definition point2d.c:163
wr_temp_fn
int wr_temp_fn(struct interp_params *, int, int, off_t)
Definition interpf.h:68
max1
int max1(int, int)
Definition minmax.c:30
IL_vector_input_data_2d
int IL_vector_input_data_2d(struct interp_params *, struct Map_info *, int, char *, char *, struct tree_info *, double *, double *, double *, double *, double *, double *, int *, double *)
Definition vinput2d.c:50
check_points_fn
int check_points_fn(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple *)
Definition interpf.h:57
IL_init_func_2d
void IL_init_func_2d(struct interp_params *, grid_calc_fn *, matrix_create_fn *, check_points_fn *, secpar_fn *, interp_fn *, interpder_fn *, wr_temp_fn *)
Definition init2d.c:107
amax1
double amax1(double, double)
Definition minmax.c:52
min1
int min1(int, int)
Definition minmax.c:17
matrix_create_fn
int matrix_create_fn(struct interp_params *, struct triple *, int, double **, int *)
Definition interpf.h:54
translate_quad
int translate_quad(struct multtree *, double, double, double, int)
Definition input2d.c:90
grid_calc_fn
int grid_calc_fn(struct interp_params *, struct quaddata *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, off_t, double)
Definition interpf.h:49
sql2
dbString sql2
IL_check_at_points_2d
int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple *)
Definition point2d.c:52
IL_write_temp_2d
int IL_write_temp_2d(struct interp_params *, int, int, off_t)
Definition write2d.c:34
driver2
dbDriver * driver2
IL_secpar_loop_2d
int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition secpar2d.c:34
IL_crstg
int IL_crstg(double, double, double *, double *)
Function for calculating derivatives (d=2).
Definition func2d.c:111
Cats2
struct line_cats * Cats2
process_point
int process_point(double, double, double, double, struct tree_info *, double, double *, double *, double *, double *, double *, double *, int *, int *, int *)
Definition vinput2d.c:306
IL_init_params_2d
void IL_init_params_2d(struct interp_params *, FILE *, int, int, double, int, int, char *, int, int, DCELL *, DCELL *, DCELL *, DCELL *, DCELL *, DCELL *, double, int, int, int, int, double, char *, char *, char *, char *, char *, char *, double, double, double, int, double, double, FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, bool, struct TimeStamp *, int, const char *)
Definition init2d.c:30
count
int count
IL_matrix_create
int IL_matrix_create(struct interp_params *, struct triple *, int, double **, int *)
Definition matrix.c:37
GRASS_INTERPFL_EXPORT
#define GRASS_INTERPFL_EXPORT
Definition interpf.h:18
IL_interp_segments_new_2d
int IL_interp_segments_new_2d(struct interp_params *, struct tree_info *, struct multtree *, struct BM *, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, int, int, double)
IL_matrix_create_alloc
int IL_matrix_create_alloc(struct interp_params *, struct triple *, int, double **, int *, double *)
Creates system of linear equations from interpolated points.
Definition matrix.c:69
smallest_segment
double smallest_segment(struct multtree *, int)
Definition segmen2d.c:342
Pnts
struct line_pnts * Pnts
IL_resample_output_2d
int IL_resample_output_2d(struct interp_params *, double, double, double, double, double, double, double, double, double, double, double, char *, double *, struct Cell_head *, struct Cell_head *, char *, int)
Definition resout2d.c:45
fcell_triple
Definition interpf.h:22
fcell_triple::z
FCELL z
Definition interpf.h:25
fcell_triple::x
double x
Definition interpf.h:23
fcell_triple::smooth
double smooth
Definition interpf.h:26
fcell_triple::y
double y
Definition interpf.h:24
interp_params
Definition interpf.h:70
interp_params::check_points
check_points_fn * check_points
Definition interpf.h:132
interp_params::zmult
double zmult
Definition interpf.h:72
interp_params::Tmp_fd_xx
FILE * Tmp_fd_xx
Definition interpf.h:123
interp_params::Tmp_fd_xy
FILE * Tmp_fd_xy
Definition interpf.h:123
interp_params::scik2
int scik2
Definition interpf.h:102
interp_params::az
DCELL * az
Definition interpf.h:94
interp_params::pcurv
char * pcurv
Definition interpf.h:107
interp_params::interp
interp_fn * interp
Definition interpf.h:136
interp_params::secpar
secpar_fn * secpar
Definition interpf.h:134
interp_params::deriv
int deriv
Definition interpf.h:114
interp_params::fdinp
FILE * fdinp
Definition interpf.h:74
interp_params::wheresql
const char * wheresql
Definition interpf.h:142
interp_params::Tmp_fd_yy
FILE * Tmp_fd_yy
Definition interpf.h:123
interp_params::grid_calc
grid_calc_fn * grid_calc
Definition interpf.h:128
interp_params::fi
double fi
Definition interpf.h:97
interp_params::x_orig
double x_orig
Definition interpf.h:112
interp_params::theta
double theta
Definition interpf.h:116
interp_params::cv
int cv
Definition interpf.h:114
interp_params::maskmap
char * maskmap
Definition interpf.h:90
interp_params::adxy
DCELL * adxy
Definition interpf.h:94
interp_params::scik3
int scik3
Definition interpf.h:102
interp_params::rsm
double rsm
Definition interpf.h:105
interp_params::Tmp_fd_dx
FILE * Tmp_fd_dx
Definition interpf.h:123
interp_params::adyy
DCELL * adyy
Definition interpf.h:94
interp_params::adx
DCELL * adx
Definition interpf.h:94
interp_params::y_orig
double y_orig
Definition interpf.h:112
interp_params::nsizr
int nsizr
Definition interpf.h:92
interp_params::Tmp_fd_z
FILE * Tmp_fd_z
Definition interpf.h:123
interp_params::ady
DCELL * ady
Definition interpf.h:94
interp_params::nsizc
int nsizc
Definition interpf.h:92
interp_params::dmin
double dmin
Definition interpf.h:110
interp_params::tcurv
char * tcurv
Definition interpf.h:107
interp_params::scalex
double scalex
Definition interpf.h:119
interp_params::ts
struct TimeStamp * ts
Definition interpf.h:121
interp_params::mcurv
char * mcurv
Definition interpf.h:107
interp_params::Tmp_fd_dy
FILE * Tmp_fd_dy
Definition interpf.h:123
interp_params::wr_temp
wr_temp_fn * wr_temp
Definition interpf.h:140
interp_params::aspect
char * aspect
Definition interpf.h:107
interp_params::elev
char * elev
Definition interpf.h:107
interp_params::elatt
int elatt
Definition interpf.h:76
interp_params::kmin
int kmin
Definition interpf.h:84
interp_params::slope
char * slope
Definition interpf.h:107
interp_params::smatt
int smatt
Definition interpf.h:80
interp_params::kmax
int kmax
Definition interpf.h:87
interp_params::interpder
interpder_fn * interpder
Definition interpf.h:138
interp_params::KMAX2
int KMAX2
Definition interpf.h:99
interp_params::adxx
DCELL * adxx
Definition interpf.h:94
interp_params::create_devi
bool create_devi
Definition interpf.h:126
interp_params::matrix_create
matrix_create_fn * matrix_create
Definition interpf.h:130
interp_params::scik1
int scik1
Definition interpf.h:102
multtree
Definition qtree.h:52
quaddata
Definition dataquad.h:45
tree_info
Definition qtree.h:45
triple
Definition dataquad.h:38