GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
#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)(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_callback_template_3d (void *data UNUSED, N_geom_data *geom, int col UNUSED, int row UNUSED, int depth UNUSED) |
A callback template creates a 7 point star structure. More... | |
N_data_star * | N_callback_template_2d (void *data UNUSED, N_geom_data *geom, int col UNUSED, int row UNUSED) |
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 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_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_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 958 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 972 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 986 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 1023 of file n_les_assemble.c.
N_data_star* N_callback_template_2d | ( | void *data | UNUSED, |
N_geom_data * | geom, | ||
int col | UNUSED, | ||
int row | UNUSED | ||
) |
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 * (unused) |
geom | N_geom_data * |
row | int (unused) |
col | int (unused) |
Definition at line 465 of file n_les_assemble.c.
Referenced by N_alloc_les_callback_2d().
N_data_star* N_callback_template_3d | ( | void *data | UNUSED, |
N_geom_data * | geom, | ||
int col | UNUSED, | ||
int row | UNUSED, | ||
int depth | UNUSED | ||
) |
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 * (unused) |
geom | N_geom_data * |
depth | int (unused) |
row | int (unused) |
col | int (unused) |
Definition at line 427 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 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.
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_free(), 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 1252 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.
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.