GRASS Programmer's Manual
6.4.2(2012)
|
00001 /* 00002 * modified by Brown in June 1999 - added elatt & smatt 00003 * modified by Mitasova Nov. 9, 1999 - added parameter for dtens to output2d 00004 */ 00005 #include <grass/Vect.h> 00006 #include <grass/bitmap.h> 00007 #include <grass/dataquad.h> 00008 #include <grass/qtree.h> 00009 #include <grass/dbmi.h> 00010 00011 /* for resample program */ 00012 struct fcell_triple 00013 { 00014 double x; 00015 double y; 00016 FCELL z; 00017 double smooth; 00018 }; 00019 00020 #ifdef POINT2D_C 00021 struct line_pnts *Pnts; 00022 struct line_cats *Cats2; 00023 dbDriver *driver2; 00024 dbString sql2; 00025 struct Map_info Map2; 00026 struct field_info *ff; 00027 int count; 00028 #else 00029 extern struct line_pnts *Pnts; 00030 extern struct line_cats *Cats2; 00031 extern dbDriver *driver2; 00032 extern dbString sql2; 00033 extern struct Map_info Map2; 00034 extern struct field_info *ff; 00035 extern int count; 00036 #endif 00037 00038 struct interp_params 00039 { 00040 double zmult; /* multiplier for z-values */ 00041 FILE *fdinp; /* input stream */ 00042 int elatt; /* which floating point attr to use? first = 1, second = 2, etc */ 00043 int smatt; /* which floating point attr to use for smoothing? first = 1, second = 2, etc */ 00044 int kmin; /* min number of points per segment for interpolation */ 00045 int kmax; /* max number of points per segment */ 00046 char *maskmap; /* name of mask */ 00047 int nsizr, nsizc; /* number of rows and columns */ 00048 DCELL *az, *adx, *ady, *adxx, *adyy, *adxy; /* array for interpolated values */ 00049 double fi; /* tension */ 00050 int KMAX2; /* max num. of points for interp. */ 00051 int scik1, scik2, scik3; /* multipliers for interp. values */ 00052 double rsm; /* smoothing */ 00053 char *elev, *slope, *aspect, *pcurv, *tcurv, *mcurv; /* output files */ 00054 double dmin; /* min distance between points */ 00055 double x_orig, y_orig; /* origin */ 00056 int deriv, cv; /* 1 if compute partial derivs */ 00057 double theta; /* anisotropy angle, 0=East,counter-clockwise */ 00058 double scalex; /* anisotropy scaling factor */ 00059 struct TimeStamp *ts; /* timestamp for raster files */ 00060 FILE *Tmp_fd_z, *Tmp_fd_dx, *Tmp_fd_dy, /* temp files for writing interp. */ 00061 *Tmp_fd_xx, *Tmp_fd_yy, *Tmp_fd_xy; /* values */ 00062 FILE *fddevi; /* pointer to deviations file */ 00063 00064 int (*grid_calc) (); /*calculates grid for given segm */ 00065 int (*matrix_create) (); /*creates matrix for a given segm */ 00066 int (*check_points) (); /*checks interp. func. at points */ 00067 int (*secpar) (); /* calculates aspect,slope,curv. */ 00068 double (*interp) (); /* radial based interp. function */ 00069 int (*interpder) (); /* interp. func. for derivatives */ 00070 int (*wr_temp) (); /* writes temp files */ 00071 char *wheresql; /* SQL statement to select input points */ 00072 }; 00073 00074 /* distance.c */ 00075 double IL_dist_square(double *, double *, int); 00076 00077 /* func2d.c */ 00078 double IL_crst(double, double); 00079 int IL_crstg(double, double, double *, double *); 00080 00081 /* init2d.c */ 00082 void IL_init_params_2d(struct interp_params *, FILE *, int, int, double, 00083 int, int, char *, int, int, 00084 DCELL *, DCELL *, DCELL *, DCELL *, DCELL *, DCELL *, 00085 double, int, int, int, int, double, 00086 char *, char *, char *, char *, char *, char *, 00087 double, double, double, int, double, double, 00088 FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, 00089 struct TimeStamp *, int, char *); 00090 00091 void IL_init_func_2d(struct interp_params *, int (*)(), int (*)(), int (*)(), 00092 int (*)(), double (*)(), int (*)(), int (*)()); 00093 /* input2d.c */ 00094 int IL_input_data_2d(struct interp_params *, struct tree_info *, double *, 00095 double *, double *, double *, double *, double *, int *); 00096 struct BM *IL_create_bitmask(struct interp_params *); 00097 int translate_quad(struct multtree *, double, double, double, int); 00098 00099 /* interp2d.c */ 00100 int IL_grid_calc_2d(struct interp_params *, struct quaddata *, struct BM *, 00101 double, double, double *, double *, double *, double *, 00102 double *, double *, double *, double *, double *, 00103 double *, int, double); 00104 /* matrix.c */ 00105 int IL_matrix_create(struct interp_params *, struct triple *, int, double **, 00106 int *); 00107 /* minmax.c */ 00108 int min1(int, int); 00109 int max1(int, int); 00110 double amax1(double, double); 00111 double amin1(double, double); 00112 00113 /* newsegm2d.c */ 00114 int IL_interp_segments_new_2d(struct interp_params *, struct tree_info *, 00115 struct multtree *, struct BM *, double, double, 00116 double *, double *, double *, double *, 00117 double *, double *, double *, double *, 00118 double *, int, int, double); 00119 /* output2d.c */ 00120 int IL_output_2d(struct interp_params *, struct Cell_head *, double, double, 00121 double, double, double, double, double, double, double, 00122 double, double, char *, double, int, int, int); 00123 /* point2d.c */ 00124 int IL_check_at_points_2d(struct interp_params *, struct quaddata *, double *, 00125 double *, double, double, struct triple); 00126 /* resout2d.c */ 00127 /* resout2dmod.c */ 00128 int IL_resample_output_2d(struct interp_params *, double, double, double, 00129 double, double, double, double, double, double, 00130 double, double, char *, double *, 00131 struct Cell_head *, struct Cell_head *, char *, 00132 int); 00133 /* ressegm2d.c */ 00134 int IL_resample_interp_segments_2d(struct interp_params *, struct BM *, 00135 double, double, double *, double *, 00136 double *, double *, double *, double *, 00137 double *, double *, double *, int, 00138 double *, int, int, int, int, int, double, 00139 double, double, double, int); 00140 /* secpar2d.c */ 00141 int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *, 00142 double *, double *, double *, double *, double *, 00143 double *, int, int); 00144 /* segmen2d.c */ 00145 int IL_interp_segments_2d(struct interp_params *, struct tree_info *, 00146 struct multtree *, struct BM *, double, double, 00147 double *, double *, double *, double *, double *, 00148 double *, double *, double *, double *, int, int, 00149 double); 00150 /* vinput2d.c */ 00151 int IL_vector_input_data_2d(struct interp_params *, struct Map_info *, int, 00152 char *, char *, struct tree_info *, double *, 00153 double *, double *, double *, double *, double *, 00154 int *, double *); 00155 int process_point(double, double, double, double, struct tree_info *, double, 00156 double *, double *, double *, double *, double *, double *, 00157 int *, int *, int *); 00158 /* write2d.c */ 00159 int IL_write_temp_2d(struct interp_params *, int, int, int);