17#include <grass/N_pde.h>
76 if (rows < 1 || cols < 1)
77 G_fatal_error(
"N_alloc_array_2d: cols and rows should be > 0");
80 G_fatal_error(
"N_alloc_array_2d: Wrong data type, should be CELL_TYPE, "
81 "FCELL_TYPE or DCELL_TYPE");
99 "N_alloc_array_2d: CELL array allocated rows_intern %i "
100 "cols_intern %i offset %i",
107 "N_alloc_array_2d: FCELL array allocated rows_intern %i "
108 "cols_intern %i offset %i",
115 "N_alloc_array_2d: DCELL array allocated rows_intern %i "
116 "cols_intern %i offset %i",
133 G_debug(3,
"N_free_array_2d: free N_array_2d");
234 "N_is_array_2d_value_null: null value is of type CELL at "
243 "N_is_array_2d_value_null: null value is of type FCELL at "
252 "N_is_array_2d_value_null: null value is of type DCELL at "
263 "N_is_array_2d_value_null: null value is of type CELL at "
274 "N_is_array_2d_value_null: null value is of type FCELL at "
285 "N_is_array_2d_value_null: null value is of type DCELL at "
317 switch (data->
type) {
350 switch (data->
type) {
383 switch (data->
type) {
412 G_debug(6,
"N_put_array_2d_value: put value to array");
460 "N_put_array_2d_value_null: put null value to array pos [%i][%i]",
518 switch (data->
type) {
548 switch (data->
type) {
578 switch (data->
type) {
721 if (rows < 1 || cols < 1 || depths < 1)
722 G_fatal_error(
"N_alloc_array_3d: depths, cols and rows should be > 0");
725 G_fatal_error(
"N_alloc_array_3d: Wrong data type, should be FCELL_TYPE "
746 "N_alloc_array_3d: float array allocated rows_intern %i "
747 "cols_intern %i depths_intern %i offset %i",
756 "N_alloc_array_3d: double array allocated rows_intern %i "
757 "cols_intern %i depths_intern %i offset %i",
775 G_debug(3,
"N_free_array_3d: free N_array_3d");
876 "N_is_array_3d_value_null: null value is of type "
877 "DCELL_TYPE at pos [%i][%i][%i]",
887 "N_is_array_3d_value_null: null value is of type "
888 "DCELL_TYPE at pos [%i][%i][%i]",
900 "N_is_array_3d_value_null: null value is of type "
901 "DCELL_TYPE at pos [%i][%i][%i]",
914 "N_is_array_3d_value_null: null value is of type "
915 "DCELL_TYPE at pos [%i][%i][%i]",
950 switch (data->
type) {
981 switch (data->
type) {
1011 G_debug(6,
"N_put_array_3d_value: put value to array at pos [%i][%i][%i]",
1032 (
col + data->
offset)] = *((
float *)value);
1038 (
col + data->
offset)] = *((
double *)value);
1061 "N_put_array_3d_value_null: put null value to array at pos "
1199 for (k = 0; k < data->
depths; k++) {
1200 for (
j = 0;
j < data->
rows;
j++) {
1201 for (i = 0; i < data->
cols; i++) {
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void Rast3d_set_null_value(void *, int, int)
Fills the vector pointed to by c with nofElts NULL-values of type.
int Rast3d_is_null_value_num(const void *, int)
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
void Rast_set_f_null_value(FCELL *, int)
To set a number of FCELL raster values to NULL.
void Rast_set_c_null_value(CELL *, int)
To set a number of CELL raster values to NULL.
FCELL N_get_array_2d_f_value(N_array_2d *data, int col, int row)
Returns the value of type FCELL 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.
void N_print_array_3d_info(N_array_3d *data)
Write the info of the array to stdout.
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.
CELL N_get_array_2d_c_value(N_array_2d *data, int col, int row)
Returns the value of type CELL 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.
float N_get_array_3d_f_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_free_array_3d(N_array_3d *data)
Release the memory of a N_array_3d.
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.
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.
int N_get_array_2d_type(N_array_2d *array)
Return the data type of the N_array_2d struct.
void N_put_array_3d_value(N_array_3d *data, int col, int row, int depth, char *value)
This function writes a value to the N_array_3d data at position col, row, depth.
void N_print_array_2d(N_array_2d *data)
Write info and content of the N_array_2d struct to stdout.
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,...
void N_get_array_2d_value(N_array_2d *data, int col, int row, void *value)
Write the value of the N_array_2d struct at position col, row to value.
void N_put_array_2d_value(N_array_2d *data, int col, int row, char *value)
Writes a value to the N_array_2d struct at position col, row.
void N_print_array_2d_info(N_array_2d *data)
This function writes the data info of the array data to stdout.
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.
void N_free_array_2d(N_array_2d *data)
Release the memory of a N_array_2d structure.
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.
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data 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_get_array_3d_value(N_array_3d *data, int col, int row, int depth, void *value)
This function writes the value of N_array_3d data at position col, row, depth to the variable value.
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 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_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.
int N_get_array_3d_type(N_array_3d *array)
Return the data type of the N_array_3d.
void N_print_array_3d(N_array_3d *data)
Write info and content of the array data to stdout.