GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
#include <grass/gis.h>
#include <grass/raster3d.h>
#include <grass/glocale.h>
#include <grass/gmath.h>
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_les * | N_alloc_les_param (int cols, int rows, int type, int param) |
Allocate memory for a quadratic or not quadratic linear equation system. More... | |
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. More... | |
N_les * | N_alloc_les_A (int rows, int type) |
Allocate memory for a quadratic linear equation system which includes the Matrix A. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. 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_data * | N_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_data * | N_init_geom_data_3d (RASTER3D_Region *region3d, N_geom_data *geodata) |
Initiate a pde geometry data structure with a 3d region. More... | |
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. 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_2d * | N_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_2d * | N_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_2d * | N_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_3d * | N_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_3d * | N_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_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. 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_3d * | N_alloc_les_callback_3d (void) |
Allocate the structure holding the callback function. More... | |
N_les_callback_2d * | N_alloc_les_callback_2d (void) |
Allocate the structure holding the callback function. More... | |
N_data_star * | N_alloc_5star (void) |
allocate a 5 point star data structure More... | |
N_data_star * | N_alloc_7star (void) |
allocate a 7 point star data structure More... | |
N_data_star * | N_alloc_9star (void) |
allocate a 9 point star data structure More... | |
N_data_star * | N_alloc_27star (void) |
allocate a 27 point star data structure More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
N_data_star * | N_callback_template_3d (void *data, N_geom_data *geom, int col, int row, int depth) |
N_data_star * | N_callback_template_2d (void *data, N_geom_data *geom, int col, int row) |
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 *callback) |
Assemble a linear equation system (les) based on 3d location data (g3d) active cells. More... | |
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 *callback) |
Assemble a linear equation system (les) based on 3d location data (g3d) active cells. More... | |
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 *callback) |
Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells. More... | |
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 *callback, int cell_type) |
Assemble a linear equation system (les) based on 3d location data (g3d) More... | |
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 *callback) |
Assemble a linear equation system (les) based on 2d location data (raster) and active cells. More... | |
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 *callback) |
Assemble a linear equation system (les) based on 2d location data (raster) and active cells. More... | |
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 *callback) |
Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet cells. More... | |
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 *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 Option * | N_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_2d * | N_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_2d * | N_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_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]. More... | |
N_gradient_3d * | N_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_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 More... | |
int | N_copy_gradient_3d (N_gradient_3d *source, N_gradient_3d *target) |
copy a N_gradient_3d structure More... | |
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]. More... | |
N_gradient_neighbours_x * | N_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_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. 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_y * | N_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_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. 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_z * | N_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_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. 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_2d * | N_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_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. 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_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]. More... | |
N_gradient_neighbours_3d * | N_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_3d * | N_create_gradient_neighbours_3d (N_gradient_neighbours_x *xt, N_gradient_neighbours_x *xc, N_gradient_neighbours_x *xb, N_gradient_neighbours_y *yt, N_gradient_neighbours_y *yc, N_gradient_neighbours_y *yb, N_gradient_neighbours_z *zt, N_gradient_neighbours_z *zb) |
Allocate and initialize a N_gradient_neighbours_3d structure. 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_2d * | N_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_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. 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_3d * | N_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_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. 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... | |
#define N_ARRAY_DIF 1 /* calc the difference between two arrays */ |
#define N_ARRAY_DIV |
#define N_MAX_CELL_STATE 20 |
#define N_UPWIND_EXP 1 /*exponential upwinding stabilization */ |
#define N_UPWIND_WEIGHT 2 /*weighted upwinding stabilization */ |
enum N_STD_OPT |
Standard options of the gpde library.
N_data_star* N_alloc_27star | ( | void | ) |
allocate a 27 point star data structure
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_data_star* N_alloc_5star | ( | void | ) |
allocate a 5 point star data structure
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_data_star* N_alloc_7star | ( | void | ) |
allocate a 7 point star data structure
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_data_star* N_alloc_9star | ( | void | ) |
allocate a 9 point star data structure
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_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
cols | int |
rows | int |
offset | int |
type | int |
Definition at line 75 of file n_arrays.c.
Referenced by N_alloc_gradient_field_2d().
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.
cols | int |
rows | int |
depths | int |
offset | int |
type | int |
Definition at line 719 of file n_arrays.c.
Referenced by N_alloc_gradient_field_3d().
N_geom_data* N_alloc_geom_data | ( | void | ) |
Allocate the pde geometry data structure and return a pointer to the new allocated structure.
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_gradient_2d* N_alloc_gradient_2d | ( | void | ) |
Allocate a N_gradient_2d structure.
Definition at line 26 of file n_gradient.c.
References G_calloc.
Referenced by N_create_gradient_2d().
N_gradient_3d* N_alloc_gradient_3d | ( | void | ) |
Allocate a N_gradient_3d structure.
Definition at line 149 of file n_gradient.c.
References G_calloc.
Referenced by N_create_gradient_3d().
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.
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 |
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_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.
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 |
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_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
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_gradient_neighbours_3d* N_alloc_gradient_neighbours_3d | ( | void | ) |
Allocate a N_gradient_neighbours_3d structure.
This structure contains all neighbour gradients in all directions of one cell in a 3d raster layer
Definition at line 752 of file n_gradient.c.
References G_calloc, N_alloc_gradient_neighbours_x(), N_alloc_gradient_neighbours_y(), N_alloc_gradient_neighbours_z(), N_gradient_neighbours_3d::xb, N_gradient_neighbours_3d::xc, N_gradient_neighbours_3d::xt, N_gradient_neighbours_3d::yb, N_gradient_neighbours_3d::yc, N_gradient_neighbours_3d::yt, N_gradient_neighbours_3d::zb, and N_gradient_neighbours_3d::zt.
Referenced by N_create_gradient_neighbours_3d().
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
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_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
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_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
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_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
rows | int |
type | int |
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
rows | int |
type | int |
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
rows | int |
type | int |
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
rows | int |
type | int |
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.
Definition at line 400 of file n_les_assemble.c.
References N_les_callback_2d::callback, G_calloc, and N_callback_template_2d().
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.
Definition at line 379 of file n_les_assemble.c.
References N_les_callback_3d::callback, G_calloc, and N_callback_template_3d().
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.
cols | int |
rows | int |
type | int |
parts | int – 2 = A, x and b; 1 = A and x; 0 = A allocated |
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
cols | int |
rows | int |
type | int |
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
cols | int |
rows | int |
type | int |
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
cols | int |
rows | int |
type | int |
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
cols | int |
rows | int |
type | int |
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_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_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_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.
les_type | int |
geom | N_geom_data* |
status | N_array_2d * |
start_val | N_array_2d * |
data | void * |
cell_type | int – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET |
call | N_les_callback_2d * |
Definition at line 563 of file n_les_assemble.c.
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_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_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_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.
les_type | int |
geom | N_geom_data* |
status | N_array_3d * |
start_val | N_array_3d * |
data | void * |
call | N_les_callback_3d * |
cell_type | int – les assemble based on N_CELL_ACTIVE or N_CELL_DIRICHLET |
Definition at line 1021 of file n_les_assemble.c.
double N_calc_arith_mean | ( | double | a, |
double | b | ||
) |
double N_calc_arith_mean_n | ( | double * | a, |
int | size | ||
) |
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.
a | N_array_2d * - input array |
min | double* - variable to store the computed minimum |
max | double* - variable to store the computed maximum |
sum | double* - variable to store the computed sum |
nonull | int* - variable to store the number of non null values |
withoffset | - if 1 include offset values in statistic calculation, 0 otherwise |
Definition at line 213 of file n_arrays_calc.c.
Referenced by N_calc_gradient_field_2d_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.
a | N_array_3d * - input array |
min | double* - variable to store the computed minimum |
max | double* - variable to store the computed maximum |
sum | double* - variable to store the computed sum |
nonull | int* - variable to store the number of non null values |
withoffset | - if 1 include offset values in statistic calculation, 0 otherwise |
Definition at line 627 of file n_arrays_calc.c.
Referenced by N_calc_gradient_field_3d_stats().
double N_calc_geom_mean | ( | double | a, |
double | b | ||
) |
double N_calc_geom_mean_n | ( | double * | a, |
int | size | ||
) |
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
field | N_gradient_2d_field * |
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().
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
field | N_gradient_3d_field * |
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().
double N_calc_harmonic_mean | ( | double | a, |
double | b | ||
) |
Calculate the harmonical mean of values a and b.
mean = 2*(a*b)/(a + b)
a | double |
b | double |
Definition at line 115 of file n_tools.c.
Referenced by N_compute_gradient_field_2d(), and N_compute_gradient_field_3d().
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]))
a | double * – the value vector |
size | int – the size of the vector a |
double N_calc_quad_mean | ( | double | a, |
double | b | ||
) |
double N_calc_quad_mean_n | ( | double * | a, |
int | size | ||
) |
N_data_star* N_callback_template_2d | ( | void * | data, |
N_geom_data * | geom, | ||
int | col, | ||
int | row | ||
) |
N_data_star* N_callback_template_3d | ( | void * | data, |
N_geom_data * | geom, | ||
int | col, | ||
int | row, | ||
int | depth | ||
) |
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
pot | N_array_2d * - the potential N_array_2d |
weight_x | N_array_2d * - the weighting factor N_array_2d used to modify the gradient in x-direction |
weight_y | N_array_2d * - the weighting factor N_array_2d used to modify the gradient in y-direction |
geom | N_geom_data * - geometry data structure |
gradfield | N_gradient_field_2d * - a gradient field of the correct size, if a NULL pointer is provided this gradient field will be new allocated |
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_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
pot | N_array_3d * - the potential N_array_2d |
weight_x | N_array_3d * - the weighting factor N_array_3d used to modify the gradient in x-direction |
weight_y | N_array_3d * - the weighting factor N_array_3d used to modify the gradient in y-direction |
weight_z | N_array_3d * - the weighting factor N_array_3d used to modify the gradient in z-direction |
geom | N_geom_data * - geometry data structure |
gradfield | N_gradient_field_3d * - a gradient field of the correct size, if a NULL pointer is provided this gradient field will be new allocated |
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.
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
field | N_gradient_field_2d * |
x_comp | N_array_2d * - the array in which the x component will be written |
y_comp | N_array_2d * - the array in which the y component will be written |
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.
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
field | N_gradient_field_3d * |
x_comp | N_array_3d * - the array in which the x component will be written |
y_comp | N_array_3d * - the array in which the y component will be written |
z_comp | N_array_3d * - the array in which the z component will be written |
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.
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.
a | N_array_2d * |
Definition at line 418 of file n_arrays_calc.c.
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.
a | N_array_3d * |
Definition at line 832 of file n_arrays_calc.c.
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.
source | N_array_2d * |
target | N_array_2d * |
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().
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
source | N_array_3d * |
target | N_array_3d * |
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().
int N_copy_gradient_2d | ( | N_gradient_2d * | source, |
N_gradient_2d * | target | ||
) |
copy a N_gradient_2d structure
source | - the source N_gradient_2d struct |
target | - the target N_gradient_2d struct |
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.
int N_copy_gradient_3d | ( | N_gradient_3d * | source, |
N_gradient_3d * | target | ||
) |
copy a N_gradient_3d structure
source | - the source N_gradient_3d struct |
target | - the target N_gradient_3d struct |
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.
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.
source | - the source N_gradient_field_2d struct |
target | - the target N_gradient_field_2d struct |
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.
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.
source | - the source N_gradient_field_3d struct |
target | - the target N_gradient_field_3d struct |
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.
int N_copy_gradient_neighbours_2d | ( | N_gradient_neighbours_2d * | source, |
N_gradient_neighbours_2d * | target | ||
) |
copy a N_gradient_neighbours_2d structure
source | - the source N_gradient_neighbours_2d struct |
target | - the target N_gradient_neighbours_2d struct |
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().
int N_copy_gradient_neighbours_3d | ( | N_gradient_neighbours_3d * | source, |
N_gradient_neighbours_3d * | target | ||
) |
copy a N_gradient_neighbours_3d structure
source | - the source N_gradient_neighbours_3d struct |
target | - the target N_gradient_neighbours_3d struct |
Definition at line 852 of file n_gradient.c.
References G_debug(), N_copy_gradient_neighbours_x(), N_copy_gradient_neighbours_y(), N_copy_gradient_neighbours_z(), N_gradient_neighbours_3d::xb, N_gradient_neighbours_3d::xc, N_gradient_neighbours_3d::xt, N_gradient_neighbours_3d::yb, N_gradient_neighbours_3d::yc, N_gradient_neighbours_3d::yt, N_gradient_neighbours_3d::zb, and N_gradient_neighbours_3d::zt.
int N_copy_gradient_neighbours_x | ( | N_gradient_neighbours_x * | source, |
N_gradient_neighbours_x * | target | ||
) |
copy a N_gradient_neighbours_x structure
source | - the source N_gradient_neighbours_x struct |
target | - the target N_gradient_neighbours_x struct |
Definition at line 355 of file n_gradient.c.
References N_gradient_neighbours_x::EC, G_debug(), 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_copy_gradient_neighbours_2d(), N_copy_gradient_neighbours_3d(), N_create_gradient_neighbours_2d(), and N_create_gradient_neighbours_3d().
int N_copy_gradient_neighbours_y | ( | N_gradient_neighbours_y * | source, |
N_gradient_neighbours_y * | target | ||
) |
copy a N_gradient_neighbours_y structure
source | - the source N_gradient_neighbours_y struct |
target | - the target N_gradient_neighbours_y struct |
Definition at line 447 of file n_gradient.c.
References G_debug(), 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_copy_gradient_neighbours_2d(), N_copy_gradient_neighbours_3d(), N_create_gradient_neighbours_2d(), and N_create_gradient_neighbours_3d().
int N_copy_gradient_neighbours_z | ( | N_gradient_neighbours_z * | source, |
N_gradient_neighbours_z * | target | ||
) |
copy a N_gradient_neighbours_z structure
source | - the source N_gradient_neighbours_z struct |
target | - the target N_gradient_neighbours_z struct |
Definition at line 547 of file n_gradient.c.
References N_gradient_neighbours_z::CZ, N_gradient_neighbours_z::EZ, G_debug(), 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.
Referenced by N_copy_gradient_neighbours_3d(), and N_create_gradient_neighbours_3d().
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
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 | double |
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_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
C | double |
W | double |
E | double |
N | double |
S | double |
V | double |
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_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
C | double |
W | double |
E | double |
N | double |
S | double |
T | double |
B | double |
V | double |
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_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
C | double |
W | double |
E | double |
N | double |
S | double |
NW | double |
SW | double |
NE | double |
SE | double |
V | double |
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_gradient_2d* N_create_gradient_2d | ( | double | NC, |
double | SC, | ||
double | WC, | ||
double | EC | ||
) |
allocate and initialize a N_gradient_2d structure
NC | double - the gradient between northern and center cell |
SC | double - the gradient between southern and center cell |
WC | double - the gradient between western and center cell |
EC | double - the gradient between eastern and center cell |
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_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
NC | double - the gradient between northern and center cell |
SC | double - the gradient between southern and center cell |
WC | double - the gradient between western and center cell |
EC | double - the gradient between eastern and center cell |
TC | double - the gradient between top and center cell |
BC | double - the gradient between bottom and center cell |
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_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
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_gradient_neighbours_3d* N_create_gradient_neighbours_3d | ( | N_gradient_neighbours_x * | xt, |
N_gradient_neighbours_x * | xc, | ||
N_gradient_neighbours_x * | xb, | ||
N_gradient_neighbours_y * | yt, | ||
N_gradient_neighbours_y * | yc, | ||
N_gradient_neighbours_y * | yb, | ||
N_gradient_neighbours_z * | zt, | ||
N_gradient_neighbours_z * | zb | ||
) |
Allocate and initialize a N_gradient_neighbours_3d structure.
The parameter N_gradient_neighbours x(tcb) and y(tcb) and z(tb) are copied into the new allocated structure and can be deleted after the initializing
Definition at line 806 of file n_gradient.c.
References G_debug(), N_alloc_gradient_neighbours_3d(), N_copy_gradient_neighbours_x(), N_copy_gradient_neighbours_y(), N_copy_gradient_neighbours_z(), NULL, N_gradient_neighbours_3d::xb, N_gradient_neighbours_3d::xc, N_gradient_neighbours_3d::xt, N_gradient_neighbours_3d::yb, N_gradient_neighbours_3d::yc, N_gradient_neighbours_3d::yt, N_gradient_neighbours_3d::zb, and N_gradient_neighbours_3d::zt.
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.
NWN | double - the gradient between north-west and northern cell |
NEN | double - the gradient between north-east and northern cell |
WC | double - the gradient between western and center cell |
EC | double - the gradient between eastern and center cell |
SWS | double - the gradient between south-west and southern cell |
SES | double - the gradient between south-east and southern cell |
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_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.
NWW | double - the gradient between north-west and western cell |
NEE | double - the gradient between north-east and eastern cell |
NC | double - the gradient between northern and center cell |
SC | double - the gradient between southern and center cell |
SWW | double - the gradient between south-west and western cell |
SEE | double - the gradient between south-east and eastern cell |
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_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.
NWZ | double - the gradient between upper and lower north-western cells |
NZ | double - the gradient between upper and lower northern cells |
NEZ | double - the gradient between upper and lower north-eastern cells |
WZ | double - the gradient between upper and lower western cells |
CZ | double - the gradient between upper and lower center cells |
EZ | double - the gradient between upper and lower eastern cells |
SWZ | double - the gradient between upper and lower south-western cells |
SZ | double - the gradient between upper and lower southern cells |
SEZ | double - the gradient between upper and lower south-eastern cells |
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.
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 ();
[in] | opt | Type of Option struct to create |
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.
double N_exp_upwinding | ( | double | sprod, |
double | distance, | ||
double | D | ||
) |
exponential upwinding stabilization algorithm
The arguments are values to compute the local peclet number
sprod | double – the scalar product between the velocity vector and the normal vector between two points |
distance | double – distance between two points |
D | double – diffusion/dispersion tensor part between two points |
Definition at line 63 of file n_upwind.c.
References D.
void N_free_array_2d | ( | N_array_2d * | data | ) |
Release the memory of a N_array_2d structure.
data | N_array_2d * |
Definition at line 132 of file n_arrays.c.
Referenced by N_free_gradient_field_2d().
void N_free_array_3d | ( | N_array_3d * | data | ) |
Release the memory of a N_array_3d.
data | N_array_3d * |
Definition at line 774 of file n_arrays.c.
Referenced by N_free_gradient_field_3d().
void N_free_geom_data | ( | N_geom_data * | geom | ) |
Release memory of a pde geometry data structure.
geom | N_geom_data * |
Definition at line 49 of file n_geom.c.
References N_geom_data::area, G_free(), and NULL.
void N_free_gradient_2d | ( | N_gradient_2d * | grad | ) |
void N_free_gradient_3d | ( | N_gradient_3d * | grad | ) |
void N_free_gradient_field_2d | ( | N_gradient_field_2d * | field | ) |
Free's a N_gradient_neighbours_2d structure.
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.
void N_free_gradient_field_3d | ( | N_gradient_field_3d * | field | ) |
Free's a N_gradient_neighbours_3d structure.
Definition at line 1019 of file n_gradient.c.
References G_free(), N_free_array_3d(), NULL, N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.
void N_free_gradient_neighbours_2d | ( | N_gradient_neighbours_2d * | grad | ) |
Free's a N_gradient_neighbours_2d structure.
Definition at line 596 of file n_gradient.c.
References G_free(), N_free_gradient_neighbours_x(), N_free_gradient_neighbours_y(), NULL, N_gradient_neighbours_2d::x, and N_gradient_neighbours_2d::y.
Referenced by N_create_gradient_neighbours_2d(), and N_get_gradient_neighbours_2d().
void N_free_gradient_neighbours_3d | ( | N_gradient_neighbours_3d * | grad | ) |
Free's a N_gradient_neighbours_3d structure.
Definition at line 777 of file n_gradient.c.
References G_free(), N_free_gradient_neighbours_x(), N_free_gradient_neighbours_y(), N_free_gradient_neighbours_z(), NULL, N_gradient_neighbours_3d::xb, N_gradient_neighbours_3d::xc, N_gradient_neighbours_3d::xt, N_gradient_neighbours_3d::yb, N_gradient_neighbours_3d::yc, N_gradient_neighbours_3d::yt, N_gradient_neighbours_3d::zb, and N_gradient_neighbours_3d::zt.
void N_free_gradient_neighbours_x | ( | N_gradient_neighbours_x * | grad | ) |
Free's a N_gradient_neighbours_x structure.
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().
void N_free_gradient_neighbours_y | ( | N_gradient_neighbours_y * | grad | ) |
Free's a N_gradient_neighbours_y structure.
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().
void N_free_gradient_neighbours_z | ( | N_gradient_neighbours_z * | grad | ) |
Free's a N_gradient_neighbours_z structure.
Definition at line 489 of file n_gradient.c.
References G_free(), and NULL.
Referenced by N_free_gradient_neighbours_3d().
void N_free_les | ( | N_les * | les | ) |
Release the memory of the linear equation system.
les | N_les * |
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.
double N_full_upwinding | ( | double | sprod, |
double | distance, | ||
double | D | ||
) |
full upwinding stabilization algorithm
The arguments are values to compute the local peclet number
sprod | double – the scalar product between the velocity vector and the normal vector between two points |
distance | double – distance between two points |
D | double – diffusion/dispersion tensor part between two points |
Definition at line 32 of file n_upwind.c.
References D.
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.
data | N_array_2d * |
col | int |
row | int |
Definition at line 314 of file n_arrays.c.
Referenced by N_les_integrate_dirichlet_2d().
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.
data | N_array_2d * |
col | int |
row | int |
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().
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.
data | N_array_2d * |
col | int |
row | int |
Definition at line 347 of file n_arrays.c.
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.
array | N_array_2d * |
Definition at line 164 of file n_arrays.c.
References N_array_2d::type.
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.
data | N_array_2d * |
col | int |
row | int |
value | void * - this variable contains the array value at col, row position |
Definition at line 182 of file n_arrays.c.
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
Definition at line 979 of file n_arrays.c.
Referenced by N_compute_gradient_field_3d(), and N_les_integrate_dirichlet_3d().
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
Definition at line 948 of file n_arrays.c.
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.
array | N_array_3d * |
Definition at line 803 of file n_arrays.c.
References N_array_3d::type.
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
value | void * |
Definition at line 822 of file n_arrays.c.
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
geom | N_geom_data * |
row | int |
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_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.
field | N_gradient_field_2d * - A two dimensional gradient field |
gradient | N_gradient_2d * - the gradient structure which should be filled with data, if a NULL pointer is given, a new structure will be created |
col | int |
row | int |
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_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.
field | N_gradient_field_3d * - A three dimensional gradient field |
gradient | N_gradient_3d * - an existing gradient structure or a NULL pointer, if a NULL pointer is providet a new structure will be returned |
col | int |
row | int |
depth | int |
Definition at line 246 of file n_gradient.c.
Referenced by N_compute_gradient_field_components_3d().
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.
field | N_gradient_field_2d * - A two dimensional gradient field |
gradient | N_gradient_neighbours_2d * - the gradient structure which should be filled with data, if a NULL pointer is given, a new structure will be created |
col | int |
row | int |
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_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
region | sruct Cell_head * |
geodata | N_geom_data * - if a NULL pointer is given, a new structure will be allocatet and returned |
Definition at line 117 of file n_geom.c.
Referenced by 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
region3d | RASTER3D_Region * |
geodata | N_geom_data * - if a NULL pointer is given, a new structure will be allocatet and returned |
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.
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.
data | N_array_2d * |
col | int |
row | int |
Definition at line 231 of file n_arrays.c.
Referenced by N_compute_gradient_field_2d().
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
Definition at line 873 of file n_arrays.c.
Referenced by N_compute_gradient_field_3d().
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
les | N_les* – the linear equation system |
geom | N_geom_data* – geometrical data information |
status | N_array_2d* – the status array containing the cell types |
start_val | N_array_2d* – an array with start values |
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.
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
les | N_les* – the linear equation system |
geom | N_geom_data* – geometrical data information |
status | N_array_2d* – the status array containing the cell types |
start_val | N_array_2d* – an array with start values |
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.
int N_les_pivot_create | ( | N_les * | les | ) |
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:
a | N_array_2d * - first input array |
b | N_array_2d * - second input array |
result | N_array_2d * - the optional result array |
type | - the type of calculation |
Definition at line 299 of file n_arrays_calc.c.
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:
a | N_array_3d * - first input array |
b | N_array_3d * - second input array |
result | N_array_3d * - the optional result array |
type | - the type of calculation |
Definition at line 723 of file n_arrays_calc.c.
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.
a | N_array_2d * |
b | N_array_2d * |
type | the type of the norm -> N_MAXIMUM_NORM, N_EUKLID_NORM |
Definition at line 142 of file n_arrays_calc.c.
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.
a | N_array_3d * |
b | N_array_3d * |
type | the type of the norm -> N_MAXIMUM_NORM, N_EUKLID_NORM |
Definition at line 556 of file n_arrays_calc.c.
void N_print_array_2d | ( | N_array_2d * | data | ) |
Write info and content of the N_array_2d struct to stdout.
Offsets are ignored
data | N_array_2d * |
Definition at line 628 of file n_arrays.c.
void N_print_array_2d_info | ( | N_array_2d * | data | ) |
This function writes the data info of the array data to stdout.
data | N_array_2d * |
Definition at line 603 of file n_arrays.c.
Referenced by N_print_gradient_field_2d_info().
void N_print_array_3d | ( | N_array_3d * | data | ) |
Write info and content of the array data to stdout.
Offsets are ignored
data | N_array_2d * |
Definition at line 1196 of file n_arrays.c.
void N_print_array_3d_info | ( | N_array_3d * | data | ) |
Write the info of the array to stdout.
data | N_array_3d * |
Definition at line 1170 of file n_arrays.c.
Referenced by N_print_gradient_field_3d_info().
void N_print_gradient_field_2d_info | ( | N_gradient_field_2d * | field | ) |
Print gradient field information to stdout.
field | N_gradient_2d_field * |
Definition at line 961 of file n_gradient.c.
References N_gradient_field_2d::cols, N_gradient_field_2d::max, N_gradient_field_2d::mean, N_gradient_field_2d::min, N_print_array_2d_info(), N_gradient_field_2d::nonull, N_gradient_field_2d::rows, N_gradient_field_2d::sum, N_gradient_field_2d::x_array, and N_gradient_field_2d::y_array.
void N_print_gradient_field_3d_info | ( | N_gradient_field_3d * | field | ) |
Print gradient field information to stdout.
field | N_gradient_3d_field * |
Definition at line 1062 of file n_gradient.c.
References N_gradient_field_3d::cols, N_gradient_field_3d::depths, N_gradient_field_3d::max, N_gradient_field_3d::mean, N_gradient_field_3d::min, N_print_array_3d_info(), N_gradient_field_3d::nonull, N_gradient_field_3d::rows, N_gradient_field_3d::sum, N_gradient_field_3d::x_array, N_gradient_field_3d::y_array, and N_gradient_field_3d::z_array.
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
les | N_les * |
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.
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.
data | N_array_2d * |
col | int |
row | int |
value | CELL |
Definition at line 516 of file n_arrays.c.
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.
data | N_array_2d * |
col | int |
row | int |
value | DCELL |
Definition at line 576 of file n_arrays.c.
Referenced by N_compute_gradient_field_2d(), and N_compute_gradient_field_components_2d().
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.
data | N_array_2d * |
col | int |
row | int |
value | FCELL |
Definition at line 546 of file n_arrays.c.
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.
data | N_array_2d * |
col | int |
row | int |
value | char * |
Definition at line 412 of file n_arrays.c.
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).
data | N_array_2d * |
col | int |
row | int |
Definition at line 459 of file n_arrays.c.
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
value | double |
Definition at line 1148 of file n_arrays.c.
Referenced by N_compute_gradient_field_3d(), and N_compute_gradient_field_components_3d().
void N_put_array_3d_f_value | ( | N_array_3d * | data, |
int | col, | ||
int | row, | ||
int | depth, | ||
float | value | ||
) |
This function writes a float value to the N_array_3d data at position col, row, depth.
data | N_array_3d * |
col | int |
row | int |
depth | int |
value | float |
Definition at line 1121 of file n_arrays.c.
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
value | char * |
Definition at line 1010 of file n_arrays.c.
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.
data | N_array_3d * |
col | int |
row | int |
depth | int |
Definition at line 1060 of file n_arrays.c.
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.
name | * char - the name of an existing volume map |
array | * N_array_3d - an existing array or NULL |
mask | int - 0 = false, 1 = true : if a mask is presenent, use it with the input volume map |
Definition at line 249 of file n_arrays_io.c.
References Cell_head::cols, Cell_head::depths, NULL, Cell_head::rows, and x.
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.
name | * char - the name of an existing raster map |
array | * N_array_2d - an existing array or NULL |
Definition at line 44 of file n_arrays_io.c.
References x.
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.
data | N_les_callback_2d * |
callback_func_2d | N_data_star * |
Definition at line 360 of file n_les_assemble.c.
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.
data | N_les_callback_3d * |
callback_func_3d | N_data_star * |
Definition at line 341 of file n_les_assemble.c.
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.
array | N_array_2d * |
name | char * - the name of the raster map |
Definition at line 171 of file n_arrays_io.c.
References Cell_head::cols, Cell_head::rows, and x.
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.
array | N_array_3d * |
name | char * - the name of the volume map |
mask | int - 1 = use a 3d mask, 0 do not use a 3d mask |
Definition at line 377 of file n_arrays_io.c.
References Cell_head::cols, Cell_head::depths, NULL, Cell_head::rows, and x.