GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
N_pde.h File Reference
#include <grass/gis.h>
#include <grass/raster3d.h>
#include <grass/glocale.h>
#include <grass/gmath.h>
Include dependency graph for N_pde.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  N_les
 The linear equation system (les) structure. More...
 
struct  N_geom_data
 Geometric information about the structured grid. More...
 
struct  N_array_2d
 
struct  N_array_3d
 
struct  N_data_star
 Matrix entries for a mass balance 5/7/9 star system. More...
 
struct  N_les_callback_3d
 callback structure for 3d matrix assembling More...
 
struct  N_les_callback_2d
 callback structure for 2d matrix assembling More...
 
struct  N_gradient_2d
 Gradient between the cells in X and Y direction. More...
 
struct  N_gradient_3d
 Gradient between the cells in X, Y and Z direction. More...
 
struct  N_gradient_neighbours_x
 Gradient between the cell neighbours in X direction. More...
 
struct  N_gradient_neighbours_y
 Gradient between the cell neighbours in Y direction. More...
 
struct  N_gradient_neighbours_z
 Gradient between the cell neighbours in Z direction. More...
 
struct  N_gradient_neighbours_2d
 Gradient between the cell neighbours in X and Y direction. More...
 
struct  N_gradient_neighbours_3d
 Gradient between the cell neighbours in X, Y and Z direction. More...
 
struct  N_gradient_field_2d
 
struct  N_gradient_field_3d
 

Macros

#define N_NORMAL_LES   0
 
#define N_SPARSE_LES   1
 
#define N_CELL_INACTIVE   0
 
#define N_CELL_ACTIVE   1
 
#define N_CELL_DIRICHLET   2
 
#define N_CELL_TRANSMISSION   3
 
#define N_MAX_CELL_STATE   20
 the maximum number of available cell states (eg: boundary condition, inactiven active) More...
 
#define N_5_POINT_STAR   0
 
#define N_7_POINT_STAR   1
 
#define N_9_POINT_STAR   2
 
#define N_27_POINT_STAR   3
 
#define N_MAXIMUM_NORM   0
 
#define N_EUKLID_NORM   1
 
#define N_ARRAY_SUM   0 /* summ two arrays */
 
#define N_ARRAY_DIF   1 /* calc the difference between two arrays */
 
#define N_ARRAY_MUL   2 /* multiply two arrays */
 
#define N_ARRAY_DIV
 
#define N_UPWIND_FULL   0 /*full upwinding stabilization */
 
#define N_UPWIND_EXP   1 /*exponential upwinding stabilization */
 
#define N_UPWIND_WEIGHT   2 /*weighted upwinding stabilization */
 

Enumerations

enum  N_STD_OPT {
  N_OPT_SOLVER_SYMM , N_OPT_SOLVER_UNSYMM , N_OPT_MAX_ITERATIONS , N_OPT_ITERATION_ERROR ,
  N_OPT_SOR_VALUE , N_OPT_CALC_TIME
}
 Standard options of the gpde library. More...
 

Functions

N_lesN_alloc_les_param (int cols, int rows, int type, int param)
 Allocate memory for a quadratic or not quadratic linear equation system. More...
 
N_lesN_alloc_les (int rows, int type)
 Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b. More...
 
N_lesN_alloc_les_A (int rows, int type)
 Allocate memory for a quadratic linear equation system which includes the Matrix A. More...
 
N_lesN_alloc_les_Ax (int rows, int type)
 Allocate memory for a quadratic linear equation system which includes the Matrix A and vector x. More...
 
N_lesN_alloc_les_Ax_b (int rows, int type)
 Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b. More...
 
N_lesN_alloc_nquad_les (int cols, int rows, int type)
 Allocate memory for a (not) quadratic linear equation system which includes the Matrix A, vector x and vector b. More...
 
N_lesN_alloc_nquad_les_A (int cols, int rows, int type)
 Allocate memory for a (not) quadratic linear equation system which includes the Matrix A. More...
 
N_lesN_alloc_nquad_les_Ax (int cols, int rows, int type)
 Allocate memory for a (not) quadratic linear equation system which includes the Matrix A and vector x. More...
 
N_lesN_alloc_nquad_les_Ax_b (int cols, int rows, int type)
 Allocate memory for a (not) quadratic linear equation system which includes the Matrix A, vector x and vector b. More...
 
void N_print_les (N_les *les)
 prints the linear equation system to stdout More...
 
void N_free_les (N_les *les)
 Release the memory of the linear equation system. More...
 
N_geom_dataN_alloc_geom_data (void)
 Allocate the pde geometry data structure and return a pointer to the new allocated structure. More...
 
void N_free_geom_data (N_geom_data *geodata)
 Release memory of a pde geometry data structure. More...
 
N_geom_dataN_init_geom_data_3d (RASTER3D_Region *region3d, N_geom_data *geodata)
 Initiate a pde geometry data structure with a 3d region. More...
 
N_geom_dataN_init_geom_data_2d (struct Cell_head *region, N_geom_data *geodata)
 Initiate a pde geometry data structure with a 2d region. More...
 
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. More...
 
N_array_2dN_alloc_array_2d (int cols, int rows, int offset, int type)
 Allocate memory for a N_array_2d data structure. More...
 
void N_free_array_2d (N_array_2d *data_array)
 Release the memory of a N_array_2d structure. More...
 
int N_get_array_2d_type (N_array_2d *array2d)
 Return the data type of the N_array_2d struct. More...
 
void N_get_array_2d_value (N_array_2d *array2d, int col, int row, void *value)
 Write the value of the N_array_2d struct at position col, row to value. More...
 
CELL N_get_array_2d_c_value (N_array_2d *array2d, int col, int row)
 Returns the value of type CELL at position col, row. More...
 
FCELL N_get_array_2d_f_value (N_array_2d *array2d, int col, int row)
 Returns the value of type FCELL at position col, row. More...
 
DCELL N_get_array_2d_d_value (N_array_2d *array2d, int col, int row)
 Returns the value of type DCELL at position col, row. More...
 
void N_put_array_2d_value (N_array_2d *array2d, int col, int row, char *value)
 Writes a value to the N_array_2d struct at position col, row. More...
 
void N_put_array_2d_c_value (N_array_2d *array2d, int col, int row, CELL value)
 Writes a CELL value to the N_array_2d struct at position col, row. More...
 
void N_put_array_2d_f_value (N_array_2d *array2d, int col, int row, FCELL value)
 Writes a FCELL value to the N_array_2d struct at position col, row. More...
 
void N_put_array_2d_d_value (N_array_2d *array2d, int col, int row, DCELL value)
 Writes a DCELL value to the N_array_2d struct at position col, row. More...
 
int N_is_array_2d_value_null (N_array_2d *array2d, int col, int row)
 Returns 1 if the value of N_array_2d struct at position col, row is of type null, otherwise 0. More...
 
void N_put_array_2d_value_null (N_array_2d *array2d, int col, int row)
 Writes the null value to the N_array_2d struct at position col, row. More...
 
void N_print_array_2d (N_array_2d *data)
 Write info and content of the N_array_2d struct to stdout. More...
 
void N_print_array_2d_info (N_array_2d *data)
 This function writes the data info of the array data to stdout. More...
 
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. More...
 
double N_norm_array_2d (N_array_2d *array1, N_array_2d *array2, int type)
 Calculate the norm of the two input arrays. More...
 
N_array_2dN_math_array_2d (N_array_2d *array1, N_array_2d *array2, N_array_2d *result, int type)
 Perform calculations with two input arrays, the result is written to a third array. More...
 
int N_convert_array_2d_null_to_zero (N_array_2d *a)
 Convert all null values to zero values. More...
 
N_array_2dN_read_rast_to_array_2d (char *name, N_array_2d *array)
 Read a raster map into a N_array_2d structure. More...
 
void N_write_array_2d_to_rast (N_array_2d *array, char *name)
 Write a N_array_2d struct to a raster map. More...
 
void N_calc_array_2d_stats (N_array_2d *a, double *min, double *max, double *sum, int *nonzero, int withoffset)
 Calculate basic statistics of the N_array_2d struct. More...
 
N_array_3dN_alloc_array_3d (int cols, int rows, int depths, int offset, int type)
 Allocate memory for a N_array_3d data structure. More...
 
void N_free_array_3d (N_array_3d *data_array)
 Release the memory of a N_array_3d. More...
 
int N_get_array_3d_type (N_array_3d *array3d)
 Return the data type of the N_array_3d. More...
 
void N_get_array_3d_value (N_array_3d *array3d, 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. More...
 
float N_get_array_3d_f_value (N_array_3d *array3d, int col, int row, int depth)
 This function returns the value of type float at position col, row, depth. More...
 
double N_get_array_3d_d_value (N_array_3d *array3d, int col, int row, int depth)
 This function returns the value of type float at position col, row, depth. More...
 
void N_put_array_3d_value (N_array_3d *array3d, int col, int row, int depth, char *value)
 This function writes a value to the N_array_3d data at position col, row, depth. More...
 
void N_put_array_3d_f_value (N_array_3d *array3d, 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. More...
 
void N_put_array_3d_d_value (N_array_3d *array3d, int col, int row, int depth, double value)
 Writes a double value to the N_array_3d struct at position col, row, depth. More...
 
int N_is_array_3d_value_null (N_array_3d *array3d, 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, otherwise 0. More...
 
void N_put_array_3d_value_null (N_array_3d *array3d, int col, int row, int depth)
 This function writes a null value to the N_array_3d data at position col, row, depth. More...
 
void N_print_array_3d (N_array_3d *data)
 Write info and content of the array data to stdout. More...
 
void N_print_array_3d_info (N_array_3d *data)
 Write the info of the array to stdout. More...
 
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. More...
 
double N_norm_array_3d (N_array_3d *array1, N_array_3d *array2, int type)
 Calculate the norm of the two input arrays. More...
 
N_array_3dN_math_array_3d (N_array_3d *array1, N_array_3d *array2, N_array_3d *result, int type)
 Perform calculations with two input arrays, the result is written to a third array. More...
 
int N_convert_array_3d_null_to_zero (N_array_3d *a)
 Convert all null values to zero values. More...
 
N_array_3dN_read_rast3d_to_array_3d (char *name, N_array_3d *array, int mask)
 Read a volume map into a N_array_3d structure. More...
 
void N_write_array_3d_to_rast3d (N_array_3d *array, char *name, int mask)
 Write a N_array_3d struct to a volume map. More...
 
void N_calc_array_3d_stats (N_array_3d *a, double *min, double *max, double *sum, int *nonzero, int withoffset)
 Calculate basic statistics of the N_array_3d struct. More...
 
void N_set_les_callback_3d_func (N_les_callback_3d *data, N_data_star *(*callback_func_3d)(void *, N_geom_data *, int, int, int))
 Set the callback function which is called while assembling the les in 3d. More...
 
void N_set_les_callback_2d_func (N_les_callback_2d *data, N_data_star *(*callback_func_2d)(void *, N_geom_data *, int, int))
 Set the callback function which is called while assembling the les in 2d. More...
 
N_les_callback_3dN_alloc_les_callback_3d (void)
 Allocate the structure holding the callback function. More...
 
N_les_callback_2dN_alloc_les_callback_2d (void)
 Allocate the structure holding the callback function. More...
 
N_data_starN_alloc_5star (void)
 allocate a 5 point star data structure More...
 
N_data_starN_alloc_7star (void)
 allocate a 7 point star data structure More...
 
N_data_starN_alloc_9star (void)
 allocate a 9 point star data structure More...
 
N_data_starN_alloc_27star (void)
 allocate a 27 point star data structure More...
 
N_data_starN_create_5star (double C, double W, double E, double N, double S, double V)
 allocate and initialize a 5 point star data structure More...
 
N_data_starN_create_7star (double C, double W, double E, double N, double S, double T, double B, double V)
 allocate and initialize a 7 point star data structure More...
 
N_data_starN_create_9star (double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double V)
 allocate and initialize a 9 point star data structure More...
 
N_data_starN_create_27star (double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double T, double W_T, double E_T, double N_T, double S_T, double NW_T, double SW_T, double NE_T, double SE_T, double B, double W_B, double E_B, double N_B, double S_B, double NW_B, double SW_B, double NE_B, double SE_B, double V)
 allocate and initialize a 27 point star data structure More...
 
N_data_starN_callback_template_3d (void *data, N_geom_data *geom, int col, int row, int depth)
 
N_data_starN_callback_template_2d (void *data, N_geom_data *geom, int col, int row)
 
N_lesN_assemble_les_3d (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
 Assemble a linear equation system (les) based on 3d location data (g3d) active cells. More...
 
N_lesN_assemble_les_3d_active (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
 Assemble a linear equation system (les) based on 3d location data (g3d) active cells. More...
 
N_lesN_assemble_les_3d_dirichlet (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
 Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells. More...
 
N_lesN_assemble_les_3d_param (int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback, int cell_type)
 Assemble a linear equation system (les) based on 3d location data (g3d) More...
 
N_lesN_assemble_les_2d (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
 Assemble a linear equation system (les) based on 2d location data (raster) and active cells. More...
 
N_lesN_assemble_les_2d_active (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
 Assemble a linear equation system (les) based on 2d location data (raster) and active cells. More...
 
N_lesN_assemble_les_2d_dirichlet (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
 Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet cells. More...
 
N_lesN_assemble_les_2d_param (int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback, int cell_Type)
 Assemble a linear equation system (les) based on 2d location data (raster) More...
 
int N_les_pivot_create (N_les *les)
 
int N_les_integrate_dirichlet_2d (N_les *les, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val)
 Integrate Dirichlet or Transmission boundary conditions into the les (2s) More...
 
int N_les_integrate_dirichlet_3d (N_les *les, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val)
 Integrate Dirichlet or Transmission boundary conditions into the les (3d) More...
 
struct OptionN_define_standard_option (int opt)
 Create standardised Option structure related to the gpde library. More...
 
double N_calc_arith_mean (double a, double b)
 Calculate the arithmetic mean of values a and b. More...
 
double N_calc_arith_mean_n (double *a, int size)
 Calculate the arithmetic mean of the values in vector a of size n. More...
 
double N_calc_geom_mean (double a, double b)
 Calculate the geometrical mean of values a and b. More...
 
double N_calc_geom_mean_n (double *a, int size)
 Calculate the geometrical mean of the values in vector a of size n. More...
 
double N_calc_harmonic_mean (double a, double b)
 Calculate the harmonical mean of values a and b. More...
 
double N_calc_harmonic_mean_n (double *a, int size)
 Calculate the harmonical mean of the values in vector a of size n. More...
 
double N_calc_quad_mean (double a, double b)
 Calculate the quadratic mean of values a and b. More...
 
double N_calc_quad_mean_n (double *a, int size)
 Calculate the quadratic mean of the values in vector a of size n. More...
 
double N_full_upwinding (double sprod, double distance, double D)
 full upwinding stabilization algorithm More...
 
double N_exp_upwinding (double sprod, double distance, double D)
 exponential upwinding stabilization algorithm More...
 
N_gradient_2dN_alloc_gradient_2d (void)
 Allocate a N_gradient_2d structure. More...
 
void N_free_gradient_2d (N_gradient_2d *grad)
 Free's a N_gradient_2d structure. More...
 
N_gradient_2dN_create_gradient_2d (double NC, double SC, double WC, double EC)
 allocate and initialize a N_gradient_2d structure More...
 
int N_copy_gradient_2d (N_gradient_2d *source, N_gradient_2d *target)
 copy a N_gradient_2d structure More...
 
N_gradient_2dN_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]. More...
 
N_gradient_3dN_alloc_gradient_3d (void)
 Allocate a N_gradient_3d structure. More...
 
void N_free_gradient_3d (N_gradient_3d *grad)
 Free's a N_gradient_3d structure. More...
 
N_gradient_3dN_create_gradient_3d (double NC, double SC, double WC, double EC, double TC, double BC)
 allocate and initialize a N_gradient_3d structure More...
 
int N_copy_gradient_3d (N_gradient_3d *source, N_gradient_3d *target)
 copy a N_gradient_3d structure More...
 
N_gradient_3dN_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][col]. More...
 
N_gradient_neighbours_xN_alloc_gradient_neighbours_x (void)
 Allocate a N_gradient_neighbours_x structure. More...
 
void N_free_gradient_neighbours_x (N_gradient_neighbours_x *grad)
 Free's a N_gradient_neighbours_x structure. More...
 
N_gradient_neighbours_xN_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. More...
 
int N_copy_gradient_neighbours_x (N_gradient_neighbours_x *source, N_gradient_neighbours_x *target)
 copy a N_gradient_neighbours_x structure More...
 
N_gradient_neighbours_yN_alloc_gradient_neighbours_y (void)
 Allocate a N_gradient_neighbours_y structure. More...
 
void N_free_gradient_neighbours_y (N_gradient_neighbours_y *grad)
 Free's a N_gradient_neighbours_y structure. More...
 
N_gradient_neighbours_yN_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. More...
 
int N_copy_gradient_neighbours_y (N_gradient_neighbours_y *source, N_gradient_neighbours_y *target)
 copy a N_gradient_neighbours_y structure More...
 
N_gradient_neighbours_zN_alloc_gradient_neighbours_z (void)
 Allocate a N_gradient_neighbours_z structure. More...
 
void N_free_gradient_neighbours_z (N_gradient_neighbours_z *grad)
 Free's a N_gradient_neighbours_z structure. More...
 
N_gradient_neighbours_zN_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. More...
 
int N_copy_gradient_neighbours_z (N_gradient_neighbours_z *source, N_gradient_neighbours_z *target)
 copy a N_gradient_neighbours_z structure More...
 
N_gradient_neighbours_2dN_alloc_gradient_neighbours_2d (void)
 Allocate a N_gradient_neighbours_2d structure. More...
 
void N_free_gradient_neighbours_2d (N_gradient_neighbours_2d *grad)
 Free's a N_gradient_neighbours_2d structure. More...
 
N_gradient_neighbours_2dN_create_gradient_neighbours_2d (N_gradient_neighbours_x *x, N_gradient_neighbours_y *y)
 Allocate and initialize a N_gradient_neighbours_2d structure. More...
 
int N_copy_gradient_neighbours_2d (N_gradient_neighbours_2d *source, N_gradient_neighbours_2d *target)
 copy a N_gradient_neighbours_2d structure More...
 
N_gradient_neighbours_2dN_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][col]. More...
 
N_gradient_neighbours_3dN_alloc_gradient_neighbours_3d (void)
 Allocate a N_gradient_neighbours_3d structure. More...
 
void N_free_gradient_neighbours_3d (N_gradient_neighbours_3d *grad)
 Free's a N_gradient_neighbours_3d structure. More...
 
N_gradient_neighbours_3dN_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. More...
 
int N_copy_gradient_neighbours_3d (N_gradient_neighbours_3d *source, N_gradient_neighbours_3d *target)
 copy a N_gradient_neighbours_3d structure More...
 
void N_print_gradient_field_2d_info (N_gradient_field_2d *field)
 Print gradient field information to stdout. More...
 
void N_calc_gradient_field_2d_stats (N_gradient_field_2d *field)
 Calculate basic statistics of a gradient field. More...
 
N_gradient_field_2dN_alloc_gradient_field_2d (int cols, int rows)
 Allocate a N_gradient_field_2d. More...
 
void N_free_gradient_field_2d (N_gradient_field_2d *field)
 Free's a N_gradient_neighbours_2d structure. More...
 
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. More...
 
N_gradient_field_2dN_compute_gradient_field_2d (N_array_2d *pot, N_array_2d *weight_x, N_array_2d *weight_y, N_geom_data *geom, N_gradient_field_2d *gradfield)
 This function computes the gradient based on the input N_array_2d pot (potential), a weighting factor N_array_2d named weight and the distance between two cells saved in the N_geom_data struct. More...
 
void N_compute_gradient_field_components_2d (N_gradient_field_2d *field, N_array_2d *x_comp, N_array_2d *y_comp)
 Calculate the x and y vector components from a gradient field for each cell and stores them in the provided N_array_2d structures. More...
 
void N_print_gradient_field_3d_info (N_gradient_field_3d *field)
 Print gradient field information to stdout. More...
 
void N_calc_gradient_field_3d_stats (N_gradient_field_3d *field)
 Calculate basic statistics of a gradient field. More...
 
N_gradient_field_3dN_alloc_gradient_field_3d (int cols, int rows, int depths)
 Allocate a N_gradient_field_3d. More...
 
void N_free_gradient_field_3d (N_gradient_field_3d *field)
 Free's a N_gradient_neighbours_3d structure. More...
 
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. More...
 
N_gradient_field_3dN_compute_gradient_field_3d (N_array_3d *pot, N_array_3d *weight_x, N_array_3d *weight_y, N_array_3d *weight_z, N_geom_data *geom, N_gradient_field_3d *gradfield)
 This function computes the gradient based on the input N_array_3d pot (that means potential), a weighting factor N_array_3d named weight and the distance between two cells saved in the N_geom_data struct. More...
 
void N_compute_gradient_field_components_3d (N_gradient_field_3d *field, N_array_3d *x_comp, N_array_3d *y_comp, N_array_3d *z_comp)
 Calculate the x, y and z vector components from a gradient field for each cell and store them in the provided N_array_3d structures. More...
 

Macro Definition Documentation

◆ N_27_POINT_STAR

#define N_27_POINT_STAR   3

Definition at line 43 of file N_pde.h.

◆ N_5_POINT_STAR

#define N_5_POINT_STAR   0

Definition at line 40 of file N_pde.h.

◆ N_7_POINT_STAR

#define N_7_POINT_STAR   1

Definition at line 41 of file N_pde.h.

◆ N_9_POINT_STAR

#define N_9_POINT_STAR   2

Definition at line 42 of file N_pde.h.

◆ N_ARRAY_DIF

#define N_ARRAY_DIF   1 /* calc the difference between two arrays */

Definition at line 49 of file N_pde.h.

◆ N_ARRAY_DIV

#define N_ARRAY_DIV
Value:
3 /* array division, if div with 0 the NULL value is set \
*/

Definition at line 51 of file N_pde.h.

◆ N_ARRAY_MUL

#define N_ARRAY_MUL   2 /* multiply two arrays */

Definition at line 50 of file N_pde.h.

◆ N_ARRAY_SUM

#define N_ARRAY_SUM   0 /* summ two arrays */

Definition at line 48 of file N_pde.h.

◆ N_CELL_ACTIVE

#define N_CELL_ACTIVE   1

Definition at line 31 of file N_pde.h.

◆ N_CELL_DIRICHLET

#define N_CELL_DIRICHLET   2

Definition at line 32 of file N_pde.h.

◆ N_CELL_INACTIVE

#define N_CELL_INACTIVE   0

Boundary conditions for cells

Definition at line 30 of file N_pde.h.

◆ N_CELL_TRANSMISSION

#define N_CELL_TRANSMISSION   3

Definition at line 33 of file N_pde.h.

◆ N_EUKLID_NORM

#define N_EUKLID_NORM   1

Definition at line 46 of file N_pde.h.

◆ N_MAX_CELL_STATE

#define N_MAX_CELL_STATE   20

the maximum number of available cell states (eg: boundary condition, inactiven active)

Definition at line 38 of file N_pde.h.

◆ N_MAXIMUM_NORM

#define N_MAXIMUM_NORM   0

Definition at line 45 of file N_pde.h.

◆ N_NORMAL_LES

#define N_NORMAL_LES   0

Definition at line 25 of file N_pde.h.

◆ N_SPARSE_LES

#define N_SPARSE_LES   1

Definition at line 26 of file N_pde.h.

◆ N_UPWIND_EXP

#define N_UPWIND_EXP   1 /*exponential upwinding stabilization */

Definition at line 55 of file N_pde.h.

◆ N_UPWIND_FULL

#define N_UPWIND_FULL   0 /*full upwinding stabilization */

Definition at line 54 of file N_pde.h.

◆ N_UPWIND_WEIGHT

#define N_UPWIND_WEIGHT   2 /*weighted upwinding stabilization */

Definition at line 56 of file N_pde.h.

Enumeration Type Documentation

◆ N_STD_OPT

enum N_STD_OPT

Standard options of the gpde library.

Enumerator
N_OPT_SOLVER_SYMM 
N_OPT_SOLVER_UNSYMM 

solver for symmetric, positive definite linear equation systems

N_OPT_MAX_ITERATIONS 

solver for unsymmetric linear equation systems

N_OPT_ITERATION_ERROR 

Maximum number of iteration used to solver the linear equation system

N_OPT_SOR_VALUE 

Error break criteria for the iterative solver (jacobi, sor, cg or bicgstab)

N_OPT_CALC_TIME 

The relaxation parameter used by the jacobi and sor solver for speedup or stabilizing

The calculation time in seconds

Definition at line 391 of file N_pde.h.

Function Documentation

◆ N_alloc_27star()

N_data_star* N_alloc_27star ( void  )

allocate a 27 point star data structure

Returns
N_data_star *
Attention
The 27 point start is not yet implemented in the matrix assembling function

Definition at line 101 of file n_les_assemble.c.

References N_data_star::count, G_calloc, N_27_POINT_STAR, and N_data_star::type.

Referenced by N_create_27star().

◆ N_alloc_5star()

N_data_star* N_alloc_5star ( void  )

allocate a 5 point star data structure

Returns
N_data_star *

Definition at line 42 of file n_les_assemble.c.

References N_data_star::count, G_calloc, N_5_POINT_STAR, and N_data_star::type.

Referenced by N_create_5star().

◆ N_alloc_7star()

N_data_star* N_alloc_7star ( void  )

allocate a 7 point star data structure

Returns
N_data_star *

Definition at line 59 of file n_les_assemble.c.

References N_data_star::count, G_calloc, N_7_POINT_STAR, and N_data_star::type.

Referenced by N_create_7star().

◆ N_alloc_9star()

N_data_star* N_alloc_9star ( void  )

allocate a 9 point star data structure

Returns
N_data_star *
Attention
The 9 point start is not yet implemented in the matrix assembling function

Definition at line 80 of file n_les_assemble.c.

References N_data_star::count, G_calloc, N_9_POINT_STAR, and N_data_star::type.

Referenced by N_create_9star().

◆ N_alloc_array_2d()

N_array_2d* N_alloc_array_2d ( int  cols,
int  rows,
int  offset,
int  type 
)

Allocate memory for a N_array_2d data structure.

This function allocates memory for an array of type N_array_2d and returns the pointer to the new allocated memory.

The data type of this array is set by "type" and must be CELL_TYPE, FCELL_TYPE or DCELL_TYPE accordingly to the raster map data types. The offset sets the number of boundary cols and rows. This option is useful to generate homogeneous Neumann boundary conditions around an array or to establish overlapping boundaries. The array is initialized with 0 by default.

If the offset is greater then 0, negative indices are possible.

The data structure of a array with 3 rows and cols and an offset of 1 will looks like this:

0 0 0 0 0
0 0 1 2 0
0 3 4 5 0
0 6 7 8 0
0 0 0 0 0

0 is the boundary.

Internal a one dimensional array is allocated to save memory and to speed up the memory access. To access the one dimensional array with a two dimensional index use the provided get and put functions. The internal representation of the above data will look like this:

0 0 0 0 0 0 0 1 2 0 0 3 4 5 0 0 6 7 8 0 0 0 0 0 0
Parameters
colsint
rowsint
offsetint
typeint
Returns
N_array_2d *

Definition at line 75 of file n_arrays.c.

Referenced by N_alloc_gradient_field_2d().

◆ N_alloc_array_3d()

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.

This functions allocates an array of type N_array_3d and returns a pointer to the new allocated memory.

The data type of this array set by "type" must be FCELL_TYPE or DCELL_TYPE accordingly to the raster3d map data types. The offsets sets the number of boundary cols, rows and depths. This option is useful to generate homogeneous Neumann boundary conditions around an array or to establish overlapping boundaries. The arrays are initialized with 0 by default.

If the offset is greater then 0, negative indices are possible. The data structure of a array with 3 depths, rows and cols and an offset of 1 will looks like this:

0  0  0  0  0
0  0  0  0  0
0  0  0  0  0
0  0  0  0  0
0  0  0  0  0

0  0  0  0  0
0  0  1  2  0
0  3  4  5  0
0  6  7  8  0
0  0  0  0  0

0  0  0  0  0
0  9 10 11  0
0 12 13 14  0
0 15 16 17  0
0  0  0  0  0

0  0  0  0  0
0 18 19 20  0
0 21 22 23  0
0 24 25 26  0
0  0  0  0  0

0  0  0  0  0
0  0  0  0  0
0  0  0  0  0
0  0  0  0  0
0  0  0  0  0

The depth counts from the bottom to the top.



Internal a one dimensional array is allocated to speed up the memory access. To access the dimensional array with a three dimensional indexing use the provided get and put functions.

Parameters
colsint
rowsint
depthsint
offsetint
typeint
Returns
N_array_3d *

Definition at line 719 of file n_arrays.c.

Referenced by N_alloc_gradient_field_3d().

◆ N_alloc_geom_data()

N_geom_data* N_alloc_geom_data ( void  )

Allocate the pde geometry data structure and return a pointer to the new allocated structure.

Returns
N_geom_data *

Definition at line 29 of file n_geom.c.

References N_geom_data::area, N_geom_data::dim, G_calloc, NULL, and N_geom_data::planimetric.

Referenced by N_init_geom_data_3d().

◆ N_alloc_gradient_2d()

N_gradient_2d* N_alloc_gradient_2d ( void  )

Allocate a N_gradient_2d structure.

Returns
N_gradient_2d *

Definition at line 26 of file n_gradient.c.

References G_calloc.

Referenced by N_create_gradient_2d().

◆ N_alloc_gradient_3d()

N_gradient_3d* N_alloc_gradient_3d ( void  )

Allocate a N_gradient_3d structure.

Returns
N_gradient_3d *

Definition at line 149 of file n_gradient.c.

References G_calloc.

Referenced by N_create_gradient_3d().

◆ N_alloc_gradient_field_2d()

N_gradient_field_2d* N_alloc_gradient_field_2d ( int  cols,
int  rows 
)

Allocate a N_gradient_field_2d.

The field arrays are of type DCELL.

Parameters
rows- number of rows of the 2d array from which the gradient should be calculated
cols- number of cols of the 2d array from which the gradient should be calculated
Returns
N_gradient_field_2d *

Definition at line 896 of file n_gradient.c.

References N_gradient_field_2d::cols, DCELL_TYPE, G_calloc, G_debug(), N_alloc_array_2d(), N_gradient_field_2d::rows, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

Referenced by N_compute_gradient_field_2d().

◆ N_alloc_gradient_field_3d()

N_gradient_field_3d* N_alloc_gradient_field_3d ( int  cols,
int  rows,
int  depths 
)

Allocate a N_gradient_field_3d.

The field arrays are always of type DCELL_TYPE.

Parameters
cols- number of cols of the 3d array from which the gradient should be calculated
rows- number of rows of the 3d array from which the gradient should be calculated
depths- number of depths of the 3d array from which the gradient should be calculated
Returns
N_gradient_field_3d *

Definition at line 993 of file n_gradient.c.

References N_gradient_field_3d::cols, DCELL_TYPE, N_gradient_field_3d::depths, G_calloc, G_debug(), N_alloc_array_3d(), N_gradient_field_3d::rows, N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.

Referenced by N_compute_gradient_field_3d().

◆ N_alloc_gradient_neighbours_2d()

N_gradient_neighbours_2d* N_alloc_gradient_neighbours_2d ( void  )

Allocate a N_gradient_neighbours_2d structure.

This structure contains all neighbour gradients in all directions of one cell in a 2d raster layer

Returns
N_gradient_neighbours_2d *

Definition at line 577 of file n_gradient.c.

References G_calloc, N_alloc_gradient_neighbours_x(), N_alloc_gradient_neighbours_y(), N_gradient_neighbours_2d::x, and N_gradient_neighbours_2d::y.

Referenced by N_create_gradient_neighbours_2d().

◆ N_alloc_gradient_neighbours_3d()

◆ N_alloc_gradient_neighbours_x()

N_gradient_neighbours_x* N_alloc_gradient_neighbours_x ( void  )

Allocate a N_gradient_neighbours_x structure.

This structure contains all neighbour gradients in x direction of one cell

Returns
N_gradient_neighbours_x *

Definition at line 289 of file n_gradient.c.

References G_calloc.

Referenced by N_alloc_gradient_neighbours_2d(), N_alloc_gradient_neighbours_3d(), and N_create_gradient_neighbours_x().

◆ N_alloc_gradient_neighbours_y()

N_gradient_neighbours_y* N_alloc_gradient_neighbours_y ( void  )

Allocate a N_gradient_neighbours_y structure.

This structure contains all neighbour gradients in y direction of one cell

Returns
N_gradient_neighbours_y *

Definition at line 381 of file n_gradient.c.

References G_calloc.

Referenced by N_alloc_gradient_neighbours_2d(), N_alloc_gradient_neighbours_3d(), and N_create_gradient_neighbours_y().

◆ N_alloc_gradient_neighbours_z()

N_gradient_neighbours_z* N_alloc_gradient_neighbours_z ( void  )

Allocate a N_gradient_neighbours_z structure.

This structure contains all neighbour gradients in z direction of one cell

Returns
N_gradient_neighbours_z *

Definition at line 473 of file n_gradient.c.

References G_calloc.

Referenced by N_alloc_gradient_neighbours_3d(), and N_create_gradient_neighbours_z().

◆ N_alloc_les()

N_les* N_alloc_les ( int  rows,
int  type 
)

Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b.

This function calls N_alloc_les_param

Parameters
rowsint
typeint
Returns
N_les *

Definition at line 101 of file n_les.c.

◆ N_alloc_les_A()

N_les* N_alloc_les_A ( int  rows,
int  type 
)

Allocate memory for a quadratic linear equation system which includes the Matrix A.

This function calls N_alloc_les_param

Parameters
rowsint
typeint
Returns
N_les *

Definition at line 133 of file n_les.c.

◆ N_alloc_les_Ax()

N_les* N_alloc_les_Ax ( int  rows,
int  type 
)

Allocate memory for a quadratic linear equation system which includes the Matrix A and vector x.

This function calls N_alloc_les_param

Parameters
rowsint
typeint
Returns
N_les *

Definition at line 117 of file n_les.c.

◆ N_alloc_les_Ax_b()

N_les* N_alloc_les_Ax_b ( int  rows,
int  type 
)

Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b.

This function calls N_alloc_les_param

Parameters
rowsint
typeint
Returns
N_les *

Definition at line 149 of file n_les.c.

◆ N_alloc_les_callback_2d()

N_les_callback_2d* N_alloc_les_callback_2d ( void  )

Allocate the structure holding the callback function.

A template callback is set. Use N_set_les_callback_2d_func to set up a specific function.

Returns
N_les_callback_2d *

Definition at line 400 of file n_les_assemble.c.

References N_les_callback_2d::callback, G_calloc, and N_callback_template_2d().

◆ N_alloc_les_callback_3d()

N_les_callback_3d* N_alloc_les_callback_3d ( void  )

Allocate the structure holding the callback function.

A template callback is set. Use N_set_les_callback_3d_func to set up a specific function.

Returns
N_les_callback_3d *

Definition at line 379 of file n_les_assemble.c.

References N_les_callback_3d::callback, G_calloc, and N_callback_template_3d().

◆ N_alloc_les_param()

N_les* N_alloc_les_param ( int  cols,
int  rows,
int  type,
int  parts 
)

Allocate memory for a quadratic or not quadratic linear equation system.

The type of the linear equation system must be N_NORMAL_LES for a regular quadratic matrix or N_SPARSE_LES for a sparse matrix

In case of N_NORMAL_LES

A quadratic matrix of size rows*rows*sizeof(double) will allocated

In case of N_SPARSE_LES

a vector of size row will be allocated, ready to hold additional allocated sparse vectors. each sparse vector may have a different size.

Parameter parts defines which parts of the les should be allocated. The number of columns and rows defines if the matrix is quadratic.

Parameters
colsint
rowsint
typeint
partsint – 2 = A, x and b; 1 = A and x; 0 = A allocated
Returns
N_les *

Definition at line 182 of file n_les.c.

◆ N_alloc_nquad_les()

N_les* N_alloc_nquad_les ( int  cols,
int  rows,
int  type 
)

Allocate memory for a (not) quadratic linear equation system which includes the Matrix A, vector x and vector b.

This function calls N_alloc_les_param

Parameters
colsint
rowsint
typeint
Returns
N_les *

Definition at line 34 of file n_les.c.

◆ N_alloc_nquad_les_A()

N_les* N_alloc_nquad_les_A ( int  cols,
int  rows,
int  type 
)

Allocate memory for a (not) quadratic linear equation system which includes the Matrix A.

This function calls N_alloc_les_param

Parameters
colsint
rowsint
typeint
Returns
N_les *

Definition at line 68 of file n_les.c.

◆ N_alloc_nquad_les_Ax()

N_les* N_alloc_nquad_les_Ax ( int  cols,
int  rows,
int  type 
)

Allocate memory for a (not) quadratic linear equation system which includes the Matrix A and vector x.

This function calls N_alloc_les_param

Parameters
colsint
rowsint
typeint
Returns
N_les *

Definition at line 51 of file n_les.c.

◆ N_alloc_nquad_les_Ax_b()

N_les* N_alloc_nquad_les_Ax_b ( int  cols,
int  rows,
int  type 
)

Allocate memory for a (not) quadratic linear equation system which includes the Matrix A, vector x and vector b.

This function calls N_alloc_les_param

Parameters
colsint
rowsint
typeint
Returns
N_les *

Definition at line 85 of file n_les.c.

◆ N_assemble_les_2d()

N_les* N_assemble_les_2d ( int  les_type,
N_geom_data geom,
N_array_2d status,
N_array_2d start_val,
void *  data,
N_les_callback_2d call 
)

Assemble a linear equation system (les) based on 2d location data (raster) and active cells.

This function calls N_assemble_les_2d_param

Definition at line 495 of file n_les_assemble.c.

◆ N_assemble_les_2d_active()

N_les* N_assemble_les_2d_active ( int  les_type,
N_geom_data geom,
N_array_2d status,
N_array_2d start_val,
void *  data,
N_les_callback_2d call 
)

Assemble a linear equation system (les) based on 2d location data (raster) and active cells.

This function calls N_assemble_les_2d_param

Definition at line 510 of file n_les_assemble.c.

◆ N_assemble_les_2d_dirichlet()

N_les* N_assemble_les_2d_dirichlet ( int  les_type,
N_geom_data geom,
N_array_2d status,
N_array_2d start_val,
void *  data,
N_les_callback_2d call 
)

Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet cells.

This function calls N_assemble_les_2d_param

Definition at line 525 of file n_les_assemble.c.

◆ N_assemble_les_2d_param()

N_les* N_assemble_les_2d_param ( int  les_type,
N_geom_data geom,
N_array_2d status,
N_array_2d start_val,
void *  data,
N_les_callback_2d call,
int  cell_type 
)

Assemble a linear equation system (les) based on 2d location data (raster)

The linear equation system type can be set to N_NORMAL_LES to create a regular matrix, or to N_SPARSE_LES to create a sparse matrix. This function returns a new created linear equation system which can be solved with linear equation solvers. An 2d array with start values and an 2d status array must be provided as well as the location geometry and a void pointer to data passed to the callback which creates the les row entries. This callback must be defined in the N_les_callback_2d structure.

The creation of the les is parallelized with OpenMP. If you implement new callbacks, please make sure that the function calls are thread safe.

the les can be created in two ways, with dirichlet and similar cells and without them, to spare some memory. If the les is created with dirichlet cell, the dirichlet boundary condition must be added.

Parameters
les_typeint
geomN_geom_data*
statusN_array_2d *
start_valN_array_2d *
datavoid *
cell_typeint – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET
callN_les_callback_2d *
Returns
N_les *

Definition at line 563 of file n_les_assemble.c.

◆ N_assemble_les_3d()

N_les* N_assemble_les_3d ( int  les_type,
N_geom_data geom,
N_array_3d status,
N_array_3d start_val,
void *  data,
N_les_callback_3d call 
)

Assemble a linear equation system (les) based on 3d location data (g3d) active cells.

This function calls N_assemble_les_3d_param

Definition at line 956 of file n_les_assemble.c.

◆ N_assemble_les_3d_active()

N_les* N_assemble_les_3d_active ( int  les_type,
N_geom_data geom,
N_array_3d status,
N_array_3d start_val,
void *  data,
N_les_callback_3d call 
)

Assemble a linear equation system (les) based on 3d location data (g3d) active cells.

This function calls N_assemble_les_3d_param

Definition at line 970 of file n_les_assemble.c.

◆ N_assemble_les_3d_dirichlet()

N_les* N_assemble_les_3d_dirichlet ( int  les_type,
N_geom_data geom,
N_array_3d status,
N_array_3d start_val,
void *  data,
N_les_callback_3d call 
)

Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells.

This function calls N_assemble_les_3d_param

Definition at line 984 of file n_les_assemble.c.

◆ N_assemble_les_3d_param()

N_les* N_assemble_les_3d_param ( int  les_type,
N_geom_data geom,
N_array_3d status,
N_array_3d start_val,
void *  data,
N_les_callback_3d call,
int  cell_type 
)

Assemble a linear equation system (les) based on 3d location data (g3d)

The linear equation system type can be set to N_NORMAL_LES to create a regular matrix, or to N_SPARSE_LES to create a sparse matrix. This function returns a new created linear equation system which can be solved with linear equation solvers. An 3d array with start values and an 3d status array must be provided as well as the location geometry and a void pointer to data passed to the callback which creates the les row entries. This callback must be defined in the N_les_callback_3d structure.

The creation of the les is parallelized with OpenMP. If you implement new callbacks, please make sure that the function calls are thread safe.

the les can be created in two ways, with dirichlet and similar cells and without them, to spare some memory. If the les is created with dirichlet cell, the dirichlet boundary condition must be added.

Parameters
les_typeint
geomN_geom_data*
statusN_array_3d *
start_valN_array_3d *
datavoid *
callN_les_callback_3d *
cell_typeint – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET
Returns
N_les *

Definition at line 1021 of file n_les_assemble.c.

◆ N_calc_arith_mean()

double N_calc_arith_mean ( double  a,
double  b 
)

Calculate the arithmetic mean of values a and b.

mean = (a+b)/2

Parameters
adouble
bdouble
Returns
val double

Definition at line 31 of file n_tools.c.

◆ N_calc_arith_mean_n()

double N_calc_arith_mean_n ( double *  a,
int  size 
)

Calculate the arithmetic mean of the values in vector a of size n.

n = [0 ... size[ mean = (a[0] + a[1] + ... + a[n])/size

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 51 of file n_tools.c.

◆ N_calc_array_2d_stats()

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.

Calculates the minimum, maximum, sum and the number of non null values. The array offset can be included in the calculation.

Parameters
aN_array_2d * - input array
mindouble* - variable to store the computed minimum
maxdouble* - variable to store the computed maximum
sumdouble* - variable to store the computed sum
nonullint* - variable to store the number of non null values
withoffset- if 1 include offset values in statistic calculation, 0 otherwise
Returns
void

Definition at line 213 of file n_arrays_calc.c.

Referenced by N_calc_gradient_field_2d_stats().

◆ N_calc_array_3d_stats()

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.

Calculates the minimum, maximum, sum and the number of non null values. The array offset can be included in the statistical calculation.

Parameters
aN_array_3d * - input array
mindouble* - variable to store the computed minimum
maxdouble* - variable to store the computed maximum
sumdouble* - variable to store the computed sum
nonullint* - variable to store the number of non null values
withoffset- if 1 include offset values in statistic calculation, 0 otherwise
Returns
void

Definition at line 627 of file n_arrays_calc.c.

Referenced by N_calc_gradient_field_3d_stats().

◆ N_calc_geom_mean()

double N_calc_geom_mean ( double  a,
double  b 
)

Calculate the geometrical mean of values a and b.

mean = sqrt(a*b)

Parameters
adouble
bdouble
Returns
val double

Definition at line 73 of file n_tools.c.

◆ N_calc_geom_mean_n()

double N_calc_geom_mean_n ( double *  a,
int  size 
)

Calculate the geometrical mean of the values in vector a of size n.

n = [0 ... size[ mean = pow((a[0] * a[1] * ... * a[n]), 1.0/size)

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 93 of file n_tools.c.

◆ N_calc_gradient_field_2d_stats()

void N_calc_gradient_field_2d_stats ( N_gradient_field_2d field)

Calculate basic statistics of a gradient field.

The statistic is stored in the gradient field struct

Parameters
fieldN_gradient_2d_field *
Returns
void

Definition at line 28 of file n_gradient_calc.c.

References G_debug(), N_gradient_field_2d::max, N_gradient_field_2d::mean, N_gradient_field_2d::min, N_calc_array_2d_stats(), N_gradient_field_2d::nonull, N_gradient_field_2d::sum, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

Referenced by N_compute_gradient_field_2d().

◆ N_calc_gradient_field_3d_stats()

void N_calc_gradient_field_3d_stats ( N_gradient_field_3d field)

Calculate basic statistics of a gradient field.

The statistic is stored in the gradient field struct

Parameters
fieldN_gradient_3d_field *
Returns
void

Definition at line 303 of file n_gradient_calc.c.

References G_debug(), N_gradient_field_3d::max, N_gradient_field_3d::mean, N_gradient_field_3d::min, N_calc_array_3d_stats(), N_gradient_field_3d::nonull, N_gradient_field_3d::sum, N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.

Referenced by N_compute_gradient_field_3d().

◆ N_calc_harmonic_mean()

double N_calc_harmonic_mean ( double  a,
double  b 
)

Calculate the harmonical mean of values a and b.

mean = 2*(a*b)/(a + b)

Parameters
adouble
bdouble
Returns
val double – if (a + b) == 0, a 0 is returned

Definition at line 115 of file n_tools.c.

Referenced by N_compute_gradient_field_2d(), and N_compute_gradient_field_3d().

◆ N_calc_harmonic_mean_n()

double N_calc_harmonic_mean_n ( double *  a,
int  size 
)

Calculate the harmonical mean of the values in vector a of size n.

n = [0 ... size[ mean = 1/(1/size *(1/a[0] + 1/a[1] + ... + 1/a[n]))

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double – if one division with 0 is detected, 0 will be returned

Definition at line 136 of file n_tools.c.

◆ N_calc_quad_mean()

double N_calc_quad_mean ( double  a,
double  b 
)

Calculate the quadratic mean of values a and b.

mean = sqrt((a*a + b*b)/2)

Parameters
adouble
bdouble
Returns
val double

Definition at line 164 of file n_tools.c.

◆ N_calc_quad_mean_n()

double N_calc_quad_mean_n ( double *  a,
int  size 
)

Calculate the quadratic mean of the values in vector a of size n.

n = [0 ... size[ mean = sqrt((a[0]*a[0] + a[1]*a[1] + ... + a[n]*a[n])/size)

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 184 of file n_tools.c.

◆ N_callback_template_2d()

N_data_star* N_callback_template_2d ( void *  data,
N_geom_data geom,
int  col,
int  row 
)

◆ N_callback_template_3d()

N_data_star* N_callback_template_3d ( void *  data,
N_geom_data geom,
int  col,
int  row,
int  depth 
)

◆ N_compute_gradient_field_2d()

N_gradient_field_2d* N_compute_gradient_field_2d ( N_array_2d pot,
N_array_2d weight_x,
N_array_2d weight_y,
N_geom_data geom,
N_gradient_field_2d gradfield 
)

This function computes the gradient based on the input N_array_2d pot (potential), a weighting factor N_array_2d named weight and the distance between two cells saved in the N_geom_data struct.

The gradient is calculated between cells for each cell and direction. An existing gradient field can be filled with new data or, if a NULL pointer is given, a new gradient field will be allocated with the appropriate size.

______________
|    |    |    |
|    |    |    |
|----|-NC-|----|
|    |    |    |
|   WC    EC   |
|    |    |    |
|----|-SC-|----|
|    |    |    |
|____|____|____|


x - direction:

r = 2 * weight[row][col]*weight[row][col + 1] /
(weight[row][col]*weight[row][col + 1]) EC = r * (pot[row][col] - pot[row][col
+ 1])/dx

y - direction:

r = 2 * weight[row][col]*weight[row + 1][col] / (weight[row][col]*weight[row +
1][col]) SC = r * (pot[row][col] - pot[row + 1][col])/dy

the values SC and EC are the values of the next row/col
Parameters
potN_array_2d * - the potential N_array_2d
weight_xN_array_2d * - the weighting factor N_array_2d used to modify the gradient in x-direction
weight_yN_array_2d * - the weighting factor N_array_2d used to modify the gradient in y-direction
geomN_geom_data * - geometry data structure
gradfieldN_gradient_field_2d * - a gradient field of the correct size, if a NULL pointer is provided this gradient field will be new allocated
Returns
N_gradient_field_2d * - the pointer to the computed gradient field

Definition at line 109 of file n_gradient_calc.c.

References N_geom_data::cols, N_array_2d::cols, N_gradient_field_2d::cols, N_geom_data::dx, N_geom_data::dy, G_debug(), G_fatal_error(), mean(), N_alloc_gradient_field_2d(), N_calc_gradient_field_2d_stats(), N_calc_harmonic_mean(), N_get_array_2d_d_value(), N_is_array_2d_value_null(), N_put_array_2d_d_value(), NULL, N_geom_data::rows, N_array_2d::rows, N_gradient_field_2d::rows, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

◆ N_compute_gradient_field_3d()

N_gradient_field_3d* N_compute_gradient_field_3d ( N_array_3d pot,
N_array_3d weight_x,
N_array_3d weight_y,
N_array_3d weight_z,
N_geom_data geom,
N_gradient_field_3d gradfield 
)

This function computes the gradient based on the input N_array_3d pot (that means potential), a weighting factor N_array_3d named weight and the distance between two cells saved in the N_geom_data struct.

The gradient is calculated between cells for each cell and direction. An existing gradient field can be filled with new data or, if a NULL pointer is given, a new gradient field will be allocated with the appropriate size.

|  /
TC NC
|/
--WC-----EC--
/|
SC BC
/  |

x - direction:

r = 2 * weight_x[depth][row][col]*weight_x[depth][row][col + 1] /
(weight_X[depth][row][col]*weight_x[depth][row][col + 1]) EC = r *
(pot[depth][row][col] - pot[depth][row][col + 1])/dx

y - direction:

r = 2 * weight_y[depth][row][col]*weight_y[depth][row + 1][col] /
(weight_y[depth][row][col]*weight_y[depth][row + 1][col]) SC = r *
(pot[depth][row][col] - pot[depth][row + 1][col])/dy

z - direction:

r = 2 * weight_z[depth][row][col]*weight_z[depth + 1][row][col] /
(weight_z[depth][row][col]*weight_z[depth + 1][row][col]) TC = r *
(pot[depth][row][col] - pot[depth + 1][row][col])/dy

the values BC, NC, WC are the values of the next depth/row/col
Parameters
potN_array_3d * - the potential N_array_2d
weight_xN_array_3d * - the weighting factor N_array_3d used to modify the gradient in x-direction
weight_yN_array_3d * - the weighting factor N_array_3d used to modify the gradient in y-direction
weight_zN_array_3d * - the weighting factor N_array_3d used to modify the gradient in z-direction
geomN_geom_data * - geometry data structure
gradfieldN_gradient_field_3d * - a gradient field of the correct size, if a NULL pointer is provided this gradient field will be new allocated
Returns
N_gradient_field_3d * - the pointer to the computed gradient field

Definition at line 400 of file n_gradient_calc.c.

References N_geom_data::cols, N_array_3d::cols, N_gradient_field_3d::cols, N_geom_data::depths, N_array_3d::depths, N_gradient_field_3d::depths, N_geom_data::dx, N_geom_data::dy, N_geom_data::dz, G_debug(), G_fatal_error(), mean(), N_alloc_gradient_field_3d(), N_calc_gradient_field_3d_stats(), N_calc_harmonic_mean(), N_get_array_3d_d_value(), N_is_array_3d_value_null(), N_put_array_3d_d_value(), NULL, N_geom_data::rows, N_array_3d::rows, N_gradient_field_3d::rows, N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.

◆ N_compute_gradient_field_components_2d()

void N_compute_gradient_field_components_2d ( N_gradient_field_2d field,
N_array_2d x_comp,
N_array_2d y_comp 
)

Calculate the x and y vector components from a gradient field for each cell and stores them in the provided N_array_2d structures.

The arrays must have the same size as the gradient field.

Based on this storages scheme the gradient vector for each cell is
calculated and stored in the provided  N_array_2d structures

______________
|    |    |    |
|    |    |    |
|----|-NC-|----|
|    |    |    |
|   WC    EC   |
|    |    |    |
|----|-SC-|----|
|    |    |    |
|____|____|____|

x vector component:

x = (WC + EC) / 2

y vector component:

y = (NC + SC) / 2
Parameters
fieldN_gradient_field_2d *
x_compN_array_2d * - the array in which the x component will be written
y_compN_array_2d * - the array in which the y component will be written
Returns
void

Definition at line 242 of file n_gradient_calc.c.

References N_array_2d::cols, N_gradient_2d::EC, G_fatal_error(), N_get_gradient_2d(), N_put_array_2d_d_value(), N_gradient_2d::NC, N_array_2d::rows, N_gradient_2d::SC, N_gradient_2d::WC, x, and N_gradient_field_2d::x_array.

◆ N_compute_gradient_field_components_3d()

void N_compute_gradient_field_components_3d ( N_gradient_field_3d field,
N_array_3d x_comp,
N_array_3d y_comp,
N_array_3d z_comp 
)

Calculate the x, y and z vector components from a gradient field for each cell and store them in the provided N_array_3d structures.

The arrays must have the same size as the gradient field.

Based on this storages scheme the gradient vector for each cell is
calculated and stored in the provided  N_array_3d structures


|  /
TC NC
|/
--WC-----EC--
/|
SC BC
/  |


x vector component:

x = (WC + EC) / 2

y vector component:

y = (NC + SC) / 2

z vector component:

z = (TC + BC) / 2
Parameters
fieldN_gradient_field_3d *
x_compN_array_3d * - the array in which the x component will be written
y_compN_array_3d * - the array in which the y component will be written
z_compN_array_3d * - the array in which the z component will be written
Returns
void

Definition at line 595 of file n_gradient_calc.c.

References N_gradient_3d::BC, N_array_3d::cols, N_array_3d::depths, N_gradient_3d::EC, G_fatal_error(), N_get_gradient_3d(), N_put_array_3d_d_value(), N_gradient_3d::NC, N_array_3d::rows, N_gradient_3d::SC, N_gradient_3d::TC, N_gradient_3d::WC, x, and N_gradient_field_3d::x_array.

◆ N_convert_array_2d_null_to_zero()

int N_convert_array_2d_null_to_zero ( N_array_2d a)

Convert all null values to zero values.

The complete data array inclusively offsets is used. The array data types are automatically recognized.

Parameters
aN_array_2d *
Returns
int - number of replaced values

Definition at line 418 of file n_arrays_calc.c.

◆ N_convert_array_3d_null_to_zero()

int N_convert_array_3d_null_to_zero ( N_array_3d a)

Convert all null values to zero values.

The complete data array inclusively offsets is used.

Parameters
aN_array_3d *
Returns
int - number of replaced null values

Definition at line 832 of file n_arrays_calc.c.

◆ N_copy_array_2d()

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.

The arrays must have the same size and the same offset.

The array types can be mixed, the values are automatically casted and the null values are set accordingly.

If you copy a cell array into a dcell array, the values are casted to dcell and the null values are converted from cell-null to dcell-null

This function can be called in a parallel region defined with OpenMP. The copy loop is parallelize with a openmp for pragma.

Parameters
sourceN_array_2d *
targetN_array_2d *
Returns
void

Definition at line 43 of file n_arrays_calc.c.

References N_array_2d::cell_array, CELL_TYPE, N_array_2d::cols_intern, N_array_2d::dcell_array, DCELL_TYPE, N_array_2d::fcell_array, FCELL_TYPE, G_debug(), G_fatal_error(), Rast_is_c_null_value, Rast_is_d_null_value, Rast_is_f_null_value, Rast_set_c_null_value(), Rast_set_d_null_value(), Rast_set_f_null_value(), N_array_2d::rows_intern, and N_array_2d::type.

Referenced by N_copy_gradient_field_2d().

◆ N_copy_array_3d()

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.

The arrays must have the same size and the same offset.

The array data types can be mixed, the values are automatically casted and the null values are set accordingly.

If you copy a float array to a double array, the values are casted to DCELL and the null values are converted from FCELL-null to DCELL-null

Parameters
sourceN_array_3d *
targetN_array_3d *
Returns
void

Definition at line 485 of file n_arrays_calc.c.

References N_array_3d::cols_intern, N_array_3d::dcell_array, DCELL_TYPE, N_array_3d::depths_intern, N_array_3d::fcell_array, FCELL_TYPE, G_debug(), G_fatal_error(), Rast3d_is_null_value_num(), Rast3d_set_null_value(), N_array_3d::rows_intern, and N_array_3d::type.

Referenced by N_copy_gradient_field_3d().

◆ N_copy_gradient_2d()

int N_copy_gradient_2d ( N_gradient_2d source,
N_gradient_2d target 
)

copy a N_gradient_2d structure

Parameters
source- the source N_gradient_2d struct
target- the target N_gradient_2d struct
Returns
int - 1 success, 0 failure while copying

Definition at line 83 of file n_gradient.c.

References N_gradient_2d::EC, G_debug(), N_gradient_2d::NC, N_gradient_2d::SC, and N_gradient_2d::WC.

◆ N_copy_gradient_3d()

int N_copy_gradient_3d ( N_gradient_3d source,
N_gradient_3d target 
)

copy a N_gradient_3d structure

Parameters
source- the source N_gradient_3d struct
target- the target N_gradient_3d struct
Returns
int - 1 success, 0 failure while copying

Definition at line 211 of file n_gradient.c.

References N_gradient_3d::BC, N_gradient_3d::EC, G_debug(), N_gradient_3d::NC, N_gradient_3d::SC, N_gradient_3d::TC, and N_gradient_3d::WC.

◆ N_copy_gradient_field_2d()

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.

Parameters
source- the source N_gradient_field_2d struct
target- the target N_gradient_field_2d struct
Returns
int - 1 success, 0 failure while copying

Definition at line 941 of file n_gradient.c.

References G_debug(), N_copy_array_2d(), N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

◆ N_copy_gradient_field_3d()

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.

Parameters
source- the source N_gradient_field_3d struct
target- the target N_gradient_field_3d struct
Returns
int - 1 success, 0 failure while copying

Definition at line 1041 of file n_gradient.c.

References G_debug(), N_copy_array_3d(), N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.

◆ N_copy_gradient_neighbours_2d()

int N_copy_gradient_neighbours_2d ( N_gradient_neighbours_2d source,
N_gradient_neighbours_2d target 
)

copy a N_gradient_neighbours_2d structure

Parameters
source- the source N_gradient_neighbours_2d struct
target- the target N_gradient_neighbours_2d struct
Returns
int - 1 success, 0 failure while copying

Definition at line 650 of file n_gradient.c.

References G_debug(), N_copy_gradient_neighbours_x(), N_copy_gradient_neighbours_y(), N_gradient_neighbours_2d::x, and N_gradient_neighbours_2d::y.

Referenced by N_get_gradient_neighbours_2d().

◆ N_copy_gradient_neighbours_3d()

◆ N_copy_gradient_neighbours_x()

◆ N_copy_gradient_neighbours_y()

◆ N_copy_gradient_neighbours_z()

◆ N_create_27star()

N_data_star* N_create_27star ( double  C,
double  W,
double  E,
double  N,
double  S,
double  NW,
double  SW,
double  NE,
double  SE,
double  T,
double  W_T,
double  E_T,
double  N_T,
double  S_T,
double  NW_T,
double  SW_T,
double  NE_T,
double  SE_T,
double  B,
double  W_B,
double  E_B,
double  N_B,
double  S_B,
double  NW_B,
double  SW_B,
double  NE_B,
double  SE_B,
double  V 
)

allocate and initialize a 27 point star data structure

Parameters
Cdouble
Wdouble
Edouble
Ndouble
Sdouble
NWdouble
SWdouble
NEdouble
SEdouble
Tdouble
W_Tdouble
E_Tdouble
N_Tdouble
S_Tdouble
NW_Tdouble
SW_Tdouble
NE_Tdouble
SE_Tdouble
Bdouble
W_Bdouble
E_Bdouble
N_Bdouble
S_Bdouble
NW_Bdouble
SW_Bdouble
NE_Bdouble
SE_Bdouble
Vdouble
Returns
N_data_star *

Definition at line 264 of file n_les_assemble.c.

References N_data_star::B, N_data_star::C, N_data_star::E, N_data_star::E_B, N_data_star::E_T, G_debug(), N_data_star::N, N, N_alloc_27star(), N_data_star::N_B, N_data_star::N_T, N_data_star::NE, NE, N_data_star::NE_B, N_data_star::NE_T, N_data_star::NW, NW, N_data_star::NW_B, N_data_star::NW_T, N_data_star::S, N_data_star::S_B, N_data_star::S_T, N_data_star::SE, SE, N_data_star::SE_B, N_data_star::SE_T, N_data_star::SW, SW, N_data_star::SW_B, N_data_star::SW_T, N_data_star::T, N_data_star::V, W, N_data_star::W, N_data_star::W_B, and N_data_star::W_T.

◆ N_create_5star()

N_data_star* N_create_5star ( double  C,
double  W,
double  E,
double  N,
double  S,
double  V 
)

allocate and initialize a 5 point star data structure

Parameters
Cdouble
Wdouble
Edouble
Ndouble
Sdouble
Vdouble
Returns
N_data_star *

Definition at line 124 of file n_les_assemble.c.

References N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N, N_alloc_5star(), N_data_star::S, N_data_star::V, W, and N_data_star::W.

◆ N_create_7star()

N_data_star* N_create_7star ( double  C,
double  W,
double  E,
double  N,
double  S,
double  T,
double  B,
double  V 
)

allocate and initialize a 7 point star data structure

Parameters
Cdouble
Wdouble
Edouble
Ndouble
Sdouble
Tdouble
Bdouble
Vdouble
Returns
N_data_star *

Definition at line 159 of file n_les_assemble.c.

References N_data_star::B, N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N, N_alloc_7star(), N_data_star::S, N_data_star::T, N_data_star::V, W, and N_data_star::W.

◆ N_create_9star()

N_data_star* N_create_9star ( double  C,
double  W,
double  E,
double  N,
double  S,
double  NW,
double  SW,
double  NE,
double  SE,
double  V 
)

allocate and initialize a 9 point star data structure

Parameters
Cdouble
Wdouble
Edouble
Ndouble
Sdouble
NWdouble
SWdouble
NEdouble
SEdouble
Vdouble
Returns
N_data_star *

Definition at line 200 of file n_les_assemble.c.

References N_data_star::C, N_data_star::E, G_debug(), N_data_star::N, N, N_alloc_9star(), N_data_star::NE, NE, N_data_star::NW, NW, N_data_star::S, N_data_star::SE, SE, N_data_star::SW, SW, N_data_star::V, W, and N_data_star::W.

◆ N_create_gradient_2d()

N_gradient_2d* N_create_gradient_2d ( double  NC,
double  SC,
double  WC,
double  EC 
)

allocate and initialize a N_gradient_2d structure

Parameters
NCdouble - the gradient between northern and center cell
SCdouble - the gradient between southern and center cell
WCdouble - the gradient between western and center cell
ECdouble - the gradient between eastern and center cell
Returns
N_gradient_2d *

Definition at line 59 of file n_gradient.c.

References N_gradient_2d::EC, G_debug(), N_alloc_gradient_2d(), N_gradient_2d::NC, N_gradient_2d::SC, and N_gradient_2d::WC.

Referenced by N_get_gradient_2d().

◆ N_create_gradient_3d()

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

Parameters
NCdouble - the gradient between northern and center cell
SCdouble - the gradient between southern and center cell
WCdouble - the gradient between western and center cell
ECdouble - the gradient between eastern and center cell
TCdouble - the gradient between top and center cell
BCdouble - the gradient between bottom and center cell
Returns
N_gradient_3d *

Definition at line 184 of file n_gradient.c.

References N_gradient_3d::BC, N_gradient_3d::EC, G_debug(), N_alloc_gradient_3d(), N_gradient_3d::NC, N_gradient_3d::SC, N_gradient_3d::TC, and N_gradient_3d::WC.

◆ N_create_gradient_neighbours_2d()

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.

The parameter N_gradient_neighbours x and y are copied into the new allocated structure and can be deleted after the initializing

Returns
N_gradient_neighbours_2d * – if failure NULL is returned

Definition at line 618 of file n_gradient.c.

References G_debug(), N_alloc_gradient_neighbours_2d(), N_copy_gradient_neighbours_x(), N_copy_gradient_neighbours_y(), N_free_gradient_neighbours_2d(), NULL, x, N_gradient_neighbours_2d::x, and N_gradient_neighbours_2d::y.

Referenced by N_get_gradient_neighbours_2d().

◆ N_create_gradient_neighbours_3d()

◆ N_create_gradient_neighbours_x()

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.

Parameters
NWNdouble - the gradient between north-west and northern cell
NENdouble - the gradient between north-east and northern cell
WCdouble - the gradient between western and center cell
ECdouble - the gradient between eastern and center cell
SWSdouble - the gradient between south-west and southern cell
SESdouble - the gradient between south-east and southern cell
Returns
N_gradient_neighbours_x *

Definition at line 326 of file n_gradient.c.

References N_gradient_neighbours_x::EC, G_debug(), N_alloc_gradient_neighbours_x(), N_gradient_neighbours_x::NEN, N_gradient_neighbours_x::NWN, N_gradient_neighbours_x::SES, N_gradient_neighbours_x::SWS, and N_gradient_neighbours_x::WC.

Referenced by N_get_gradient_neighbours_2d().

◆ N_create_gradient_neighbours_y()

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.

Parameters
NWWdouble - the gradient between north-west and western cell
NEEdouble - the gradient between north-east and eastern cell
NCdouble - the gradient between northern and center cell
SCdouble - the gradient between southern and center cell
SWWdouble - the gradient between south-west and western cell
SEEdouble - the gradient between south-east and eastern cell
Returns
N_gradient_neighbours_y *

Definition at line 418 of file n_gradient.c.

References G_debug(), N_alloc_gradient_neighbours_y(), N_gradient_neighbours_y::NC, N_gradient_neighbours_y::NEE, N_gradient_neighbours_y::NWW, N_gradient_neighbours_y::SC, N_gradient_neighbours_y::SEE, and N_gradient_neighbours_y::SWW.

Referenced by N_get_gradient_neighbours_2d().

◆ N_create_gradient_neighbours_z()

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.

Parameters
NWZdouble - the gradient between upper and lower north-western cells
NZdouble - the gradient between upper and lower northern cells
NEZdouble - the gradient between upper and lower north-eastern cells
WZdouble - the gradient between upper and lower western cells
CZdouble - the gradient between upper and lower center cells
EZdouble - the gradient between upper and lower eastern cells
SWZdouble - the gradient between upper and lower south-western cells
SZdouble - the gradient between upper and lower southern cells
SEZdouble - the gradient between upper and lower south-eastern cells
Returns
N_gradient_neighbours_z *

Definition at line 513 of file n_gradient.c.

References N_gradient_neighbours_z::CZ, N_gradient_neighbours_z::EZ, G_debug(), N_alloc_gradient_neighbours_z(), N_gradient_neighbours_z::NEZ, N_gradient_neighbours_z::NWZ, N_gradient_neighbours_z::NZ, N_gradient_neighbours_z::SEZ, N_gradient_neighbours_z::SWZ, N_gradient_neighbours_z::SZ, and N_gradient_neighbours_z::WZ.

◆ N_define_standard_option()

struct Option* N_define_standard_option ( int  opt)

Create standardised Option structure related to the gpde library.

This function will create a standardised Option structure defined by parameter opt. A list of valid parameters can be found in N_pde.h. It allocates memory for the Option structure and returns a pointer to this memory (of type struct Option *).

If an invalid parameter was specified an empty Option structure will be returned (not NULL).

This function is related to the gpde library, general standard options can be found in lib/gis/parser.c. These options are set with G_define_standard_option ();

Parameters
[in]optType of Option struct to create
Returns
Option * Pointer to an Option struct

Definition at line 42 of file n_parse_options.c.

References _, Option::answer, Option::description, G_define_option(), Option::guisection, Option::key, Option::key_desc, N_OPT_CALC_TIME, N_OPT_ITERATION_ERROR, N_OPT_MAX_ITERATIONS, N_OPT_SOLVER_SYMM, N_OPT_SOLVER_UNSYMM, N_OPT_SOR_VALUE, NO, Option::options, Option::required, Option::type, TYPE_DOUBLE, TYPE_INTEGER, TYPE_STRING, and YES.

◆ N_exp_upwinding()

double N_exp_upwinding ( double  sprod,
double  distance,
double  D 
)

exponential upwinding stabilization algorithm

The arguments are values to compute the local peclet number

Parameters
sproddouble – the scalar product between the velocity vector and the normal vector between two points
distancedouble – distance between two points
Ddouble – diffusion/dispersion tensor part between two points
Returns
the weighting factor

Definition at line 63 of file n_upwind.c.

References D.

◆ N_free_array_2d()

void N_free_array_2d ( N_array_2d data)

Release the memory of a N_array_2d structure.

Parameters
dataN_array_2d *
Returns
void

Definition at line 132 of file n_arrays.c.

Referenced by N_free_gradient_field_2d().

◆ N_free_array_3d()

void N_free_array_3d ( N_array_3d data)

Release the memory of a N_array_3d.

Parameters
dataN_array_3d *
Returns
void

Definition at line 774 of file n_arrays.c.

Referenced by N_free_gradient_field_3d().

◆ N_free_geom_data()

void N_free_geom_data ( N_geom_data geom)

Release memory of a pde geometry data structure.

Parameters
geomN_geom_data *
Returns
void

Definition at line 49 of file n_geom.c.

References N_geom_data::area, G_free(), and NULL.

◆ N_free_gradient_2d()

void N_free_gradient_2d ( N_gradient_2d grad)

Free's a N_gradient_2d structure.

Returns
void

Definition at line 41 of file n_gradient.c.

References G_free(), and NULL.

◆ N_free_gradient_3d()

void N_free_gradient_3d ( N_gradient_3d grad)

Free's a N_gradient_3d structure.

Returns
void

Definition at line 164 of file n_gradient.c.

References G_free(), and NULL.

◆ N_free_gradient_field_2d()

void N_free_gradient_field_2d ( N_gradient_field_2d field)

Free's a N_gradient_neighbours_2d structure.

Returns
void

Definition at line 920 of file n_gradient.c.

References G_free(), N_free_array_2d(), NULL, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

◆ N_free_gradient_field_3d()

void N_free_gradient_field_3d ( N_gradient_field_3d field)

◆ N_free_gradient_neighbours_2d()

◆ N_free_gradient_neighbours_3d()

◆ N_free_gradient_neighbours_x()

void N_free_gradient_neighbours_x ( N_gradient_neighbours_x grad)

Free's a N_gradient_neighbours_x structure.

Returns
void

Definition at line 305 of file n_gradient.c.

References G_free(), and NULL.

Referenced by N_free_gradient_neighbours_2d(), N_free_gradient_neighbours_3d(), and N_get_gradient_neighbours_2d().

◆ N_free_gradient_neighbours_y()

void N_free_gradient_neighbours_y ( N_gradient_neighbours_y grad)

Free's a N_gradient_neighbours_y structure.

Returns
void

Definition at line 397 of file n_gradient.c.

References G_free(), and NULL.

Referenced by N_free_gradient_neighbours_2d(), N_free_gradient_neighbours_3d(), and N_get_gradient_neighbours_2d().

◆ N_free_gradient_neighbours_z()

void N_free_gradient_neighbours_z ( N_gradient_neighbours_z grad)

Free's a N_gradient_neighbours_z structure.

Returns
void

Definition at line 489 of file n_gradient.c.

References G_free(), and NULL.

Referenced by N_free_gradient_neighbours_3d().

◆ N_free_les()

void N_free_les ( N_les les)

Release the memory of the linear equation system.

Parameters
lesN_les *
Returns
void

Definition at line 307 of file n_les.c.

References N_les::A, N_les::Asp, N_les::b, free(), G_debug(), G_free(), G_free_matrix(), G_math_free_spmatrix(), N_SPARSE_LES, N_les::rows, N_les::type, and N_les::x.

◆ N_full_upwinding()

double N_full_upwinding ( double  sprod,
double  distance,
double  D 
)

full upwinding stabilization algorithm

The arguments are values to compute the local peclet number

Parameters
sproddouble – the scalar product between the velocity vector and the normal vector between two points
distancedouble – distance between two points
Ddouble – diffusion/dispersion tensor part between two points
Returns
the weighting factor

Definition at line 32 of file n_upwind.c.

References D.

◆ N_get_array_2d_c_value()

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.

The data array can be of type CELL, FCELL or DCELL, the value will be casted to the CELL type.

Parameters
dataN_array_2d *
colint
rowint
Returns
CELL

Definition at line 314 of file n_arrays.c.

Referenced by N_les_integrate_dirichlet_2d().

◆ N_get_array_2d_d_value()

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.

The data array can be of type CELL, FCELL or DCELL, the value will be casted to the DCELL type.

Parameters
dataN_array_2d *
colint
rowint
Returns
DCELL

Definition at line 380 of file n_arrays.c.

Referenced by N_compute_gradient_field_2d(), N_get_gradient_2d(), N_get_gradient_neighbours_2d(), and N_les_integrate_dirichlet_2d().

◆ N_get_array_2d_f_value()

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.

The data array can be of type CELL, FCELL or DCELL, the value will be casted to the FCELL type.

Parameters
dataN_array_2d *
colint
rowint
Returns
FCELL

Definition at line 347 of file n_arrays.c.

◆ N_get_array_2d_type()

int N_get_array_2d_type ( N_array_2d array)

Return the data type of the N_array_2d struct.

The data type can be CELL_TYPE, FCELL_TYPE or DCELL_TYPE accordingly to the raster map data types.

Parameters
arrayN_array_2d *
Returns
type int

Definition at line 164 of file n_arrays.c.

References N_array_2d::type.

◆ N_get_array_2d_value()

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.

The value must be of the same type as the array. Otherwise you will risk data losses.

Parameters
dataN_array_2d *
colint
rowint
valuevoid * - this variable contains the array value at col, row position
Returns
void

Definition at line 182 of file n_arrays.c.

◆ N_get_array_3d_d_value()

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.

The data type can be FCELL_TYPE or DCELL_TYPE accordingly to the raster map data types.

Parameters
dataN_array_3d *
colint
rowint
depthint
Returns
double

Definition at line 979 of file n_arrays.c.

Referenced by N_compute_gradient_field_3d(), and N_les_integrate_dirichlet_3d().

◆ N_get_array_3d_f_value()

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.

The data type can be FCELL_TYPE or DCELL_TYPE accordingly to the raster map data types.

Parameters
dataN_array_3d *
colint
rowint
depthint
Returns
float

Definition at line 948 of file n_arrays.c.

◆ N_get_array_3d_type()

int N_get_array_3d_type ( N_array_3d array)

Return the data type of the N_array_3d.

The data type can be FCELL_TYPE and DCELL_TYPE accordingly to the raster map data types.

Parameters
arrayN_array_3d *
Returns
type int – FCELL_TYPE or DCELL_TYPE

Definition at line 803 of file n_arrays.c.

References N_array_3d::type.

◆ N_get_array_3d_value()

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.

The value must be from the same type as the array. Otherwise you will risk data losses.

Parameters
dataN_array_3d *
colint
rowint
depthint
valuevoid *
Returns
void

Definition at line 822 of file n_arrays.c.

◆ N_get_geom_data_area_of_cell()

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.

This function works for two and three dimensions

Parameters
geomN_geom_data *
rowint
Returns
area double

Definition at line 196 of file n_geom.c.

References N_geom_data::area, N_geom_data::Az, G_debug(), and N_geom_data::planimetric.

◆ N_get_gradient_2d()

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].

This function returns the gradient of a cell at position [row][col] from the input gradient field. Returned is a new structure of type N_gradient_2d.

Parameters
fieldN_gradient_field_2d * - A two dimensional gradient field
gradientN_gradient_2d * - the gradient structure which should be filled with data, if a NULL pointer is given, a new structure will be created
colint
rowint
Returns
N_gradient_2d * - the new or filled gradient structure

Definition at line 114 of file n_gradient.c.

References N_gradient_2d::EC, G_debug(), N_create_gradient_2d(), N_get_array_2d_d_value(), N_gradient_2d::NC, N_gradient_2d::SC, N_gradient_2d::WC, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

Referenced by N_compute_gradient_field_components_2d().

◆ N_get_gradient_3d()

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][col].

This function returns the gradient of a 3d cell at position [depth][row][col] from the input gradient field. Returned is a new structure of type N_gradient_3d.

Parameters
fieldN_gradient_field_3d * - A three dimensional gradient field
gradientN_gradient_3d * - an existing gradient structure or a NULL pointer, if a NULL pointer is providet a new structure will be returned
colint
rowint
depthint
Returns
N_gradient_3d *

Definition at line 246 of file n_gradient.c.

Referenced by N_compute_gradient_field_components_3d().

◆ N_get_gradient_neighbours_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][col].

This function returns the gradient neighbours in x and y dierection of a cell at position [row][col] from the input gradient field. Returned is a pointer to a structure of type N_gradient_neighbours_2d.

Parameters
fieldN_gradient_field_2d * - A two dimensional gradient field
gradientN_gradient_neighbours_2d * - the gradient structure which should be filled with data, if a NULL pointer is given, a new structure will be created
colint
rowint
Returns
N_gradient_neighbours_2d * - the new or filled gradient structure

Definition at line 689 of file n_gradient.c.

References G_debug(), N_copy_gradient_neighbours_2d(), N_create_gradient_neighbours_2d(), N_create_gradient_neighbours_x(), N_create_gradient_neighbours_y(), N_free_gradient_neighbours_2d(), N_free_gradient_neighbours_x(), N_free_gradient_neighbours_y(), N_get_array_2d_d_value(), NULL, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.

◆ N_init_geom_data_2d()

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.

If the projection is not planimetric, a double array will be created based on the number of rows of the provided region storing all computed areas for each row

Parameters
regionsruct Cell_head *
geodataN_geom_data * - if a NULL pointer is given, a new structure will be allocatet and returned
Returns
N_geom_data *

Definition at line 117 of file n_geom.c.

Referenced by N_init_geom_data_3d().

◆ N_init_geom_data_3d()

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.

If the projection is not planimetric, a double array will be created based on the number of rows of the provided region

Parameters
region3dRASTER3D_Region *
geodataN_geom_data * - if a NULL pointer is given, a new structure will be allocatet and returned
Returns
N_geom_data *

Definition at line 73 of file n_geom.c.

References RASTER3D_Region::depths, N_geom_data::depths, N_geom_data::dim, N_geom_data::dz, G_database_units_to_meters_factor(), G_debug(), G_get_set_window(), N_alloc_geom_data(), N_init_geom_data_2d(), NULL, Rast3d_region_to_cell_head(), and RASTER3D_Region::tb_res.

◆ N_is_array_2d_value_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.

This function checks automatically the type of the array and checks for the data type null value.

Parameters
dataN_array_2d *
colint
rowint
Returns
int - 1 = is null, 0 otherwise

Definition at line 231 of file n_arrays.c.

Referenced by N_compute_gradient_field_2d().

◆ N_is_array_3d_value_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, otherwise 0.

This function checks automatically the type of the array and checks for the data type null value.

Parameters
dataN_array_3d *
colint
rowint
depthint
Returns
void

Definition at line 873 of file n_arrays.c.

Referenced by N_compute_gradient_field_3d().

◆ N_les_integrate_dirichlet_2d()

int N_les_integrate_dirichlet_2d ( N_les les,
N_geom_data geom,
N_array_2d status,
N_array_2d start_val 
)

Integrate Dirichlet or Transmission boundary conditions into the les (2s)

Dirichlet and Transmission boundary conditions will be integrated into the provided linear equation system. This is meaningful if the les was created with N_assemble_les_2d_dirichlet, because in this case Dirichlet boundary conditions are not automatically included.

The provided les will be modified:

Ax = b will be split into Ax_u + Ax_d = b

x_u - the unknowns x_d - the Dirichlet cells

Ax_u = b -Ax_d will be computed. Then the matrix A will be modified to

| A_u 0 | x_u | 0 I | x_d

Parameters
lesN_les* – the linear equation system
geomN_geom_data* – geometrical data information
statusN_array_2d* – the status array containing the cell types
start_valN_array_2d* – an array with start values
Returns
int – 1 = success, 0 = failure

Definition at line 793 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_les::b, N_les::cols, N_geom_data::cols, count, G_calloc, G_debug(), G_math_Ax_sparse(), G_math_d_Ax(), G_math_spvector::index, N_CELL_ACTIVE, N_get_array_2d_c_value(), N_get_array_2d_d_value(), N_MAX_CELL_STATE, N_SPARSE_LES, N_les::rows, N_geom_data::rows, N_les::type, G_math_spvector::values, and x.

◆ N_les_integrate_dirichlet_3d()

int N_les_integrate_dirichlet_3d ( N_les les,
N_geom_data geom,
N_array_3d status,
N_array_3d start_val 
)

Integrate Dirichlet or Transmission boundary conditions into the les (3d)

Dirichlet and Transmission boundary conditions will be integrated into the provided linear equation system. This is meaningful if the les was created with N_assemble_les_2d_dirichlet, because in this case Dirichlet boundary conditions are not automatically included.

The provided les will be modified:

Ax = b will be split into Ax_u + Ax_d = b

x_u - the unknowns x_d - the Dirichlet cells

Ax_u = b -Ax_d will be computed. Then the matrix A will be modified to

| A_u 0 | x_u | 0 I | x_d

Parameters
lesN_les* – the linear equation system
geomN_geom_data* – geometrical data information
statusN_array_2d* – the status array containing the cell types
start_valN_array_2d* – an array with start values
Returns
int – 1 = success, 0 = failure

Definition at line 1250 of file n_les_assemble.c.

References N_les::A, N_les::Asp, N_les::b, N_les::cols, N_geom_data::cols, count, N_geom_data::depths, G_calloc, G_debug(), G_math_Ax_sparse(), G_math_d_Ax(), G_math_spvector::index, N_CELL_ACTIVE, N_get_array_3d_d_value(), N_MAX_CELL_STATE, N_SPARSE_LES, N_les::rows, N_geom_data::rows, N_les::type, G_math_spvector::values, and x.

◆ N_les_pivot_create()

int N_les_pivot_create ( N_les les)

◆ N_math_array_2d()

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.

All arrays must have equal sizes and offsets. The complete data array inclusively offsets is used for calucaltions. Only non-null values are computed. If one array value is null, the result array value will be null too.

If a division with zero is detected, the resulting arrays value will set to null and not to NaN.

The result array is optional, if the result arrays points to NULL, a new array will be allocated with the largest arrays data type (CELL, FCELL or DCELL) used by the input arrays.

the array computations can be of the following forms:

  • result = a + b -> N_ARRAY_SUM
  • result = a - b -> N_ARRAY_DIF
  • result = a * b -> N_ARRAY_MUL
  • result = a / b -> N_ARRAY_DIV
Parameters
aN_array_2d * - first input array
bN_array_2d * - second input array
resultN_array_2d * - the optional result array
type- the type of calculation
Returns
N_array_2d * - the pointer to the result array

Definition at line 299 of file n_arrays_calc.c.

◆ N_math_array_3d()

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.

All arrays must have equal sizes and offsets. The complete data array inclusively offsets is used for calucaltions. Only non-null values are used. If one array value is null, the result array value will be null too.

If a division with zero is detected, the resulting arrays value will set to null and not to NaN.

The result array is optional, if the result arrays points to NULL, a new array will be allocated with the largest arrays data type (FCELL_TYPE or DCELL_TYPE) used by the input arrays.

the calculations are of the following form:

  • result = a + b -> N_ARRAY_SUM
  • result = a - b -> N_ARRAY_DIF
  • result = a * b -> N_ARRAY_MUL
  • result = a / b -> N_ARRAY_DIV
Parameters
aN_array_3d * - first input array
bN_array_3d * - second input array
resultN_array_3d * - the optional result array
type- the type of calculation
Returns
N_array_3d * - the pointer to the result array

Definition at line 723 of file n_arrays_calc.c.

◆ N_norm_array_2d()

double N_norm_array_2d ( N_array_2d a,
N_array_2d b,
int  type 
)

Calculate the norm of the two input arrays.

The norm can be of type N_MAXIMUM_NORM or N_EUKLID_NORM. All arrays must have equal sizes and offsets. The complete data array inclusively offsets is used for norm calucaltion. Only non-null values are used to calculate the norm.

Parameters
aN_array_2d *
bN_array_2d *
typethe type of the norm -> N_MAXIMUM_NORM, N_EUKLID_NORM
Returns
double the calculated norm

Definition at line 142 of file n_arrays_calc.c.

◆ N_norm_array_3d()

double N_norm_array_3d ( N_array_3d a,
N_array_3d b,
int  type 
)

Calculate the norm of the two input arrays.

The norm can be of type N_MAXIMUM_NORM or N_EUKLID_NORM. All arrays must have equal sizes and offsets. The complete data array inclusively offsets is used for norm calucaltion. Only non-null values are used to calculate the norm.

Parameters
aN_array_3d *
bN_array_3d *
typethe type of the norm -> N_MAXIMUM_NORM, N_EUKLID_NORM
Returns
double the calculated norm

Definition at line 556 of file n_arrays_calc.c.

◆ N_print_array_2d()

void N_print_array_2d ( N_array_2d data)

Write info and content of the N_array_2d struct to stdout.

Offsets are ignored

Parameters
dataN_array_2d *
Returns
void

Definition at line 628 of file n_arrays.c.

◆ N_print_array_2d_info()

void N_print_array_2d_info ( N_array_2d data)

This function writes the data info of the array data to stdout.

Parameters
dataN_array_2d *
Returns
void

Definition at line 603 of file n_arrays.c.

Referenced by N_print_gradient_field_2d_info().

◆ N_print_array_3d()

void N_print_array_3d ( N_array_3d data)

Write info and content of the array data to stdout.

Offsets are ignored

Parameters
dataN_array_2d *
Returns
void

Definition at line 1196 of file n_arrays.c.

◆ N_print_array_3d_info()

void N_print_array_3d_info ( N_array_3d data)

Write the info of the array to stdout.

Parameters
dataN_array_3d *
Returns
void

Definition at line 1170 of file n_arrays.c.

Referenced by N_print_gradient_field_3d_info().

◆ N_print_gradient_field_2d_info()

void N_print_gradient_field_2d_info ( N_gradient_field_2d field)

◆ N_print_gradient_field_3d_info()

◆ N_print_les()

void N_print_les ( N_les les)

prints the linear equation system to stdout

Format: A*x = b

Example

2 1 1 1 * 2 = 0.1
1 2 0 0 * 3 = 0.2
1 0 2 0 * 3 = 0.2
1 0 0 2 * 2 = 0.1
Parameters
lesN_les *
Returns
void

Definition at line 257 of file n_les.c.

References N_les::A, N_les::Asp, N_les::b, N_les::cols, G_math_spvector::index, N_SPARSE_LES, N_les::rows, N_les::type, G_math_spvector::values, and N_les::x.

◆ N_put_array_2d_c_value()

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.

Parameters
dataN_array_2d *
colint
rowint
valueCELL
Returns
void

Definition at line 516 of file n_arrays.c.

◆ N_put_array_2d_d_value()

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.

Parameters
dataN_array_2d *
colint
rowint
valueDCELL
Returns
void

Definition at line 576 of file n_arrays.c.

Referenced by N_compute_gradient_field_2d(), and N_compute_gradient_field_components_2d().

◆ N_put_array_2d_f_value()

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.

Parameters
dataN_array_2d *
colint
rowint
valueFCELL
Returns
void

Definition at line 546 of file n_arrays.c.

◆ N_put_array_2d_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.

The value will be automatically cast to the array type.

Parameters
dataN_array_2d *
colint
rowint
valuechar *
Returns
void

Definition at line 412 of file n_arrays.c.

◆ N_put_array_2d_value_null()

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.

The null value will be automatically set to the array data type (CELL, FCELL or DCELL).

Parameters
dataN_array_2d *
colint
rowint
Returns
void

Definition at line 459 of file n_arrays.c.

◆ N_put_array_3d_d_value()

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.

Parameters
dataN_array_3d *
colint
rowint
depthint
valuedouble
Returns
void

Definition at line 1148 of file n_arrays.c.

Referenced by N_compute_gradient_field_3d(), and N_compute_gradient_field_components_3d().

◆ N_put_array_3d_f_value()

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.

Parameters
dataN_array_3d *
colint
rowint
depthint
valuefloat
Returns
void

Definition at line 1121 of file n_arrays.c.

◆ N_put_array_3d_value()

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.

The value will be automatically cast to the array type.

Parameters
dataN_array_3d *
colint
rowint
depthint
valuechar *
Returns
void

Definition at line 1010 of file n_arrays.c.

◆ N_put_array_3d_value_null()

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.

The null value will be automatically set to the array type.

Parameters
dataN_array_3d *
colint
rowint
depthint
Returns
void

Definition at line 1060 of file n_arrays.c.

◆ N_read_rast3d_to_array_3d()

N_array_3d* N_read_rast3d_to_array_3d ( char *  name,
N_array_3d array,
int  mask 
)

Read a volume map into a N_array_3d structure.

The volume map is opened in the current region settings. If no N_array_3d structure is provided (NULL pointer), a new structure will be allocated with the same data type as the volume map and the size of the current region. The array offset will be set to 0.

If a N_array_3d structure is provided, the values from the volume map are casted to the N_array_3d type. The array must have the same size as the current region.

The new created or the provided array is returned. If the reading of the volume map fails, Rast3d_fatal_error() will be invoked.

Parameters
name* char - the name of an existing volume map
array* N_array_3d - an existing array or NULL
maskint - 0 = false, 1 = true : if a mask is presenent, use it with the input volume map
Returns
N_array_3d * - the existing or new allocated array

Definition at line 249 of file n_arrays_io.c.

References Cell_head::cols, Cell_head::depths, NULL, Cell_head::rows, and x.

◆ N_read_rast_to_array_2d()

N_array_2d* N_read_rast_to_array_2d ( char *  name,
N_array_2d array 
)

Read a raster map into a N_array_2d structure.

The raster map will be opened in the current region settings. If no N_array_2d structure is provided (NULL pointer), a new structure will be allocated with the same data type as the raster map and the size of the current region. The array offset will be set to 0.

If a N_array_2d structure is provided, the values from the raster map are casted to the N_array_2d type. The array must have the same size as the current region.

The new created or the provided array are returned. If the reading of the raster map fails, G_fatal_error() will be invoked.

Parameters
name* char - the name of an existing raster map
array* N_array_2d - an existing array or NULL
Returns
N_array_2d * - the existing or new allocated array

Definition at line 44 of file n_arrays_io.c.

References x.

◆ N_set_les_callback_2d_func()

void N_set_les_callback_2d_func ( N_les_callback_2d data,
N_data_star *(*)(void *, N_geom_data *, int, int)  callback_func_2d 
)

Set the callback function which is called while assembling the les in 2d.

Parameters
dataN_les_callback_2d *
callback_func_2dN_data_star *
Returns
void

Definition at line 360 of file n_les_assemble.c.

◆ N_set_les_callback_3d_func()

void N_set_les_callback_3d_func ( N_les_callback_3d data,
N_data_star *(*)(void *, N_geom_data *, int, int, int)  callback_func_3d 
)

Set the callback function which is called while assembling the les in 3d.

Parameters
dataN_les_callback_3d *
callback_func_3dN_data_star *
Returns
void

Definition at line 341 of file n_les_assemble.c.

◆ N_write_array_2d_to_rast()

void N_write_array_2d_to_rast ( N_array_2d array,
char *  name 
)

Write a N_array_2d struct to a raster map.

A new raster map is created with the same type as the N_array_2d. The current region is used to open the raster map. The N_array_2d must have the same size as the current region. If the writing of the raster map fails, G_fatal_error() will be invoked.

Parameters
arrayN_array_2d *
namechar * - the name of the raster map
Returns
void

Definition at line 171 of file n_arrays_io.c.

References Cell_head::cols, Cell_head::rows, and x.

◆ N_write_array_3d_to_rast3d()

void N_write_array_3d_to_rast3d ( N_array_3d array,
char *  name,
int  mask 
)

Write a N_array_3d struct to a volume map.

A new volume map is created with the same type as the N_array_3d. The current region is used to open the volume map. The N_array_3d must have the same size as the current region. If the writing of the volume map fails, Rast3d_fatal_error() will be invoked.

Parameters
arrayN_array_3d *
namechar * - the name of the volume map
maskint - 1 = use a 3d mask, 0 do not use a 3d mask
Returns
void

Definition at line 377 of file n_arrays_io.c.

References Cell_head::cols, Cell_head::depths, NULL, Cell_head::rows, and x.