Loading...
Searching...
No Matches
init2d.c
Go to the documentation of this file.
/*!
* \file init2d.c
*
* \brief Initialization of interpolation library data structures
*
* \author H. Mitasova, I. Kosinovsky, D. Gerdes Fall 1993 (original authors)
* \author modified by McCauley in August 1995
* \author modified by Mitasova in August 1995
* \author modified by Brown in June 1999 - added elatt & smatt
*
* \copyright
* (C) 1993-1999 by Helena Mitasova and the GRASS Development Team
*
* \copyright
* This program is free software under the
* GNU General Public License (>=v2).
* Read the file COPYING that comes with GRASS
* for details.
*
*/
#include <stdbool.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/interpf.h>
/*! Initializes parameters used by the library */
void IL_init_params_2d(
struct interp_params *params, FILE *inp, /*!< input stream */
int elatt, /*!< which fp att in sites file? 1 = first */
int smatt, /*!< which fp att in sites file to use for
* smoothing? (if zero use sm) 1 = first */
double zm, /*!< multiplier for z-values */
int k1, /*!< min number of points per segment for interpolation */
int k2, /*!< max number of points per segment */
char *msk, /*!< name of mask */
int rows, int cols, /*!< number of rows and columns */
DCELL *ar1, DCELL *ar2, DCELL *ar3, DCELL *ar4, DCELL *ar5,
DCELL *ar6, /*!< arrays for interpolated values (ar1-ar6) */
double tension, /*!< tension */
int k3, /*!< max number of points for interpolation */
int sc1, int sc2, int sc3, /*!< multipliers for interpolation values */
double sm, /*!< smoothing */
char *f1, char *f2, char *f3, char *f4, char *f5,
char *f6, /*!< output files (f1-f6) */
double dm, /*!< min distance between points */
double x_or, /*!< x of origin */
double y_or, /*!< y of origin */
int der, /*!< 1 if compute partial derivatives */
double tet, /*!< anisotropy angle (0 is East, counter-clockwise) */
double scl, /*!< anisotropy scaling factor */
FILE *t1, FILE *t2, FILE *t3, FILE *t4, FILE *t5,
FILE *t6, /*!< temp files for writing interp. values (t1-t6) */
bool create_devi, /*!< create deviations file? */
struct TimeStamp *ts, int c, /*!< cross validation */
const char *wheresql /*!< SQL WHERE statement */
)
{
params->fdinp = inp;
params->elatt = elatt;
params->smatt = smatt;
params->zmult = zm;
params->kmin = k1;
params->kmax = k2;
params->maskmap = msk;
params->nsizr = rows;
params->nsizc = cols;
params->az = ar1;
params->adx = ar2;
params->ady = ar3;
params->adxx = ar4;
params->adyy = ar5;
params->adxy = ar6;
params->fi = tension;
params->KMAX2 = k3;
params->scik1 = sc1;
params->scik2 = sc2;
params->scik3 = sc3;
params->rsm = sm;
params->elev = f1;
params->slope = f2;
params->aspect = f3;
params->pcurv = f4;
params->tcurv = f5;
params->mcurv = f6;
params->dmin = dm;
params->x_orig = x_or;
params->y_orig = y_or;
params->deriv = der;
params->theta = tet;
params->scalex = scl;
params->Tmp_fd_z = t1;
params->Tmp_fd_dx = t2;
params->Tmp_fd_dy = t3;
params->Tmp_fd_xx = t4;
params->Tmp_fd_yy = t5;
params->Tmp_fd_xy = t6;
params->create_devi = create_devi;
params->ts = ts;
params->cv = c;
params->wheresql = wheresql;
}
/*! Initializes functions used by the library */
void IL_init_func_2d(
struct interp_params *params,
grid_calc_fn *grid_f, /*!< calculates grid for given segment */
matrix_create_fn *matr_f, /*!< creates matrix for a given segment */
check_points_fn *point_f, /*!< checks interpolation function at points */
secpar_fn *secp_f, /*!< calculates aspect, slope, curvature */
interp_fn *interp_f, /*!< radial basis function */
interpder_fn *interpder_f, /*!< derivatives of radial basis function */
wr_temp_fn *temp_f /*!< writes temp files */
)
{
params->grid_calc = grid_f;
params->matrix_create = matr_f;
params->check_points = point_f;
params->secpar = secp_f;
params->interp = interp_f;
params->interpder = interpder_f;
params->wr_temp = temp_f;
}
IL_init_func_2d
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
IL_init_params_2d
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
interp_fn
double interp_fn(double, double)
Definition interpf.h:64
interpder_fn
int interpder_fn(double, double, double *, double *)
Definition interpf.h:66
secpar_fn
int secpar_fn(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
Definition interpf.h:60
wr_temp_fn
int wr_temp_fn(struct interp_params *, int, int, off_t)
Definition interpf.h:68
check_points_fn
int check_points_fn(struct interp_params *, struct quaddata *, double *, double *, double, double, struct triple *)
Definition interpf.h:57
matrix_create_fn
int matrix_create_fn(struct interp_params *, struct triple *, int, double **, int *)
Definition interpf.h:54
grid_calc_fn
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
interp_params
Definition interpf.h:70
interp_params::check_points
check_points_fn * check_points
Definition interpf.h:132
interp_params::zmult
double zmult
Definition interpf.h:72
interp_params::Tmp_fd_xx
FILE * Tmp_fd_xx
Definition interpf.h:123
interp_params::Tmp_fd_xy
FILE * Tmp_fd_xy
Definition interpf.h:123
interp_params::scik2
int scik2
Definition interpf.h:102
interp_params::az
DCELL * az
Definition interpf.h:94
interp_params::pcurv
char * pcurv
Definition interpf.h:107
interp_params::interp
interp_fn * interp
Definition interpf.h:136
interp_params::secpar
secpar_fn * secpar
Definition interpf.h:134
interp_params::deriv
int deriv
Definition interpf.h:114
interp_params::fdinp
FILE * fdinp
Definition interpf.h:74
interp_params::wheresql
const char * wheresql
Definition interpf.h:142
interp_params::Tmp_fd_yy
FILE * Tmp_fd_yy
Definition interpf.h:123
interp_params::grid_calc
grid_calc_fn * grid_calc
Definition interpf.h:128
interp_params::fi
double fi
Definition interpf.h:97
interp_params::x_orig
double x_orig
Definition interpf.h:112
interp_params::theta
double theta
Definition interpf.h:116
interp_params::cv
int cv
Definition interpf.h:114
interp_params::maskmap
char * maskmap
Definition interpf.h:90
interp_params::adxy
DCELL * adxy
Definition interpf.h:94
interp_params::scik3
int scik3
Definition interpf.h:102
interp_params::rsm
double rsm
Definition interpf.h:105
interp_params::Tmp_fd_dx
FILE * Tmp_fd_dx
Definition interpf.h:123
interp_params::adyy
DCELL * adyy
Definition interpf.h:94
interp_params::adx
DCELL * adx
Definition interpf.h:94
interp_params::y_orig
double y_orig
Definition interpf.h:112
interp_params::nsizr
int nsizr
Definition interpf.h:92
interp_params::Tmp_fd_z
FILE * Tmp_fd_z
Definition interpf.h:123
interp_params::ady
DCELL * ady
Definition interpf.h:94
interp_params::nsizc
int nsizc
Definition interpf.h:92
interp_params::dmin
double dmin
Definition interpf.h:110
interp_params::tcurv
char * tcurv
Definition interpf.h:107
interp_params::scalex
double scalex
Definition interpf.h:119
interp_params::ts
struct TimeStamp * ts
Definition interpf.h:121
interp_params::mcurv
char * mcurv
Definition interpf.h:107
interp_params::Tmp_fd_dy
FILE * Tmp_fd_dy
Definition interpf.h:123
interp_params::wr_temp
wr_temp_fn * wr_temp
Definition interpf.h:140
interp_params::aspect
char * aspect
Definition interpf.h:107
interp_params::elev
char * elev
Definition interpf.h:107
interp_params::elatt
int elatt
Definition interpf.h:76
interp_params::kmin
int kmin
Definition interpf.h:84
interp_params::slope
char * slope
Definition interpf.h:107
interp_params::smatt
int smatt
Definition interpf.h:80
interp_params::kmax
int kmax
Definition interpf.h:87
interp_params::interpder
interpder_fn * interpder
Definition interpf.h:138
interp_params::KMAX2
int KMAX2
Definition interpf.h:99
interp_params::adxx
DCELL * adxx
Definition interpf.h:94
interp_params::create_devi
bool create_devi
Definition interpf.h:126
interp_params::matrix_create
matrix_create_fn * matrix_create
Definition interpf.h:130
interp_params::scik1
int scik1
Definition interpf.h:102