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