GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
#include <math.h>
#include <grass/N_pde.h>
Go to the source code of this file.
Functions | |
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... | |
void | N_set_les_callback_3d_func (N_les_callback_3d *data, N_data_star *(*callback_func_3d)()) |
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)()) |
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_callback_template_3d (void *data, N_geom_data *geom, int col, int row, int depth) |
A callback template creates a 7 point star structure. More... | |
N_data_star * | N_callback_template_2d (void *data, N_geom_data *geom, int col, int row) |
A callback template creates a 9 point star structure. 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 *call) |
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 *call) |
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 *call) |
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 *call, int cell_type) |
Assemble a linear equation system (les) based on 2d location data (raster) More... | |
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... | |
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. 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 *call) |
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 *call) |
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 *call, int cell_type) |
Assemble a linear equation system (les) based on 3d location data (g3d) 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... | |
N_data_star* N_alloc_27star | ( | void | ) |
allocate a 27 point star data structure
Definition at line 103 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 46 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 63 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 83 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_callback_template_2d(), and N_create_9star().
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 397 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 376 of file n_les_assemble.c.
References N_les_callback_3d::callback, G_calloc, and N_callback_template_3d().
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 493 of file n_les_assemble.c.
References N_assemble_les_2d_param(), and N_CELL_ACTIVE.
N_les* N_assemble_les_2d_active | ( | int | les_type, |
N_geom_data * | geom, | ||
N_array_2d * | status, | ||
N_array_2d * | start_val, | ||
void * | data, | ||
N_les_callback_2d * | call | ||
) |
Assemble a linear equation system (les) based on 2d location data (raster) and active cells.
This function calls N_assemble_les_2d_param
Definition at line 507 of file n_les_assemble.c.
References N_assemble_les_2d_param(), and N_CELL_ACTIVE.
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 521 of file n_les_assemble.c.
References N_assemble_les_2d_param(), and N_CELL_DIRICHLET.
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 strcuture.
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 560 of file n_les_assemble.c.
References N_les::A, N_les::b, N_data_star::C, N_les_callback_2d::callback, CELL_TYPE, N_geom_data::cols, count, N_data_star::count, G_calloc, G_debug(), G_fatal_error(), G_math_alloc_spvector(), G_math_spvector::index, N_alloc_array_2d(), N_alloc_les_Ax_b(), N_CELL_ACTIVE, N_CELL_DIRICHLET, N_CELL_INACTIVE, N_get_array_2d_c_value(), N_get_array_2d_d_value(), N_MAX_CELL_STATE, N_put_array_2d_c_value(), N_SPARSE_LES, NULL, N_geom_data::rows, N_data_star::V, G_math_spvector::values, and N_les::x.
Referenced by N_assemble_les_2d(), N_assemble_les_2d_active(), and N_assemble_les_2d_dirichlet().
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 949 of file n_les_assemble.c.
References N_assemble_les_3d_param(), and N_CELL_ACTIVE.
N_les* N_assemble_les_3d_active | ( | int | les_type, |
N_geom_data * | geom, | ||
N_array_3d * | status, | ||
N_array_3d * | start_val, | ||
void * | data, | ||
N_les_callback_3d * | call | ||
) |
Assemble a linear equation system (les) based on 3d location data (g3d) active cells.
This function calls N_assemble_les_3d_param
Definition at line 962 of file n_les_assemble.c.
References N_assemble_les_3d_param(), and N_CELL_ACTIVE.
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 975 of file n_les_assemble.c.
References N_assemble_les_3d_param(), and N_CELL_DIRICHLET.
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 1012 of file n_les_assemble.c.
References N_les::A, N_les::b, N_data_star::C, N_les_callback_3d::callback, N_geom_data::cols, count, N_data_star::count, DCELL_TYPE, N_geom_data::depths, G_calloc, G_debug(), G_fatal_error(), G_math_alloc_spvector(), G_math_spvector::index, N_alloc_array_3d(), N_alloc_les_Ax_b(), N_CELL_ACTIVE, N_CELL_DIRICHLET, N_CELL_INACTIVE, N_get_array_3d_d_value(), N_MAX_CELL_STATE, N_put_array_3d_d_value(), N_SPARSE_LES, NULL, N_geom_data::rows, N_data_star::V, G_math_spvector::values, and N_les::x.
Referenced by N_assemble_les_3d(), N_assemble_les_3d_active(), and N_assemble_les_3d_dirichlet().
N_data_star* N_callback_template_2d | ( | void * | data, |
N_geom_data * | geom, | ||
int | col, | ||
int | row | ||
) |
A callback template creates a 9 point star structure.
This is a template callback for mass balance calculation with 9 point stars based on 2d data (raster).
data | void * |
geom | N_geom_data * |
row | int |
col | int |
Definition at line 463 of file n_les_assemble.c.
References N_data_star::C, N_geom_data::dx, N_geom_data::dy, N_data_star::E, N_data_star::N, N_alloc_9star(), N_data_star::NE, N_data_star::NW, N_data_star::S, N_data_star::SE, N_data_star::SW, N_data_star::V, and N_data_star::W.
Referenced by N_alloc_les_callback_2d().
N_data_star* N_callback_template_3d | ( | void * | data, |
N_geom_data * | geom, | ||
int | col, | ||
int | row, | ||
int | depth | ||
) |
A callback template creates a 7 point star structure.
This is a template callback for mass balance calculation with 7 point stars based on 3d data (g3d).
data | void * |
geom | N_geom_data * |
depth | int |
row | int |
col | int |
Definition at line 424 of file n_les_assemble.c.
Referenced by N_alloc_les_callback_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 265 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, NE, N_data_star::NE, N_data_star::NE_B, N_data_star::NE_T, NW, N_data_star::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, SE, N_data_star::SE, N_data_star::SE_B, N_data_star::SE_T, SW, N_data_star::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 126 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 161 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 202 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(), NE, N_data_star::NE, NW, N_data_star::NW, N_data_star::S, SE, N_data_star::SE, SW, N_data_star::SW, N_data_star::V, W, and N_data_star::W.
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 786 of file n_les_assemble.c.
References N_les::A, N_les::Asp, N_les::b, G_math_spvector::cols, N_les::cols, N_geom_data::cols, Cell_head::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, Cell_head::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 1239 of file n_les_assemble.c.
References N_les::A, N_les::Asp, N_les::b, G_math_spvector::cols, N_les::cols, N_geom_data::cols, Cell_head::cols, count, N_geom_data::depths, Cell_head::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, Cell_head::rows, N_les::type, G_math_spvector::values, and x.
void N_set_les_callback_2d_func | ( | N_les_callback_2d * | data, |
N_data_star *(*)() | 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 359 of file n_les_assemble.c.
References N_les_callback_2d::callback.
void N_set_les_callback_3d_func | ( | N_les_callback_3d * | data, |
N_data_star *(*)() | 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 342 of file n_les_assemble.c.