18#include <grass/N_pde.h>
77 struct Cell_head region2d;
82 G_debug(2,
"N_init_geom_data_3d: initializing the geometry structure");
87 geom->
dz = region3d->tb_res *
90 geom->
depths = region3d->depths;
95 Rast3d_region_to_cell_head(region3d, ®ion2d);
120 struct Cell_head backup;
129 G_debug(2,
"N_init_geom_data_2d: initializing the geometry structure");
134 Rast_set_window(region);
148 geom->
rows = region->rows;
149 geom->
cols = region->cols;
150 geom->
dx = region->ew_res * meters;
151 geom->
dy = region->ns_res * meters;
152 geom->
Az = geom->
dy * geom->
dx;
161 G_debug(2,
"N_init_geom_data_2d: calculating the areas for non "
162 "parametric projection");
168 geom->
area = G_calloc(geom->
rows,
sizeof(
double));
171 for (i = 0; i < geom->
rows; i++) {
177 Rast_set_window(&backup);
199 G_debug(6,
"N_get_geom_data_area_of_cell: %g", geom->
Az);
203 G_debug(6,
"N_get_geom_data_area_of_cell: %g", geom->
area[row]);
204 return geom->
area[row];
void G_free(void *buf)
Free allocated memory.
double G_area_of_cell_at_row(int row)
Cell area in specified row.
int G_begin_cell_area_calculations(void)
Begin cell area calculations.
int G_debug(int level, const char *msg,...)
Print debugging message.
void G_get_set_window(struct Cell_head *window)
Get the current working window (region)
N_geom_data * N_alloc_geom_data(void)
Allocate the pde geometry data structure and return a pointer to the new allocated structure.
double N_get_geom_data_area_of_cell(N_geom_data *geom, int row)
Get the areay size in square meter of one cell (x*y) at row.
N_geom_data * N_init_geom_data_3d(RASTER3D_Region *region3d, N_geom_data *geodata)
Initiate a pde geometry data structure with a 3d region.
N_geom_data * N_init_geom_data_2d(struct Cell_head *region, N_geom_data *geodata)
Initiate a pde geometry data structure with a 2d region.
void N_free_geom_data(N_geom_data *geom)
Release memory of a pde geometry data structure.
double G_database_units_to_meters_factor(void)
Conversion to meters.
Geometric information about the structured grid.