GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
init2d.c
Go to the documentation of this file.
1 
2 /*-
3  * Written by H. Mitasova, I. Kosinovsky, D. Gerdes Fall 1993
4  * Copyright 1993, H. Mitasova ,
5  * I. Kosinovsky, and D.Gerdes
6  *
7  * modified by McCauley in August 1995
8  * modified by Mitasova in August 1995
9  * modified by Brown in June 1999 - added elatt & smatt
10  *
11  */
12 
13 #include <stdio.h>
14 #include <math.h>
15 #include <unistd.h>
16 #include <grass/gis.h>
17 #include <grass/interpf.h>
18 
20  /* initialize parameters */
21  struct interp_params *params, FILE * inp, /* input stream */
22  int elatt, /* which fp att in sites file? 1 = first */
23  int smatt, /* which fp att in sites file to use for
24  * smoothing? (if zero use sm) 1 = first */
25  double zm, /* multiplier for z-values */
26  int k1, /* min number of points per segment for
27  * interpolation */
28  int k2, /* max number of points per segment */
29  char *msk, /* name of mask */
30  int rows, int cols, /* number of rows and columns */
31  DCELL * ar1, DCELL * ar2, DCELL * ar3, DCELL * ar4, DCELL * ar5, DCELL * ar6, /* arrays for interpolated
32  * values */
33  double tension, /* tension */
34  int k3, /* max num. of points for interp. */
35  int sc1, int sc2, int sc3, /* multipliers for interp. values */
36  double sm, /* smoothing */
37  char *f1, char *f2, char *f3, char *f4, char *f5, char *f6, /* output files */
38  double dm, /* min distance between points */
39  double x_or, double y_or, /* origin */
40  int der, /* 1 if compute partial derivs */
41  double tet, /* anisotropy angle, 0=East,counter-clockwise */
42  double scl, /* anisotropy scaling factor */
43  FILE * t1, FILE * t2, FILE * t3, FILE * t4, FILE * t5, FILE * t6, /* temp files for writing interp. values */
44  FILE * dev, /* pointer to deviations file */
45  struct TimeStamp *ts, int c, /* cross validation */
46  char *wheresql /* SQL WHERE */
47  )
48 {
49  params->fdinp = inp;
50  params->elatt = elatt;
51  params->smatt = smatt;
52  params->zmult = zm;
53  params->kmin = k1;
54  params->kmax = k2;
55  params->maskmap = msk;
56  params->nsizr = rows;
57  params->nsizc = cols;
58  params->az = ar1;
59  params->adx = ar2;
60  params->ady = ar3;
61  params->adxx = ar4;
62  params->adyy = ar5;
63  params->adxy = ar6;
64  params->fi = tension, params->KMAX2 = k3;
65  params->scik1 = sc1;
66  params->scik2 = sc2;
67  params->scik3 = sc3;
68  params->rsm = sm;
69  params->elev = f1;
70  params->slope = f2;
71  params->aspect = f3;
72  params->pcurv = f4;
73  params->tcurv = f5;
74  params->mcurv = f6;
75  params->dmin = dm;
76  params->x_orig = x_or;
77  params->y_orig = y_or;
78  params->deriv = der;
79  params->theta = tet;
80  params->scalex = scl;
81  params->Tmp_fd_z = t1;
82  params->Tmp_fd_dx = t2;
83  params->Tmp_fd_dy = t3;
84  params->Tmp_fd_xx = t4;
85  params->Tmp_fd_yy = t5;
86  params->Tmp_fd_xy = t6;
87  params->fddevi = dev;
88  params->ts = ts;
89  params->cv = c;
90  params->wheresql = wheresql;
91 }
92 
93 void IL_init_func_2d(struct interp_params *params, int (*grid_f) (void), /* calculates grid for given segm */
94  int (*matr_f) (void), /* creates matrix for a given segm */
95  int (*point_f) (void), /* checks interp. func. at points */
96  int (*secp_f) (void), /* calculates aspect,slope,curv. */
97  double (*interp_f) (void), /* radial basis function */
98  int (*interpder_f) (void), /* derivatives of radial basis func. */
99  int (*temp_f) (void) /* writes temp files */
100  )
101 
102 /* initialize functions */
103 {
104  params->grid_calc = grid_f;
105  params->matrix_create = matr_f;
106  params->check_points = point_f;
107  params->secpar = secp_f;
108  params->interp = interp_f;
109  params->interpder = interpder_f;
110  params->wr_temp = temp_f;
111 
112 }
double rsm
Definition: interpf.h:52
int(* secpar)()
Definition: interpf.h:67
double scalex
Definition: interpf.h:58
char * mcurv
Definition: interpf.h:53
FILE * Tmp_fd_xy
Definition: interpf.h:60
FILE * Tmp_fd_yy
Definition: interpf.h:60
int(* wr_temp)()
Definition: interpf.h:70
double theta
Definition: interpf.h:57
DCELL * adxx
Definition: interpf.h:48
double y_orig
Definition: interpf.h:55
char * elev
Definition: interpf.h:53
char * pcurv
Definition: interpf.h:53
int(* interpder)()
Definition: interpf.h:69
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, char *wheresql)
Definition: init2d.c:19
double(* interp)()
Definition: interpf.h:68
FILE * Tmp_fd_xx
Definition: interpf.h:60
DCELL * adx
Definition: interpf.h:48
void IL_init_func_2d(struct interp_params *params, int(*grid_f)(void), int(*matr_f)(void), int(*point_f)(void), int(*secp_f)(void), double(*interp_f)(void), int(*interpder_f)(void), int(*temp_f)(void))
Definition: init2d.c:93
FILE * fddevi
Definition: interpf.h:62
FILE * Tmp_fd_dx
Definition: interpf.h:60
int(* matrix_create)()
Definition: interpf.h:65
char * aspect
Definition: interpf.h:53
DCELL * az
Definition: interpf.h:48
double fi
Definition: interpf.h:49
double x_orig
Definition: interpf.h:55
char * tcurv
Definition: interpf.h:53
DCELL * ady
Definition: interpf.h:48
FILE * Tmp_fd_dy
Definition: interpf.h:60
tuple cols
char * maskmap
Definition: interpf.h:46
double dmin
Definition: interpf.h:54
FILE * fdinp
Definition: interpf.h:41
FILE * Tmp_fd_z
Definition: interpf.h:60
double zmult
Definition: interpf.h:40
DCELL * adxy
Definition: interpf.h:48
struct TimeStamp * ts
Definition: interpf.h:59
int(* check_points)()
Definition: interpf.h:66
int(* grid_calc)()
Definition: interpf.h:64
char * wheresql
Definition: interpf.h:71
char * slope
Definition: interpf.h:53
DCELL * adyy
Definition: interpf.h:48