GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
init2d.c
Go to the documentation of this file.
1/*!
2 * \file init2d.c
3 *
4 * \brief Initialization of interpolation library data structures
5 *
6 * \author H. Mitasova, I. Kosinovsky, D. Gerdes Fall 1993 (original authors)
7 * \author modified by McCauley in August 1995
8 * \author modified by Mitasova in August 1995
9 * \author modified by Brown in June 1999 - added elatt & smatt
10 *
11 * \copyright
12 * (C) 1993-1999 by Helena Mitasova and the GRASS Development Team
13 *
14 * \copyright
15 * This program is free software under the
16 * GNU General Public License (>=v2).
17 * Read the file COPYING that comes with GRASS
18 * for details.
19 *
20 */
21
22#include <stdbool.h>
23#include <stdio.h>
24#include <math.h>
25#include <unistd.h>
26#include <grass/gis.h>
27#include <grass/interpf.h>
28
29/*! Initializes parameters used by the library */
31 struct interp_params *params, FILE *inp, /*!< input stream */
32 int elatt, /*!< which fp att in sites file? 1 = first */
33 int smatt, /*!< which fp att in sites file to use for
34 * smoothing? (if zero use sm) 1 = first */
35 double zm, /*!< multiplier for z-values */
36 int k1, /*!< min number of points per segment for interpolation */
37 int k2, /*!< max number of points per segment */
38 char *msk, /*!< name of mask */
39 int rows, int cols, /*!< number of rows and columns */
41 DCELL *ar6, /*!< arrays for interpolated values (ar1-ar6) */
42 double tension, /*!< tension */
43 int k3, /*!< max number of points for interpolation */
44 int sc1, int sc2, int sc3, /*!< multipliers for interpolation values */
45 double sm, /*!< smoothing */
46 char *f1, char *f2, char *f3, char *f4, char *f5,
47 char *f6, /*!< output files (f1-f6) */
48 double dm, /*!< min distance between points */
49 double x_or, /*!< x of origin */
50 double y_or, /*!< y of origin */
51 int der, /*!< 1 if compute partial derivatives */
52 double tet, /*!< anisotropy angle (0 is East, counter-clockwise) */
53 double scl, /*!< anisotropy scaling factor */
54 FILE *t1, FILE *t2, FILE *t3, FILE *t4, FILE *t5,
55 FILE *t6, /*!< temp files for writing interp. values (t1-t6) */
56 bool create_devi, /*!< create deviations file? */
57 struct TimeStamp *ts, int c, /*!< cross validation */
58 const char *wheresql /*!< SQL WHERE statement */
59)
60{
61 params->fdinp = inp;
62 params->elatt = elatt;
63 params->smatt = smatt;
64 params->zmult = zm;
65 params->kmin = k1;
66 params->kmax = k2;
67 params->maskmap = msk;
68 params->nsizr = rows;
69 params->nsizc = cols;
70 params->az = ar1;
71 params->adx = ar2;
72 params->ady = ar3;
73 params->adxx = ar4;
74 params->adyy = ar5;
75 params->adxy = ar6;
76 params->fi = tension;
77 params->KMAX2 = k3;
78 params->scik1 = sc1;
79 params->scik2 = sc2;
80 params->scik3 = sc3;
81 params->rsm = sm;
82 params->elev = f1;
83 params->slope = f2;
84 params->aspect = f3;
85 params->pcurv = f4;
86 params->tcurv = f5;
87 params->mcurv = f6;
88 params->dmin = dm;
89 params->x_orig = x_or;
90 params->y_orig = y_or;
91 params->deriv = der;
92 params->theta = tet;
93 params->scalex = scl;
94 params->Tmp_fd_z = t1;
95 params->Tmp_fd_dx = t2;
96 params->Tmp_fd_dy = t3;
97 params->Tmp_fd_xx = t4;
98 params->Tmp_fd_yy = t5;
99 params->Tmp_fd_xy = t6;
100 params->create_devi = create_devi;
101 params->ts = ts;
102 params->cv = c;
103 params->wheresql = wheresql;
104}
105
106/*! Initializes functions used by the library */
108 struct interp_params *params,
109 grid_calc_fn *grid_f, /*!< calculates grid for given segment */
110 matrix_create_fn *matr_f, /*!< creates matrix for a given segment */
111 check_points_fn *point_f, /*!< checks interpolation function at points */
112 secpar_fn *secp_f, /*!< calculates aspect, slope, curvature */
113 interp_fn *interp_f, /*!< radial basis function */
114 interpder_fn *interpder_f, /*!< derivatives of radial basis function */
115 wr_temp_fn *temp_f /*!< writes temp files */
116)
117{
118 params->grid_calc = grid_f;
119 params->matrix_create = matr_f;
120 params->check_points = point_f;
121 params->secpar = secp_f;
122 params->interp = interp_f;
123 params->interpder = interpder_f;
124 params->wr_temp = temp_f;
125}
double DCELL
Definition gis.h:635
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:107
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, bool create_devi, struct TimeStamp *ts, int c, const char *wheresql)
Definition init2d.c:30
double interp_fn(double, double)
Definition interpf.h:64
int interpder_fn(double, double, double *, double *)
Definition interpf.h:66
int secpar_fn(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition interpf.h:60
int wr_temp_fn(struct interp_params *, int, int, off_t)
Definition interpf.h:68
int check_points_fn(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple *)
Definition interpf.h:57
int matrix_create_fn(struct interp_params *, struct triple *, int, double **, int *)
Definition interpf.h:54
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
check_points_fn * check_points
Definition interpf.h:132
double zmult
Definition interpf.h:72
FILE * Tmp_fd_xx
Definition interpf.h:123
FILE * Tmp_fd_xy
Definition interpf.h:123
DCELL * az
Definition interpf.h:94
char * pcurv
Definition interpf.h:107
interp_fn * interp
Definition interpf.h:136
secpar_fn * secpar
Definition interpf.h:134
FILE * fdinp
Definition interpf.h:74
const char * wheresql
Definition interpf.h:142
FILE * Tmp_fd_yy
Definition interpf.h:123
grid_calc_fn * grid_calc
Definition interpf.h:128
double fi
Definition interpf.h:97
double x_orig
Definition interpf.h:112
double theta
Definition interpf.h:116
char * maskmap
Definition interpf.h:90
DCELL * adxy
Definition interpf.h:94
double rsm
Definition interpf.h:105
FILE * Tmp_fd_dx
Definition interpf.h:123
DCELL * adyy
Definition interpf.h:94
DCELL * adx
Definition interpf.h:94
double y_orig
Definition interpf.h:112
FILE * Tmp_fd_z
Definition interpf.h:123
DCELL * ady
Definition interpf.h:94
double dmin
Definition interpf.h:110
char * tcurv
Definition interpf.h:107
double scalex
Definition interpf.h:119
struct TimeStamp * ts
Definition interpf.h:121
char * mcurv
Definition interpf.h:107
FILE * Tmp_fd_dy
Definition interpf.h:123
wr_temp_fn * wr_temp
Definition interpf.h:140
char * aspect
Definition interpf.h:107
char * elev
Definition interpf.h:107
char * slope
Definition interpf.h:107
interpder_fn * interpder
Definition interpf.h:138
DCELL * adxx
Definition interpf.h:94
bool create_devi
Definition interpf.h:126
matrix_create_fn * matrix_create
Definition interpf.h:130