GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72993
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
interpf.h
Go to the documentation of this file.
1 /*
2  * modified by Brown in June 1999 - added elatt & smatt
3  * modified by Mitasova Nov. 9, 1999 - added parameter for dtens to output2d
4  */
5 #include <grass/config.h>
6 #include <stdio.h>
7 #include <grass/gis.h>
8 #include <grass/raster.h>
9 #include <grass/vector.h>
10 #include <grass/bitmap.h>
11 #include <grass/dataquad.h>
12 #include <grass/qtree.h>
13 #include <grass/dbmi.h>
14 
15 /* for resample program */
17 {
18  double x;
19  double y;
21  double smooth;
22 };
23 
24 #ifdef POINT2D_C
25 struct line_pnts *Pnts;
26 struct line_cats *Cats2;
29 struct Map_info Map2;
30 struct field_info *ff;
31 int count;
32 #else
33 extern struct line_pnts *Pnts;
34 extern struct line_cats *Cats2;
35 extern dbDriver *driver2;
36 extern dbString sql2;
37 extern struct Map_info Map2;
38 extern struct field_info *ff;
39 extern int count;
40 #endif
41 
42 struct interp_params;
43 
44 typedef int grid_calc_fn(
45  struct interp_params *, struct quaddata *, struct BM *,
46  double, double, double *, double *, double *, double *,
47  double *, double *, double *, double *, double *,
48  double *, off_t, double);
49 
50 typedef int matrix_create_fn(
51  struct interp_params *, struct triple *, int, double **, int *);
52 
53 typedef int check_points_fn(
54  struct interp_params *, struct quaddata *, double *,
55  double *, double, double, struct triple);
56 
57 typedef int secpar_fn(
58  struct interp_params *, int, int, int, struct BM *,
59  double *, double *, double *, double *, double *,
60  double *, int, int);
61 
62 typedef double interp_fn(double, double);
63 
64 typedef int interpder_fn(double, double, double *, double *);
65 
66 typedef int wr_temp_fn(struct interp_params *, int, int, off_t);
67 
69 {
70  double zmult; /**< multiplier for z-values */
71  FILE *fdinp; /**< input stream */
72  int elatt; /**< which floating point attr to use? first = 1, second = 2, etc */
73  int smatt; /**< which floating point attr to use for smoothing? first = 1, second = 2, etc */
74  int kmin; /**< min number of points per segment for interpolation */
75  int kmax; /**< max number of points per segment */
76  char *maskmap; /**< name of mask */
77  int nsizr, nsizc; /**< number of rows and columns */
78  DCELL *az, *adx, *ady,
79  *adxx, *adyy, *adxy; /**< array for interpolated values */
80  double fi; /**< tension */
81  int KMAX2; /**< max num. of points for interp. */
82  int scik1, scik2, scik3; /**< multipliers for interp. values */
83  double rsm; /**< smoothing */
84  char *elev, *slope, *aspect,
85  *pcurv, *tcurv, *mcurv; /**< output files */
86  double dmin; /**< min distance between points */
87  double x_orig, y_orig; /**< origin */
88  int deriv, cv; /**< 1 if compute partial derivs */
89  double theta; /**< anisotropy angle, 0=East,counter-clockwise */
90  double scalex; /**< anisotropy scaling factor */
91  struct TimeStamp *ts; /**< timestamp for raster files */
94  *Tmp_fd_yy, *Tmp_fd_xy; /**< temp files for writing interp. values */
95  FILE *fddevi; /**< pointer to deviations file */
96 
97  grid_calc_fn *grid_calc; /**< calculates grid for given segm */
98  matrix_create_fn *matrix_create; /**< creates matrix for a given segm */
99  check_points_fn *check_points; /**< checks interp. func. at points */
100  secpar_fn *secpar; /**< calculates aspect,slope,curv. */
101  interp_fn *interp; /**< radial based interp. function */
102  interpder_fn *interpder; /**< interp. func. for derivatives */
103  wr_temp_fn *wr_temp; /**< writes temp files */
104  const char *wheresql; /**< SQL statement to select input points */
105 };
106 
107 /* distance.c */
108 double IL_dist_square(double *, double *, int);
109 
110 /* func2d.c */
111 double IL_crst(double, double);
112 int IL_crstg(double, double, double *, double *);
113 
114 /* init2d.c */
115 void IL_init_params_2d(struct interp_params *, FILE *, int, int, double,
116  int, int, char *, int, int,
117  DCELL *, DCELL *, DCELL *, DCELL *, DCELL *, DCELL *,
118  double, int, int, int, int, double,
119  char *, char *, char *, char *, char *, char *,
120  double, double, double, int, double, double,
121  FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, FILE *,
122  struct TimeStamp *, int, const char *);
123 
127 /* input2d.c */
128 int IL_input_data_2d(struct interp_params *, struct tree_info *, double *,
129  double *, double *, double *, double *, double *, int *);
130 struct BM *IL_create_bitmask(struct interp_params *);
131 int translate_quad(struct multtree *, double, double, double, int);
132 
133 /* interp2d.c */
134 int IL_grid_calc_2d(struct interp_params *, struct quaddata *, struct BM *,
135  double, double, double *, double *, double *, double *,
136  double *, double *, double *, double *, double *,
137  double *, off_t, double);
138 /* matrix.c */
139 int IL_matrix_create(struct interp_params *, struct triple *, int, double **,
140  int *);
141 int IL_matrix_create_alloc(struct interp_params *, struct triple *, int, double **,
142  int *, double *);
143 /* minmax.c */
144 int min1(int, int);
145 int max1(int, int);
146 double amax1(double, double);
147 double amin1(double, double);
148 
149 /* newsegm2d.c */
150 int IL_interp_segments_new_2d(struct interp_params *, struct tree_info *,
151  struct multtree *, struct BM *, double, double,
152  double *, double *, double *, double *,
153  double *, double *, double *, double *,
154  double *, int, int, double);
155 /* output2d.c */
156 int IL_output_2d(struct interp_params *, struct Cell_head *, double, double,
157  double, double, double, double, double, double, double,
158  double, double, char *, double, int, int, int);
159 /* point2d.c */
160 int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *,
161  double *, double, double, struct triple);
162 /* resout2d.c */
163 /* resout2dmod.c */
164 int IL_resample_output_2d(struct interp_params *, double, double, double,
165  double, double, double, double, double, double,
166  double, double, char *, double *,
167  struct Cell_head *, struct Cell_head *, char *,
168  int);
169 /* ressegm2d.c */
170 int IL_resample_interp_segments_2d(struct interp_params *, struct BM *,
171  double, double, double *, double *,
172  double *, double *, double *, double *,
173  double *, double *, double *, off_t,
174  double *, int, int, int, int, int, double,
175  double, double, double, int);
176 /* secpar2d.c */
177 int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *,
178  double *, double *, double *, double *, double *,
179  double *, int, int);
180 /* segmen2d.c */
181 double smallest_segment(struct multtree *, int);
182 int IL_interp_segments_2d(struct interp_params *, struct tree_info *,
183  struct multtree *, struct BM *, double, double,
184  double *, double *, double *, double *, double *,
185  double *, double *, double *, double *, int, off_t,
186  double);
187 /* segmen2d_parallel.c */
189  struct multtree *, struct BM *, double, double,
190  double *, double *, double *, double *, double *,
191  double *, double *, double *, double *, int, off_t,
192  double, int);
193 /* vinput2d.c */
194 int IL_vector_input_data_2d(struct interp_params *, struct Map_info *, int,
195  char *, char *, struct tree_info *, double *,
196  double *, double *, double *, double *, double *,
197  int *, double *);
198 int process_point(double, double, double, double, struct tree_info *, double,
199  double *, double *, double *, double *, double *, double *,
200  int *, int *, int *);
201 /* write2d.c */
202 int IL_write_temp_2d(struct interp_params *, int, int, off_t);
int IL_crstg(double r, double fi, double *gd1, double *gd2)
Definition: func2d.c:106
interp_fn * interp
Definition: interpf.h:101
double y
Definition: interpf.h:19
int interpder_fn(double, double, double *, double *)
Definition: interpf.h:64
double rsm
Definition: interpf.h:83
interpder_fn * interpder
Definition: interpf.h:102
double scalex
Definition: interpf.h:90
2D/3D raster map header (used also for region)
Definition: gis.h:390
dbString sql2
char * mcurv
Definition: interpf.h:84
double smallest_segment(struct multtree *, int)
Definition: segmen2d.c:346
double DCELL
Definition: gis.h:581
FILE * Tmp_fd_xy
Definition: interpf.h:92
FILE * Tmp_fd_yy
Definition: interpf.h:92
int count
void IL_init_func_2d(struct interp_params *params, grid_calc_fn *grid_f, matrix_create_fn *matr_f, check_points_fn *point_f, secpar_fn *secp_f, interp_fn *interp_f, interpder_fn *interpder_f, wr_temp_fn *temp_f)
Definition: init2d.c:109
Definition: bitmap.h:17
double theta
Definition: interpf.h:89
matrix_create_fn * matrix_create
Definition: interpf.h:98
int IL_matrix_create(struct interp_params *, struct triple *, int, double **, int *)
Definition: matrix.c:39
double amax1(double, double)
Definition: minmax.c:54
DCELL * adxx
Definition: interpf.h:78
double y_orig
Definition: interpf.h:87
char * elev
Definition: interpf.h:84
int IL_grid_calc_2d(struct interp_params *params, struct quaddata *data, struct BM *bitmask, double zmin, double zmax, double *zminac, double *zmaxac, double *gmin, double *gmax, double *c1min, double *c1max, double *c2min, double *c2max, double *ertot, double *b, off_t offset1, double dnorm)
Definition: interp2d.c:65
char * pcurv
Definition: interpf.h:84
int process_point(double, double, double, double, struct tree_info *, double, double *, double *, double *, double *, double *, double *, int *, int *, int *)
Definition: vinput2d.c:306
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 *params)
Definition: input2d.c:40
FILE * Tmp_fd_xx
Definition: interpf.h:92
int translate_quad(struct multtree *tree, double numberx, double numbery, double numberz, int n_leafs)
Definition: input2d.c:92
int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple)
Definition: point2d.c:53
DCELL * adx
Definition: interpf.h:78
const char * wheresql
Definition: interpf.h:104
int wr_temp_fn(struct interp_params *, int, int, off_t)
Definition: interpf.h:66
secpar_fn * secpar
Definition: interpf.h:100
Feature category info.
Definition: dig_structs.h:1702
double IL_crst(double r, double fi)
Definition: func2d.c:48
int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition: secpar2d.c:39
int check_points_fn(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple)
Definition: interpf.h:53
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:47
FILE * fddevi
Definition: interpf.h:95
Layer (old: field) information.
Definition: dig_structs.h:134
grid_calc_fn * grid_calc
Definition: interpf.h:97
dbDriver * driver2
FILE * Tmp_fd_dx
Definition: interpf.h:92
Feature geometry info - coordinates.
Definition: dig_structs.h:1675
int IL_write_temp_2d(struct interp_params *, int, int, off_t)
Definition: write2d.c:36
check_points_fn * check_points
Definition: interpf.h:99
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:44
char * aspect
Definition: interpf.h:84
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:72
double IL_dist_square(double *pt1, double *pt2, int dim)
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:59
struct field_info * ff
DCELL * az
Definition: interpf.h:78
double x
Definition: interpf.h:18
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)
double fi
Definition: interpf.h:80
int secpar_fn(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition: interpf.h:57
double x_orig
Definition: interpf.h:87
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:35
int matrix_create_fn(struct interp_params *, struct triple *, int, double **, int *)
Definition: interpf.h:50
float FCELL
Definition: gis.h:582
Vector map info.
Definition: dig_structs.h:1259
double amin1(double, double)
Definition: minmax.c:67
char * tcurv
Definition: interpf.h:84
DCELL * ady
Definition: interpf.h:78
FILE * Tmp_fd_dy
Definition: interpf.h:92
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
int max1(int, int)
Definition: minmax.c:32
char * maskmap
Definition: interpf.h:76
double dmin
Definition: interpf.h:86
FILE * fdinp
Definition: interpf.h:71
wr_temp_fn * wr_temp
Definition: interpf.h:103
FILE * Tmp_fd_z
Definition: interpf.h:92
void IL_init_params_2d(struct interp_params *params, FILE *inp, int elatt, int smatt, double zm, int k1, int k2, char *msk, int rows, int cols, DCELL *ar1, DCELL *ar2, DCELL *ar3, DCELL *ar4, DCELL *ar5, DCELL *ar6, double tension, int k3, int sc1, int sc2, int sc3, double sm, char *f1, char *f2, char *f3, char *f4, char *f5, char *f6, double dm, double x_or, double y_or, int der, double tet, double scl, FILE *t1, FILE *t2, FILE *t3, FILE *t4, FILE *t5, FILE *t6, FILE *dev, struct TimeStamp *ts, int c, const char *wheresql)
Definition: init2d.c:31
double zmult
Definition: interpf.h:70
Definition: gis.h:565
Definition: qtree.h:56
DCELL * adxy
Definition: interpf.h:78
struct TimeStamp * ts
Definition: interpf.h:91
struct line_pnts * Pnts
double smooth
Definition: interpf.h:21
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:51
int min1(int, int)
Definition: minmax.c:18
double interp_fn(double, double)
Definition: interpf.h:62
struct Map_info Map2
char * slope
Definition: interpf.h:84
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)
struct line_cats * Cats2
FCELL z
Definition: interpf.h:20
DCELL * adyy
Definition: interpf.h:78