GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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 */
92  FILE *Tmp_fd_z, *Tmp_fd_dx,
93  *Tmp_fd_dy, *Tmp_fd_xx,
94  *Tmp_fd_yy, *Tmp_fd_xy; /**< temp files for writing interp. values */
95  bool create_devi; /**< create 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 *, bool,
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);
interp_fn * interp
Definition: interpf.h:101
double y
Definition: interpf.h:19
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:31
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:423
dbString sql2
double smallest_segment(struct multtree *, int)
Definition: segmen2d.c:346
double DCELL
Definition: gis.h:614
int count
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
double y_orig
Definition: interpf.h:87
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_crstg(double, double, double *, double *)
Definition: func2d.c:106
int IL_input_data_2d(struct interp_params *, struct tree_info *, double *, double *, double *, double *, double *, double *, int *)
int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple)
Definition: point2d.c:53
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
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 translate_quad(struct multtree *, double, double, double, int)
Definition: input2d.c:92
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
Layer (old: field) information.
Definition: dig_structs.h:134
grid_calc_fn * grid_calc
Definition: interpf.h:97
dbDriver * driver2
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
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:65
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
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
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:615
Vector map info.
Definition: dig_structs.h:1259
double amin1(double, double)
Definition: minmax.c:67
char * tcurv
Definition: interpf.h:84
double IL_crst(double, double)
Definition: func2d.c:48
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
double zmult
Definition: interpf.h:70
Definition: gis.h:598
Definition: qtree.h:56
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:109
struct TimeStamp * ts
Definition: interpf.h:91
bool create_devi
Definition: interpf.h:95
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
struct BM * IL_create_bitmask(struct interp_params *)
Definition: input2d.c:40
double IL_dist_square(double *, double *, int)
int min1(int, int)
Definition: minmax.c:18
double interp_fn(double, double)
Definition: interpf.h:62
struct Map_info Map2
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