20 #include <grass/N_pde.h> 54 (
"N_copy_array_2d: the arrays are not of equal size");
58 (
"N_copy_array_2d: the arrays are not of equal size");
61 "N_copy_array_2d: copy source array to target array size %i",
151 double norm = 0.0, tmp = 0.0;
152 double v1 = 0.0, v2 = 0.0;
155 G_fatal_error(
"N_norm_array_2d: the arrays are not of equal size");
158 G_fatal_error(
"N_norm_array_2d: the arrays are not of equal size");
160 G_debug(3,
"N_norm_array_2d: norm of a and b size %i",
198 norm += fabs(v2 - v1);
220 double *sum,
int *nonull,
int withoffset)
228 if (withoffset == 1) {
255 for (j = 0; j < a->
rows; j++) {
256 for (i = 0; i < a->
cols; i++) {
271 "N_calc_array_2d_stats: compute array stats, min %g, max %g, sum %g, nonull %i",
272 *min, *max, *sum, *nonull);
312 int i, j, setnull = 0;
313 double va = 0.0, vb = 0.0, vc = 0.0;
323 (
"N_math_array_2d: the arrays are not of equal size");
326 (
"N_math_array_2d: the arrays are not of equal size");
329 (
"N_math_array_2d: the arrays have different offsets");
331 G_debug(3,
"N_math_array_2d: mathematical calculations, size: %i",
340 "N_math_array_2d: array of type DCELL_TYPE created");
345 "N_math_array_2d: array of type FCELL_TYPE created");
350 "N_math_array_2d: array of type CELL_TYPE created");
357 (
"N_math_array_2d: the arrays are not of equal size");
360 (
"N_math_array_2d: the arrays are not of equal size");
363 (
"N_math_array_2d: the arrays have different offsets");
367 #pragma omp for private(va, vb, vc, setnull) 436 int i = 0,
count = 0;
438 G_debug(3,
"N_convert_array_2d_null_to_zero: convert array of size %i",
469 "N_convert_array_2d_null_to_zero: %i values of type CELL_TYPE are converted",
473 "N_convert_array_2d_null_to_zero: %i valuess of type FCELL_TYPE are converted",
477 "N_convert_array_2d_null_to_zero: %i valuess of type DCELL_TYPE are converted",
506 G_fatal_error(
"N_copy_array_3d: the arrays are not of equal size");
509 G_fatal_error(
"N_copy_array_3d: the arrays are not of equal size");
512 G_fatal_error(
"N_copy_array_3d: the arrays are not of equal size");
515 G_debug(3,
"N_copy_array_3d: copy source array to target array size %i",
579 double norm = 0.0, tmp = 0.0;
580 double v1 = 0.0, v2 = 0.0;
583 G_fatal_error(
"N_norm_array_3d: the arrays are not of equal size");
586 G_fatal_error(
"N_norm_array_3d: the arrays are not of equal size");
589 G_fatal_error(
"N_norm_array_3d: the arrays are not of equal size");
591 G_debug(3,
"N_norm_array_3d: norm of a and b size %i",
621 norm += fabs(v2 - v1);
643 double *sum,
int *nonull,
int withoffset)
651 if (withoffset == 1) {
660 for (k = 0 - a->
offset; k < a->depths + a->
offset; k++) {
681 for (k = 0; k < a->
depths; k++) {
682 for (j = 0; j < a->
rows; j++) {
683 for (i = 0; i < a->
cols; i++) {
699 "N_calc_array_3d_stats: compute array stats, min %g, max %g, sum %g, nonull %i",
700 *min, *max, *sum, *nonull);
743 int i, j, k, setnull = 0;
744 double va = 0.0, vb = 0.0, vc = 0.0;
751 G_fatal_error(
"N_math_array_3d: the arrays are not of equal size");
753 G_fatal_error(
"N_math_array_3d: the arrays are not of equal size");
755 G_fatal_error(
"N_math_array_3d: the arrays are not of equal size");
757 G_fatal_error(
"N_math_array_3d: the arrays have different offsets");
759 G_debug(3,
"N_math_array_3d: mathematical calculations, size: %i",
768 G_debug(3,
"N_math_array_3d: array of type DCELL_TYPE created");
773 G_debug(3,
"N_math_array_3d: array of type FCELL_TYPE created");
780 (
"N_math_array_3d: the arrays are not of equal size");
783 (
"N_math_array_3d: the arrays are not of equal size");
786 (
"N_math_array_3d: the arrays are not of equal size");
789 (
"N_math_array_3d: the arrays have different offsets");
792 for (k = 0 - a->
offset; k < a->depths + a->
offset; k++) {
854 int i = 0,
count = 0;
856 G_debug(3,
"N_convert_array_3d_null_to_zero: convert array of size %i",
880 "N_convert_array_3d_null_to_zero: %i values of type FCELL_TYPE are converted",
885 "N_convert_array_3d_null_to_zero: %i values of type DCELL_TYPE are converted",
void N_put_array_2d_value_null(N_array_2d *data, int col, int row)
Writes the null value to the N_array_2d struct at position col, row.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void Rast_set_c_null_value(CELL *, int)
To set a number of CELL raster values to NULL.
void N_calc_array_2d_stats(N_array_2d *a, double *min, double *max, double *sum, int *nonull, int withoffset)
Calculate basic statistics of the N_array_2d struct.
#define Rast_is_d_null_value(dcellVal)
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.
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.
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_put_array_3d_f_value(N_array_3d *data, int col, int row, int depth, float value)
This function writes a float value to the N_array_3d data at position col, row, depth.
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 Rast3d_set_null_value(void *, int, int)
Fills the vector pointed to by c with nofElts NULL-values of type.
#define Rast_is_f_null_value(fcellVal)
int N_convert_array_3d_null_to_zero(N_array_3d *a)
Convert all null values to zero values.
void N_put_array_2d_c_value(N_array_2d *data, int col, int row, CELL value)
Writes a CELL value to the N_array_2d struct at position col, row.
void N_put_array_2d_f_value(N_array_2d *data, int col, int row, FCELL value)
Writes a FCELL value to the N_array_2d struct at position col, row.
void N_put_array_3d_value_null(N_array_3d *data, int col, int row, int depth)
This function writes a null value to the N_array_3d data at position col, row, depth.
int N_convert_array_2d_null_to_zero(N_array_2d *a)
Convert all null values to zero values.
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.
N_array_2d * N_math_array_2d(N_array_2d *a, N_array_2d *b, N_array_2d *result, int type)
Perform calculations with two input arrays, the result is written to a third array.
void N_put_array_3d_d_value(N_array_3d *data, int col, int row, int depth, double value)
Writes a double value to the N_array_3d struct at position col, row, depth.
void Rast_set_f_null_value(FCELL *, int)
To set a number of FCELL raster values to NULL.
int N_is_array_2d_value_null(N_array_2d *data, int col, int row)
Returns 1 if the value of N_array_2d struct at position col, row is of type null, otherwise 0...
double N_norm_array_3d(N_array_3d *a, N_array_3d *b, int type)
Calculate the norm of the two input arrays.
double N_norm_array_2d(N_array_2d *a, N_array_2d *b, int type)
Calculate the norm of the two input arrays.
void N_put_array_2d_d_value(N_array_2d *data, int col, int row, DCELL value)
Writes a DCELL value to the N_array_2d struct at position col, row.
void N_calc_array_3d_stats(N_array_3d *a, double *min, double *max, double *sum, int *nonull, int withoffset)
Calculate basic statistics of the N_array_3d struct.
int Rast3d_is_null_value_num(const void *, int)
N_array_3d * N_math_array_3d(N_array_3d *a, N_array_3d *b, N_array_3d *result, int type)
Perform calculations with two input arrays, the result is written to a third array.
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.
#define Rast_is_c_null_value(cellVal)
int G_debug(int, const char *,...) __attribute__((format(printf
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
int N_is_array_3d_value_null(N_array_3d *data, int col, int row, int depth)
This function returns 1 if value of N_array_3d data at position col, row, depth is of type null...