19 #include <grass/N_pde.h>
65 G_debug(5,
"N_create_gradient_2d: create N_gradient_2d");
87 G_debug(5,
"N_copy_gradient_2d: copy N_gradient_2d");
118 double NC = 0, SC = 0, WC = 0, EC = 0;
128 "N_get_gradient_2d: calculate N_gradient_2d NC %g SC %g WC %g EC %g",
188 double EC,
double TC,
double BC)
192 G_debug(5,
"N_create_gradient_3d: create N_gradient_3d");
216 G_debug(5,
"N_copy_gradient_3d: copy N_gradient_3d");
252 double NC, SC, WC, EC, TC, BC;
263 "N_get_gradient_3d: calculate N_gradient_3d NC %g SC %g WC %g EC %g TC %g BC %g",
264 NC, SC, WC, EC, TC, BC);
330 double NEN,
double WC,
331 double EC,
double SWS,
337 "N_create_gradient_neighbours_x: create N_gradient_neighbours_x");
363 G_debug(6,
"N_copy_gradient_neighbours_x: copy N_gradient_neighbours_x");
425 double NEE,
double NC,
426 double SC,
double SWW,
432 "N_create_gradient_neighbours_y: create N_gradient_neighbours_y");
458 G_debug(6,
"N_copy_gradient_neighbours_y: copy N_gradient_neighbours_y");
523 double NEZ,
double WZ,
524 double CZ,
double EZ,
525 double SWZ,
double SZ,
531 "N_create_gradient_neighbours_z: create N_gradient_neighbours_z");
560 G_debug(6,
"N_copy_gradient_neighbours_z: copy N_gradient_neighbours_z");
637 "N_create_gradient_neighbours_2d: create N_gradient_neighbours_2d");
669 "N_copy_gradient_neighbours_2d: copy N_gradient_neighbours_2d");
708 double NWN, NEN, WC, EC, SWS, SES;
709 double NWW, NEE, NC, SC, SWW, SEE;
734 "N_get_gradient_neighbours_2d: calculate N_gradient_neighbours_x NWN %g NEN %g WC %g EC %g SWS %g SES %g",
735 NWN, NEN, WC, EC, SWS, SES);
738 "N_get_gradient_neighbours_2d: calculate N_gradient_neighbours_y NWW %g NEE %g NC %g SC %g SWW %g SEE %g",
739 NWW, NEE, NC, SC, SWW, SEE);
838 "N_create_gradient_neighbours_3d: create N_gradient_neighbours_3d");
881 "N_copy_gradient_neighbours_3d: copy N_gradient_neighbours_3d");
925 "N_alloc_gradient_field_2d: allocate a N_gradient_field_2d struct");
969 G_debug(3,
"N_copy_gradient_field_2d: copy N_gradient_field_2d");
988 fprintf(stdout,
"N_gradient_field_2d \n");
989 fprintf(stdout,
"Cols %i\n", field->
cols);
990 fprintf(stdout,
"Rows: %i\n", field->
rows);
991 fprintf(stdout,
"X array pointer: %p\n", field->
x_array);
992 fprintf(stdout,
"Y array pointer: %p\n", field->
y_array);
993 fprintf(stdout,
"Min %g\n", field->
min);
994 fprintf(stdout,
"Max %g\n", field->
max);
995 fprintf(stdout,
"Sum %g\n", field->
sum);
996 fprintf(stdout,
"Mean %g\n", field->
mean);
997 fprintf(stdout,
"Nonull %i\n", field->
nonull);
998 fprintf(stdout,
"X array info \n");
1000 fprintf(stdout,
"Y array info \n");
1023 "N_alloc_gradient_field_3d: allocate a N_gradient_field_3d struct");
1072 G_debug(3,
"N_copy_gradient_field_3d: copy N_gradient_field_3d");
1093 fprintf(stdout,
"N_gradient_field_3d \n");
1094 fprintf(stdout,
"Cols %i\n", field->
cols);
1095 fprintf(stdout,
"Rows: %i\n", field->
rows);
1096 fprintf(stdout,
"Depths %i\n", field->
depths);
1097 fprintf(stdout,
"X array pointer: %p\n", field->
x_array);
1098 fprintf(stdout,
"Y array pointer: %p\n", field->
y_array);
1099 fprintf(stdout,
"Z array pointer: %p\n", field->
z_array);
1100 fprintf(stdout,
"Min %g\n", field->
min);
1101 fprintf(stdout,
"Max %g\n", field->
max);
1102 fprintf(stdout,
"Sum %g\n", field->
sum);
1103 fprintf(stdout,
"Mean %g\n", field->
mean);
1104 fprintf(stdout,
"Nonull %i\n", field->
nonull);
1105 fprintf(stdout,
"X array info \n");
1107 fprintf(stdout,
"Y array info \n");
1109 fprintf(stdout,
"Z array info \n");
void G_free(void *)
Free allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
void N_print_array_3d_info(N_array_3d *data)
Write the info of the array to stdout.
void N_free_array_3d(N_array_3d *data)
Release the memory of a N_array_3d.
DCELL N_get_array_2d_d_value(N_array_2d *data, int col, int row)
Returns the value of type DCELL at position col, row.
N_array_3d * N_alloc_array_3d(int cols, int rows, int depths, int offset, int type)
Allocate memory for a N_array_3d data structure.
void N_print_array_2d_info(N_array_2d *data)
This function writes the data info of the array data to stdout.
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
void N_free_array_2d(N_array_2d *data)
Release the memory of a N_array_2d structure.
double N_get_array_3d_d_value(N_array_3d *data, int col, int row, int depth)
This function returns the value of type float at position col, row, depth.
void N_copy_array_3d(N_array_3d *source, N_array_3d *target)
Copy the source N_array_3d struct to the target N_array_3d struct.
void N_copy_array_2d(N_array_2d *source, N_array_2d *target)
Copy the source N_array_2d struct to the target N_array_2d struct.
int N_copy_gradient_neighbours_2d(N_gradient_neighbours_2d *source, N_gradient_neighbours_2d *target)
copy a N_gradient_neighbours_2d structure
N_gradient_neighbours_y * N_alloc_gradient_neighbours_y(void)
Allocate a N_gradient_neighbours_y structure.
N_gradient_neighbours_3d * N_alloc_gradient_neighbours_3d(void)
Allocate a N_gradient_neighbours_3d structure.
int N_copy_gradient_3d(N_gradient_3d *source, N_gradient_3d *target)
copy a N_gradient_3d structure
N_gradient_2d * N_alloc_gradient_2d(void)
Allocate a N_gradient_2d structure.
N_gradient_3d * N_get_gradient_3d(N_gradient_field_3d *field, N_gradient_3d *gradient, int col, int row, int depth)
Return a N_gradient_3d structure calculated from the input gradient field at position [depth][row][co...
N_gradient_2d * N_create_gradient_2d(double NC, double SC, double WC, double EC)
allocate and initialize a N_gradient_2d structure
N_gradient_neighbours_2d * N_alloc_gradient_neighbours_2d(void)
Allocate a N_gradient_neighbours_2d structure.
void N_free_gradient_field_3d(N_gradient_field_3d *field)
Free's a N_gradient_neighbours_3d structure.
N_gradient_neighbours_2d * N_create_gradient_neighbours_2d(N_gradient_neighbours_x *x, N_gradient_neighbours_y *y)
Allocate and initialize a N_gradient_neighbours_2d structure.
int N_copy_gradient_field_3d(N_gradient_field_3d *source, N_gradient_field_3d *target)
Copy N_gradient_field_3d structure from source to target.
int N_copy_gradient_neighbours_x(N_gradient_neighbours_x *source, N_gradient_neighbours_x *target)
copy a N_gradient_neighbours_x structure
void N_free_gradient_neighbours_2d(N_gradient_neighbours_2d *grad)
Free's a N_gradient_neighbours_2d structure.
void N_print_gradient_field_2d_info(N_gradient_field_2d *field)
Print gradient field information to stdout.
N_gradient_neighbours_x * N_alloc_gradient_neighbours_x(void)
Allocate a N_gradient_neighbours_x structure.
N_gradient_neighbours_y * N_create_gradient_neighbours_y(double NWW, double NEE, double NC, double SC, double SWW, double SEE)
Allocate and initialize a N_gradient_neighbours_y structure.
void N_print_gradient_field_3d_info(N_gradient_field_3d *field)
Print gradient field information to stdout.
void N_free_gradient_neighbours_z(N_gradient_neighbours_z *grad)
Free's a N_gradient_neighbours_z structure.
int N_copy_gradient_neighbours_z(N_gradient_neighbours_z *source, N_gradient_neighbours_z *target)
copy a N_gradient_neighbours_z structure
int N_copy_gradient_neighbours_3d(N_gradient_neighbours_3d *source, N_gradient_neighbours_3d *target)
copy a N_gradient_neighbours_3d structure
N_gradient_field_2d * N_alloc_gradient_field_2d(int cols, int rows)
Allocate a N_gradient_field_2d.
N_gradient_neighbours_2d * N_get_gradient_neighbours_2d(N_gradient_field_2d *field, N_gradient_neighbours_2d *gradient, int col, int row)
Return a N_gradient_neighbours_2d structure calculated from the input gradient field at position [row...
N_gradient_3d * N_create_gradient_3d(double NC, double SC, double WC, double EC, double TC, double BC)
allocate and initialize a N_gradient_3d structure
N_gradient_3d * N_alloc_gradient_3d(void)
Allocate a N_gradient_3d structure.
N_gradient_2d * N_get_gradient_2d(N_gradient_field_2d *field, N_gradient_2d *gradient, int col, int row)
Return a N_gradient_2d structure calculated from the input gradient field at position [row][col].
void N_free_gradient_2d(N_gradient_2d *grad)
Free's a N_gradient_2d structure.
int N_copy_gradient_neighbours_y(N_gradient_neighbours_y *source, N_gradient_neighbours_y *target)
copy a N_gradient_neighbours_y structure
N_gradient_neighbours_z * N_alloc_gradient_neighbours_z(void)
Allocate a N_gradient_neighbours_z structure.
int N_copy_gradient_2d(N_gradient_2d *source, N_gradient_2d *target)
copy a N_gradient_2d structure
void N_free_gradient_3d(N_gradient_3d *grad)
Free's a N_gradient_3d structure.
void N_free_gradient_neighbours_y(N_gradient_neighbours_y *grad)
Free's a N_gradient_neighbours_y structure.
N_gradient_neighbours_x * N_create_gradient_neighbours_x(double NWN, double NEN, double WC, double EC, double SWS, double SES)
Allocate and initialize a N_gradient_neighbours_x structure.
N_gradient_field_3d * N_alloc_gradient_field_3d(int cols, int rows, int depths)
Allocate a N_gradient_field_3d.
void N_free_gradient_field_2d(N_gradient_field_2d *field)
Free's a N_gradient_neighbours_2d structure.
N_gradient_neighbours_3d * N_create_gradient_neighbours_3d(N_gradient_neighbours_x *xt, N_gradient_neighbours_x *xc, N_gradient_neighbours_x *xb, N_gradient_neighbours_y *yt, N_gradient_neighbours_y *yc, N_gradient_neighbours_y *yb, N_gradient_neighbours_z *zt, N_gradient_neighbours_z *zb)
Allocate and initialize a N_gradient_neighbours_3d structure.
void N_free_gradient_neighbours_x(N_gradient_neighbours_x *grad)
Free's a N_gradient_neighbours_x structure.
N_gradient_neighbours_z * N_create_gradient_neighbours_z(double NWZ, double NZ, double NEZ, double WZ, double CZ, double EZ, double SWZ, double SZ, double SEZ)
Allocate and initialize a N_gradient_neighbours_z structure.
int N_copy_gradient_field_2d(N_gradient_field_2d *source, N_gradient_field_2d *target)
Copy N_gradient_field_2d structure from source to target.
void N_free_gradient_neighbours_3d(N_gradient_neighbours_3d *grad)
Free's a N_gradient_neighbours_3d structure.
Gradient between the cells in X and Y direction.
Gradient between the cells in X, Y and Z direction.
Gradient between the cell neighbours in X and Y direction.
N_gradient_neighbours_y * y
N_gradient_neighbours_x * x
Gradient between the cell neighbours in X, Y and Z direction.
N_gradient_neighbours_y * yb
N_gradient_neighbours_z * zb
N_gradient_neighbours_y * yt
N_gradient_neighbours_z * zt
N_gradient_neighbours_y * yc
N_gradient_neighbours_x * xb
N_gradient_neighbours_x * xt
N_gradient_neighbours_x * xc
Gradient between the cell neighbours in X direction.
Gradient between the cell neighbours in Y direction.
Gradient between the cell neighbours in Z direction.