Loading...
Searching...
No Matches
N_pde.h
Go to the documentation of this file.
/*****************************************************************************
*
* MODULE: Grass PDE Numerical Library
* AUTHOR(S): Soeren Gebbert, Berlin (GER) Dec 2006
* soerengebbert <at> gmx <dot> de
*
* PURPOSE: This file contains definitions of variables and data types
*
* COPYRIGHT: (C) 2000 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
*
*****************************************************************************/
#include <grass/gis.h>
#include <grass/raster3d.h>
#include <grass/glocale.h>
#include <grass/gmath.h>
#ifndef _N_PDE_H_
#define _N_PDE_H_
#define N_NORMAL_LES 0
#define N_SPARSE_LES 1
/*!
* Boundary conditions for cells
*/
#define N_CELL_INACTIVE 0
#define N_CELL_ACTIVE 1
#define N_CELL_DIRICHLET 2
#define N_CELL_TRANSMISSION 3
/*!
* \brief the maximum number of available cell states (eg: boundary condition,
* inactiven active)
* */
#define N_MAX_CELL_STATE 20
#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 \
3 /* array division, if div with 0 the NULL value is set \
*/
#define N_UPWIND_FULL 0 /*full upwinding stabilization */
#define N_UPWIND_EXP 1 /*exponential upwinding stabilization */
#define N_UPWIND_WEIGHT 2 /*weighted upwinding stabilization */
/* *************************************************************** */
/* *************** LINEARE EQUATION SYSTEM PART ****************** */
/* *************************************************************** */
/*!
* \brief The linear equation system (les) structure
*
* This structure manages the Ax = b system.
* It manages regular quadratic matrices or
* sparse matrices. The vector b and x are normal one dimensional
* memory structures of type double. Also the number of rows
* and the matrix type are stored in this structure.
* */
typedef struct {
double *x; /*the value vector */
double *b; /*the right side of Ax = b */
double **A; /*the normal quadratic matrix */
G_math_spvector **Asp; /*the sparse matrix */
int rows; /*number of rows */
int cols; /*number of cols */
int quad; /*is the matrix quadratic (1-quadratic, 0 not) */
int type; /*the type of the les, normal == 0, sparse == 1 */
} N_les;
extern N_les *N_alloc_les_param(int cols, int rows, int type, int param);
extern N_les *N_alloc_les(int rows, int type);
extern N_les *N_alloc_les_A(int rows, int type);
extern N_les *N_alloc_les_Ax(int rows, int type);
extern N_les *N_alloc_les_Ax_b(int rows, int type);
extern N_les *N_alloc_nquad_les(int cols, int rows, int type);
extern N_les *N_alloc_nquad_les_A(int cols, int rows, int type);
extern N_les *N_alloc_nquad_les_Ax(int cols, int rows, int type);
extern N_les *N_alloc_nquad_les_Ax_b(int cols, int rows, int type);
extern void N_print_les(N_les *les);
extern void N_free_les(N_les *les);
/* *************************************************************** */
/* *************** GEOMETRY INFORMATION ************************** */
/* *************************************************************** */
/*!
* \brief Geometric information about the structured grid
* */
typedef struct {
int planimetric; /*If the projection is not planimetric (0), the array
calculation is different for each row */
double *area; /* the vector of area values for non-planimetric projection
for each row */
int dim; /* 2 or 3 */
double dx;
double dy;
double dz;
double Az;
int depths;
int rows;
int cols;
} N_geom_data;
extern N_geom_data *N_alloc_geom_data(void);
extern void N_free_geom_data(N_geom_data *geodata);
extern N_geom_data *N_init_geom_data_3d(RASTER3D_Region *region3d,
N_geom_data *geodata);
extern N_geom_data *N_init_geom_data_2d(struct Cell_head *region,
N_geom_data *geodata);
extern double N_get_geom_data_area_of_cell(N_geom_data *geom, int row);
/* *************************************************************** */
/* *************** READING RASTER AND VOLUME DATA **************** */
/* *************************************************************** */
typedef struct {
int type; /* which raster type CELL_TYPE, FCELL_TYPE, DCELL_TYPE */
int rows, cols;
int rows_intern, cols_intern;
int offset; /*number of cols/rows offset at each boundary */
CELL *cell_array; /*The data is stored in an one dimensional array
internally */
FCELL *fcell_array; /*The data is stored in an one dimensional array
internally */
DCELL *dcell_array; /*The data is stored in an one dimensional array
internally */
} N_array_2d;
extern N_array_2d *N_alloc_array_2d(int cols, int rows, int offset, int type);
extern void N_free_array_2d(N_array_2d *data_array);
extern int N_get_array_2d_type(N_array_2d *array2d);
extern void N_get_array_2d_value(N_array_2d *array2d, int col, int row,
void *value);
extern CELL N_get_array_2d_c_value(N_array_2d *array2d, int col, int row);
extern FCELL N_get_array_2d_f_value(N_array_2d *array2d, int col, int row);
extern DCELL N_get_array_2d_d_value(N_array_2d *array2d, int col, int row);
extern void N_put_array_2d_value(N_array_2d *array2d, int col, int row,
char *value);
extern void N_put_array_2d_c_value(N_array_2d *array2d, int col, int row,
CELL value);
extern void N_put_array_2d_f_value(N_array_2d *array2d, int col, int row,
FCELL value);
extern void N_put_array_2d_d_value(N_array_2d *array2d, int col, int row,
DCELL value);
extern int N_is_array_2d_value_null(N_array_2d *array2d, int col, int row);
extern void N_put_array_2d_value_null(N_array_2d *array2d, int col, int row);
extern void N_print_array_2d(N_array_2d *data);
extern void N_print_array_2d_info(N_array_2d *data);
extern void N_copy_array_2d(N_array_2d *source, N_array_2d *target);
extern double N_norm_array_2d(N_array_2d *array1, N_array_2d *array2, int type);
extern N_array_2d *N_math_array_2d(N_array_2d *array1, N_array_2d *array2,
N_array_2d *result, int type);
extern int N_convert_array_2d_null_to_zero(N_array_2d *a);
extern N_array_2d *N_read_rast_to_array_2d(char *name, N_array_2d *array);
extern void N_write_array_2d_to_rast(N_array_2d *array, char *name);
extern void N_calc_array_2d_stats(N_array_2d *a, double *min, double *max,
double *sum, int *nonzero, int withoffset);
typedef struct {
int type; /* which raster type FCELL_TYPE, DCELL_TYPE */
int rows, cols, depths;
int rows_intern, cols_intern, depths_intern;
int offset; /*number of cols/rows/depths offset at each boundary */
float *fcell_array; /*The data is stored in an one dimensional array
internally */
double *dcell_array; /*The data is stored in an one dimensional array
internally */
} N_array_3d;
extern N_array_3d *N_alloc_array_3d(int cols, int rows, int depths, int offset,
int type);
extern void N_free_array_3d(N_array_3d *data_array);
extern int N_get_array_3d_type(N_array_3d *array3d);
extern void N_get_array_3d_value(N_array_3d *array3d, int col, int row,
int depth, void *value);
extern float N_get_array_3d_f_value(N_array_3d *array3d, int col, int row,
int depth);
extern double N_get_array_3d_d_value(N_array_3d *array3d, int col, int row,
int depth);
extern void N_put_array_3d_value(N_array_3d *array3d, int col, int row,
int depth, char *value);
extern void N_put_array_3d_f_value(N_array_3d *array3d, int col, int row,
int depth, float value);
extern void N_put_array_3d_d_value(N_array_3d *array3d, int col, int row,
int depth, double value);
extern int N_is_array_3d_value_null(N_array_3d *array3d, int col, int row,
int depth);
extern void N_put_array_3d_value_null(N_array_3d *array3d, int col, int row,
int depth);
extern void N_print_array_3d(N_array_3d *data);
extern void N_print_array_3d_info(N_array_3d *data);
extern void N_copy_array_3d(N_array_3d *source, N_array_3d *target);
extern double N_norm_array_3d(N_array_3d *array1, N_array_3d *array2, int type);
extern N_array_3d *N_math_array_3d(N_array_3d *array1, N_array_3d *array2,
N_array_3d *result, int type);
extern int N_convert_array_3d_null_to_zero(N_array_3d *a);
extern N_array_3d *N_read_rast3d_to_array_3d(char *name, N_array_3d *array,
int mask);
extern void N_write_array_3d_to_rast3d(N_array_3d *array, char *name, int mask);
extern void N_calc_array_3d_stats(N_array_3d *a, double *min, double *max,
double *sum, int *nonzero, int withoffset);
/* *************************************************************** */
/* *************** MATRIX ASSEMBLING METHODS ********************* */
/* *************************************************************** */
/*!
* \brief Matrix entries for a mass balance 5/7/9 star system
*
* Matrix entries for the mass balance of a 5 star system
*
* The entries are center, east, west, north, south and the
* right side vector b of Ax = b. This system is typically used in 2d.
\verbatim
N
|
W-- C --E
|
S
\endverbatim
* Matrix entries for the mass balance of a 7 star system
*
* The entries are center, east, west, north, south, top, bottom and the
* right side vector b of Ax = b. This system is typically used in 3d.
\verbatim
T N
|/
W-- C --E
/|
S B
\endverbatim
* Matrix entries for the mass balance of a 9 star system
*
* The entries are center, east, west, north, south, north-east, south-east,
* north-wast, south-west and the
* right side vector b of Ax = b. This system is typically used in 2d.
\verbatim
NW N NE
\ | /
W-- C --E
/ | \
SW S SE
\endverbatim
* Matrix entries for the mass balance of a 27 star system
*
* The entries are center, east, west, north, south, north-east, south-east,
* north-wast, south-west, same for top and bottom and the
* right side vector b of Ax = b. This system is typically used in 2d.
\verbatim
top:
NW_T N_Z NE_T
\ | /
W_T-- T --E_T
/ | \
SW_T S_T SE_T
center:
NW N NE
\ | /
W-- C --E
/ | \
SW S SE
bottom:
NW_B N_B NE_B
\ | /
W_B-- B --E_B
/ | \
SW_B S_B SE_B
\endverbatim
*/
typedef struct {
int type;
int count;
double C, W, E, N, S, NE, NW, SE, SW, V;
/*top part */
double T, W_T, E_T, N_T, S_T, NE_T, NW_T, SE_T, SW_T;
/*bottom part */
double B, W_B, E_B, N_B, S_B, NE_B, NW_B, SE_B, SW_B;
} N_data_star;
/*!
* \brief callback structure for 3d matrix assembling
* */
typedef struct {
N_data_star *(*callback)(void *, N_geom_data *, int, int, int);
} N_les_callback_3d;
/*!
* \brief callback structure for 2d matrix assembling
* */
typedef struct {
N_data_star *(*callback)(void *, N_geom_data *, int, int);
} N_les_callback_2d;
extern 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));
extern void N_set_les_callback_2d_func(
N_les_callback_2d *data,
N_data_star *(*callback_func_2d)(void *, N_geom_data *, int, int));
extern N_les_callback_3d *N_alloc_les_callback_3d(void);
extern N_les_callback_2d *N_alloc_les_callback_2d(void);
extern N_data_star *N_alloc_5star(void);
extern N_data_star *N_alloc_7star(void);
extern N_data_star *N_alloc_9star(void);
extern N_data_star *N_alloc_27star(void);
extern N_data_star *N_create_5star(double C, double W, double E, double N,
double S, double V);
extern N_data_star *N_create_7star(double C, double W, double E, double N,
double S, double T, double B, double V);
extern 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);
extern 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);
extern N_data_star *N_callback_template_3d(void *data, N_geom_data *geom,
int col, int row, int depth);
extern N_data_star *N_callback_template_2d(void *data, N_geom_data *geom,
int col, int row);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
int N_les_integrate_dirichlet_3d(N_les *les, N_geom_data *geom,
N_array_3d *status, N_array_3d *start_val);
/* *************************************************************** */
/* *************** GPDE STANDARD OPTIONS ************************* */
/* *************************************************************** */
/*! \brief Standard options of the gpde library
* */
typedef enum {
N_OPT_SOLVER_SYMM, /*! solver for symmetric, positive definite linear
equation systems */
N_OPT_SOLVER_UNSYMM, /*! solver for unsymmetric linear equation systems */
N_OPT_MAX_ITERATIONS, /*! Maximum number of iteration used to solver the
linear equation system */
N_OPT_ITERATION_ERROR, /*! Error break criteria for the iterative solver
(jacobi, sor, cg or bicgstab) */
N_OPT_SOR_VALUE, /*! The relaxation parameter used by the jacobi and sor
solver for speedup or stabilizing */
N_OPT_CALC_TIME /*! The calculation time in seconds */
} N_STD_OPT;
extern struct Option *N_define_standard_option(int opt);
/* *************************************************************** */
/* *************** GPDE MATHEMATICAL TOOLS *********************** */
/* *************************************************************** */
extern double N_calc_arith_mean(double a, double b);
extern double N_calc_arith_mean_n(double *a, int size);
extern double N_calc_geom_mean(double a, double b);
extern double N_calc_geom_mean_n(double *a, int size);
extern double N_calc_harmonic_mean(double a, double b);
extern double N_calc_harmonic_mean_n(double *a, int size);
extern double N_calc_quad_mean(double a, double b);
extern double N_calc_quad_mean_n(double *a, int size);
/* *************************************************************** */
/* *************** UPWIND STABILIZATION ALGORITHMS *************** */
/* *************************************************************** */
extern double N_full_upwinding(double sprod, double distance, double D);
extern double N_exp_upwinding(double sprod, double distance, double D);
/* *************************************************************** */
/* *************** METHODS FOR GRADIENT CALCULATION ************** */
/* *************************************************************** */
/*!
\verbatim
______________
| | | |
| | | |
|----|-NC-|----|
| | | |
| WC EC |
| | | |
|----|-SC-|----|
| | | |
|____|____|____|
| /
TC NC
|/
--WC-----EC--
/|
SC BC
/ |
\endverbatim
*/
/*! \brief Gradient between the cells in X and Y direction */
typedef struct {
double NC, SC, WC, EC;
} N_gradient_2d;
/*! \brief Gradient between the cells in X, Y and Z direction */
typedef struct {
double NC, SC, WC, EC, TC, BC;
} N_gradient_3d;
/*!
\verbatim
Gradient in X direction between the cell neighbours
____ ____ ____
| | | |
| NWN NEN |
|____|____|____|
| | | |
| WN EN |
|____|____|____|
| | | |
| SWS SES |
|____|____|____|
Gradient in Y direction between the cell neighbours
______________
| | | |
| | | |
|NWW-|-NC-|-NEE|
| | | |
| | | |
|SWW-|-SC-|-SEE|
| | | |
|____|____|____|
Gradient in Z direction between the cell neighbours
/______________/
/| | | |
| NWZ| NZ | NEZ|
|____|____|____|
/| | | |
| WZ | CZ | EZ |
|____|____|____|
/| | | |
| SWZ| SZ | SEZ|
|____|____|____|
/____/____/____/
\endverbatim
*/
/*! \brief Gradient between the cell neighbours in X direction */
typedef struct {
double NWN, NEN, WC, EC, SWS, SES;
} N_gradient_neighbours_x;
/*! \brief Gradient between the cell neighbours in Y direction */
typedef struct {
double NWW, NEE, NC, SC, SWW, SEE;
} N_gradient_neighbours_y;
/*! \brief Gradient between the cell neighbours in Z direction */
typedef struct {
double NWZ, NZ, NEZ, WZ, CZ, EZ, SWZ, SZ, SEZ;
} N_gradient_neighbours_z;
/*! \brief Gradient between the cell neighbours in X and Y direction */
typedef struct {
N_gradient_neighbours_x *x;
N_gradient_neighbours_y *y;
} N_gradient_neighbours_2d;
/*! \brief Gradient between the cell neighbours in X, Y and Z direction */
typedef struct {
N_gradient_neighbours_x *xt; /*top values */
N_gradient_neighbours_x *xc; /*center values */
N_gradient_neighbours_x *xb; /*bottom values */
N_gradient_neighbours_y *yt; /*top values */
N_gradient_neighbours_y *yc; /*center values */
N_gradient_neighbours_y *yb; /*bottom values */
N_gradient_neighbours_z *zt; /*top-center values */
N_gradient_neighbours_z *zb; /*bottom-center values */
} N_gradient_neighbours_3d;
/*! Two dimensional gradient field */
typedef struct {
N_array_2d *x_array;
N_array_2d *y_array;
int cols, rows;
double min, max, mean, sum;
int nonull;
} N_gradient_field_2d;
/*! Three dimensional gradient field */
typedef struct {
N_array_3d *x_array;
N_array_3d *y_array;
N_array_3d *z_array;
int cols, rows, depths;
double min, max, mean, sum;
int nonull;
} N_gradient_field_3d;
extern N_gradient_2d *N_alloc_gradient_2d(void);
extern void N_free_gradient_2d(N_gradient_2d *grad);
extern N_gradient_2d *N_create_gradient_2d(double NC, double SC, double WC,
double EC);
extern int N_copy_gradient_2d(N_gradient_2d *source, N_gradient_2d *target);
extern N_gradient_2d *N_get_gradient_2d(N_gradient_field_2d *field,
N_gradient_2d *gradient, int col,
int row);
extern N_gradient_3d *N_alloc_gradient_3d(void);
extern void N_free_gradient_3d(N_gradient_3d *grad);
extern N_gradient_3d *N_create_gradient_3d(double NC, double SC, double WC,
double EC, double TC, double BC);
extern int N_copy_gradient_3d(N_gradient_3d *source, N_gradient_3d *target);
extern N_gradient_3d *N_get_gradient_3d(N_gradient_field_3d *field,
N_gradient_3d *gradient, int col,
int row, int depth);
extern N_gradient_neighbours_x *N_alloc_gradient_neighbours_x(void);
extern void N_free_gradient_neighbours_x(N_gradient_neighbours_x *grad);
extern N_gradient_neighbours_x *
N_create_gradient_neighbours_x(double NWN, double NEN, double WC, double EC,
double SWS, double SES);
extern int N_copy_gradient_neighbours_x(N_gradient_neighbours_x *source,
N_gradient_neighbours_x *target);
extern N_gradient_neighbours_y *N_alloc_gradient_neighbours_y(void);
extern void N_free_gradient_neighbours_y(N_gradient_neighbours_y *grad);
extern N_gradient_neighbours_y *
N_create_gradient_neighbours_y(double NWW, double NEE, double NC, double SC,
double SWW, double SEE);
extern int N_copy_gradient_neighbours_y(N_gradient_neighbours_y *source,
N_gradient_neighbours_y *target);
extern N_gradient_neighbours_z *N_alloc_gradient_neighbours_z(void);
extern void N_free_gradient_neighbours_z(N_gradient_neighbours_z *grad);
extern 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);
extern int N_copy_gradient_neighbours_z(N_gradient_neighbours_z *source,
N_gradient_neighbours_z *target);
extern N_gradient_neighbours_2d *N_alloc_gradient_neighbours_2d(void);
extern void N_free_gradient_neighbours_2d(N_gradient_neighbours_2d *grad);
extern N_gradient_neighbours_2d *
N_create_gradient_neighbours_2d(N_gradient_neighbours_x *x,
N_gradient_neighbours_y *y);
extern int N_copy_gradient_neighbours_2d(N_gradient_neighbours_2d *source,
N_gradient_neighbours_2d *target);
extern N_gradient_neighbours_2d *
N_get_gradient_neighbours_2d(N_gradient_field_2d *field,
N_gradient_neighbours_2d *gradient, int col,
int row);
extern N_gradient_neighbours_3d *N_alloc_gradient_neighbours_3d(void);
extern void N_free_gradient_neighbours_3d(N_gradient_neighbours_3d *grad);
extern 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);
extern int N_copy_gradient_neighbours_3d(N_gradient_neighbours_3d *source,
N_gradient_neighbours_3d *target);
extern void N_print_gradient_field_2d_info(N_gradient_field_2d *field);
extern void N_calc_gradient_field_2d_stats(N_gradient_field_2d *field);
extern N_gradient_field_2d *N_alloc_gradient_field_2d(int cols, int rows);
extern void N_free_gradient_field_2d(N_gradient_field_2d *field);
extern int N_copy_gradient_field_2d(N_gradient_field_2d *source,
N_gradient_field_2d *target);
extern 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);
extern void N_compute_gradient_field_components_2d(N_gradient_field_2d *field,
N_array_2d *x_comp,
N_array_2d *y_comp);
extern void N_print_gradient_field_3d_info(N_gradient_field_3d *field);
extern void N_calc_gradient_field_3d_stats(N_gradient_field_3d *field);
extern N_gradient_field_3d *N_alloc_gradient_field_3d(int cols, int rows,
int depths);
extern void N_free_gradient_field_3d(N_gradient_field_3d *field);
extern int N_copy_gradient_field_3d(N_gradient_field_3d *source,
N_gradient_field_3d *target);
extern 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);
extern 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);
#endif
N_alloc_gradient_3d
N_gradient_3d * N_alloc_gradient_3d(void)
Allocate a N_gradient_3d structure.
Definition n_gradient.c:149
N_create_gradient_3d
N_gradient_3d * N_create_gradient_3d(double NC, double SC, double WC, double EC, double TC, double BC)
allocate and initialize a N_gradient_3d structure
Definition n_gradient.c:184
N_alloc_27star
N_data_star * N_alloc_27star(void)
allocate a 27 point star data structure
Definition n_les_assemble.c:101
N_assemble_les_2d
N_les * N_assemble_les_2d(int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
Assemble a linear equation system (les) based on 2d location data (raster) and active cells.
Definition n_les_assemble.c:495
N_compute_gradient_field_2d
N_gradient_field_2d * N_compute_gradient_field_2d(N_array_2d *pot, N_array_2d *weight_x, N_array_2d *weight_y, N_geom_data *geom, N_gradient_field_2d *gradfield)
This function computes the gradient based on the input N_array_2d pot (potential),...
Definition n_gradient_calc.c:109
N_alloc_gradient_2d
N_gradient_2d * N_alloc_gradient_2d(void)
Allocate a N_gradient_2d structure.
Definition n_gradient.c:26
N_alloc_gradient_neighbours_y
N_gradient_neighbours_y * N_alloc_gradient_neighbours_y(void)
Allocate a N_gradient_neighbours_y structure.
Definition n_gradient.c:381
N_norm_array_2d
double N_norm_array_2d(N_array_2d *array1, N_array_2d *array2, int type)
Calculate the norm of the two input arrays.
Definition n_arrays_calc.c:142
N_print_les
void N_print_les(N_les *les)
prints the linear equation system to stdout
Definition n_les.c:257
N_callback_template_3d
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.
Definition n_les_assemble.c:427
N_copy_gradient_neighbours_2d
int N_copy_gradient_neighbours_2d(N_gradient_neighbours_2d *source, N_gradient_neighbours_2d *target)
copy a N_gradient_neighbours_2d structure
Definition n_gradient.c:650
N_assemble_les_3d
N_les * N_assemble_les_3d(int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
Assemble a linear equation system (les) based on 3d location data (g3d) active cells.
Definition n_les_assemble.c:958
N_compute_gradient_field_components_3d
void N_compute_gradient_field_components_3d(N_gradient_field_3d *field, N_array_3d *x_comp, N_array_3d *y_comp, N_array_3d *z_comp)
Calculate the x, y and z vector components from a gradient field for each cell and store them in the ...
Definition n_gradient_calc.c:595
N_put_array_3d_f_value
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.
Definition n_arrays.c:1121
N_get_array_2d_c_value
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.
Definition n_arrays.c:314
N_copy_gradient_3d
int N_copy_gradient_3d(N_gradient_3d *source, N_gradient_3d *target)
copy a N_gradient_3d structure
Definition n_gradient.c:211
N_alloc_geom_data
N_geom_data * N_alloc_geom_data(void)
Allocate the pde geometry data structure and return a pointer to the new allocated structure.
Definition n_geom.c:29
N_print_array_3d_info
void N_print_array_3d_info(N_array_3d *data)
Write the info of the array to stdout.
Definition n_arrays.c:1170
N_get_geom_data_area_of_cell
double N_get_geom_data_area_of_cell(N_geom_data *geom, int row)
Get the areay size in square meter of one cell (x*y) at row.
Definition n_geom.c:196
N_get_array_2d_d_value
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.
Definition n_arrays.c:380
N_alloc_gradient_neighbours_z
N_gradient_neighbours_z * N_alloc_gradient_neighbours_z(void)
Allocate a N_gradient_neighbours_z structure.
Definition n_gradient.c:473
N_put_array_3d_value_null
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.
Definition n_arrays.c:1060
N_create_gradient_neighbours_z
N_gradient_neighbours_z * N_create_gradient_neighbours_z(double NWZ, double NZ, double NEZ, double WZ, double CZ, double EZ, double SWZ, double SZ, double SEZ)
Allocate and initialize a N_gradient_neighbours_z structure.
Definition n_gradient.c:513
N_STD_OPT
N_STD_OPT
Standard options of the gpde library.
Definition N_pde.h:391
N_OPT_MAX_ITERATIONS
@ N_OPT_MAX_ITERATIONS
Definition N_pde.h:395
N_OPT_SOLVER_UNSYMM
@ N_OPT_SOLVER_UNSYMM
Definition N_pde.h:394
N_OPT_SOLVER_SYMM
@ N_OPT_SOLVER_SYMM
Definition N_pde.h:392
N_OPT_ITERATION_ERROR
@ N_OPT_ITERATION_ERROR
Definition N_pde.h:397
N_OPT_CALC_TIME
@ N_OPT_CALC_TIME
Definition N_pde.h:401
N_OPT_SOR_VALUE
@ N_OPT_SOR_VALUE
Definition N_pde.h:399
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.
Definition n_geom.c:73
N_alloc_array_3d
N_array_3d * N_alloc_array_3d(int cols, int rows, int depths, int offset, int type)
Allocate memory for a N_array_3d data structure.
Definition n_arrays.c:719
N_put_array_3d_d_value
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.
Definition n_arrays.c:1148
N_compute_gradient_field_components_2d
void N_compute_gradient_field_components_2d(N_gradient_field_2d *field, N_array_2d *x_comp, N_array_2d *y_comp)
Calculate the x and y vector components from a gradient field for each cell and stores them in the pr...
Definition n_gradient_calc.c:242
N_create_5star
N_data_star * N_create_5star(double C, double W, double E, double N, double S, double V)
allocate and initialize a 5 point star data structure
Definition n_les_assemble.c:124
N_calc_gradient_field_2d_stats
void N_calc_gradient_field_2d_stats(N_gradient_field_2d *field)
Calculate basic statistics of a gradient field.
Definition n_gradient_calc.c:28
N_put_array_3d_value
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.
Definition n_arrays.c:1010
N_create_27star
N_data_star * N_create_27star(double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double T, double W_T, double E_T, double N_T, double S_T, double NW_T, double SW_T, double NE_T, double SE_T, double B, double W_B, double E_B, double N_B, double S_B, double NW_B, double SW_B, double NE_B, double SE_B, double V)
allocate and initialize a 27 point star data structure
Definition n_les_assemble.c:264
N_free_gradient_field_3d
void N_free_gradient_field_3d(N_gradient_field_3d *field)
Free's a N_gradient_neighbours_3d structure.
Definition n_gradient.c:1019
N_write_array_3d_to_rast3d
void N_write_array_3d_to_rast3d(N_array_3d *array, char *name, int mask)
Write a N_array_3d struct to a volume map.
Definition n_arrays_io.c:381
N_alloc_les_Ax
N_les * N_alloc_les_Ax(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A and vector x.
Definition n_les.c:117
N_convert_array_3d_null_to_zero
int N_convert_array_3d_null_to_zero(N_array_3d *a)
Convert all null values to zero values.
Definition n_arrays_calc.c:832
N_norm_array_3d
double N_norm_array_3d(N_array_3d *array1, N_array_3d *array2, int type)
Calculate the norm of the two input arrays.
Definition n_arrays_calc.c:556
N_alloc_7star
N_data_star * N_alloc_7star(void)
allocate a 7 point star data structure
Definition n_les_assemble.c:59
N_exp_upwinding
double N_exp_upwinding(double sprod, double distance, double D)
exponential upwinding stabilization algorithm
Definition n_upwind.c:63
N_convert_array_2d_null_to_zero
int N_convert_array_2d_null_to_zero(N_array_2d *a)
Convert all null values to zero values.
Definition n_arrays_calc.c:418
N_copy_gradient_field_3d
int N_copy_gradient_field_3d(N_gradient_field_3d *source, N_gradient_field_3d *target)
Copy N_gradient_field_3d structure from source to target.
Definition n_gradient.c:1041
N_alloc_nquad_les_Ax
N_les * N_alloc_nquad_les_Ax(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A and vector x...
Definition n_les.c:51
N_copy_gradient_neighbours_x
int N_copy_gradient_neighbours_x(N_gradient_neighbours_x *source, N_gradient_neighbours_x *target)
copy a N_gradient_neighbours_x structure
Definition n_gradient.c:355
N_alloc_9star
N_data_star * N_alloc_9star(void)
allocate a 9 point star data structure
Definition n_les_assemble.c:80
N_alloc_gradient_field_2d
N_gradient_field_2d * N_alloc_gradient_field_2d(int cols, int rows)
Allocate a N_gradient_field_2d.
Definition n_gradient.c:896
N_les_integrate_dirichlet_3d
int N_les_integrate_dirichlet_3d(N_les *les, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val)
Integrate Dirichlet or Transmission boundary conditions into the les (3d).
Definition n_les_assemble.c:1252
N_get_array_3d_type
int N_get_array_3d_type(N_array_3d *array3d)
Return the data type of the N_array_3d.
Definition n_arrays.c:803
N_get_array_2d_f_value
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.
Definition n_arrays.c:347
N_create_gradient_neighbours_3d
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.
Definition n_gradient.c:806
N_alloc_nquad_les
N_les * N_alloc_nquad_les(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A,...
Definition n_les.c:34
N_free_gradient_neighbours_2d
void N_free_gradient_neighbours_2d(N_gradient_neighbours_2d *grad)
Free's a N_gradient_neighbours_2d structure.
Definition n_gradient.c:596
N_print_gradient_field_2d_info
void N_print_gradient_field_2d_info(N_gradient_field_2d *field)
Print gradient field information to stdout.
Definition n_gradient.c:961
N_read_rast_to_array_2d
N_array_2d * N_read_rast_to_array_2d(char *name, N_array_2d *array)
Read a raster map into a N_array_2d structure.
Definition n_arrays_io.c:44
N_calc_geom_mean_n
double N_calc_geom_mean_n(double *a, int size)
Calculate the geometrical mean of the values in vector a of size n.
Definition n_tools.c:93
N_assemble_les_3d_param
N_les * N_assemble_les_3d_param(int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback, int cell_type)
Assemble a linear equation system (les) based on 3d location data (g3d).
Definition n_les_assemble.c:1023
N_is_array_2d_value_null
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.
Definition n_arrays.c:231
N_alloc_gradient_neighbours_x
N_gradient_neighbours_x * N_alloc_gradient_neighbours_x(void)
Allocate a N_gradient_neighbours_x structure.
Definition n_gradient.c:289
N_calc_harmonic_mean_n
double N_calc_harmonic_mean_n(double *a, int size)
Calculate the harmonical mean of the values in vector a of size n.
Definition n_tools.c:136
N_print_gradient_field_3d_info
void N_print_gradient_field_3d_info(N_gradient_field_3d *field)
Print gradient field information to stdout.
Definition n_gradient.c:1062
N_free_gradient_neighbours_z
void N_free_gradient_neighbours_z(N_gradient_neighbours_z *grad)
Free's a N_gradient_neighbours_z structure.
Definition n_gradient.c:489
N_get_gradient_neighbours_2d
N_gradient_neighbours_2d * N_get_gradient_neighbours_2d(N_gradient_field_2d *field, N_gradient_neighbours_2d *gradient, int col, int row)
Return a N_gradient_neighbours_2d structure calculated from the input gradient field at position [row...
Definition n_gradient.c:689
N_define_standard_option
struct Option * N_define_standard_option(int opt)
Create standardised Option structure related to the gpde library.
Definition n_parse_options.c:42
N_copy_gradient_neighbours_z
int N_copy_gradient_neighbours_z(N_gradient_neighbours_z *source, N_gradient_neighbours_z *target)
copy a N_gradient_neighbours_z structure
Definition n_gradient.c:547
N_free_array_3d
void N_free_array_3d(N_array_3d *data_array)
Release the memory of a N_array_3d.
Definition n_arrays.c:774
N_les_integrate_dirichlet_2d
int N_les_integrate_dirichlet_2d(N_les *les, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val)
Integrate Dirichlet or Transmission boundary conditions into the les (2s).
Definition n_les_assemble.c:793
N_alloc_gradient_field_3d
N_gradient_field_3d * N_alloc_gradient_field_3d(int cols, int rows, int depths)
Allocate a N_gradient_field_3d.
Definition n_gradient.c:993
N_calc_array_3d_stats
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.
Definition n_arrays_calc.c:627
N_print_array_2d
void N_print_array_2d(N_array_2d *data)
Write info and content of the N_array_2d struct to stdout.
Definition n_arrays.c:628
N_copy_gradient_neighbours_3d
int N_copy_gradient_neighbours_3d(N_gradient_neighbours_3d *source, N_gradient_neighbours_3d *target)
copy a N_gradient_neighbours_3d structure
Definition n_gradient.c:852
N_alloc_gradient_neighbours_2d
N_gradient_neighbours_2d * N_alloc_gradient_neighbours_2d(void)
Allocate a N_gradient_neighbours_2d structure.
Definition n_gradient.c:577
N_free_geom_data
void N_free_geom_data(N_geom_data *geodata)
Release memory of a pde geometry data structure.
Definition n_geom.c:49
N_calc_quad_mean_n
double N_calc_quad_mean_n(double *a, int size)
Calculate the quadratic mean of the values in vector a of size n.
Definition n_tools.c:184
N_get_array_2d_value
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.
Definition n_arrays.c:182
N_assemble_les_3d_dirichlet
N_les * N_assemble_les_3d_dirichlet(int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
Assemble a linear equation system (les) based on 3d location data (g3d) active and dirichlet cells.
Definition n_les_assemble.c:986
N_alloc_les_A
N_les * N_alloc_les_A(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A.
Definition n_les.c:133
N_calc_geom_mean
double N_calc_geom_mean(double a, double b)
Calculate the geometrical mean of values a and b.
Definition n_tools.c:73
N_alloc_nquad_les_A
N_les * N_alloc_nquad_les_A(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A.
Definition n_les.c:68
N_create_9star
N_data_star * N_create_9star(double C, double W, double E, double N, double S, double NW, double SW, double NE, double SE, double V)
allocate and initialize a 9 point star data structure
Definition n_les_assemble.c:200
N_calc_arith_mean_n
double N_calc_arith_mean_n(double *a, int size)
Calculate the arithmetic mean of the values in vector a of size n.
Definition n_tools.c:51
N_copy_array_3d
void N_copy_array_3d(N_array_3d *source, N_array_3d *target)
Copy the source N_array_3d struct to the target N_array_3d struct.
Definition n_arrays_calc.c:485
N_print_array_2d_info
void N_print_array_2d_info(N_array_2d *data)
This function writes the data info of the array data to stdout.
Definition n_arrays.c:603
N_assemble_les_2d_dirichlet
N_les * N_assemble_les_2d_dirichlet(int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
Assemble a linear equation system (les) based on 2d location data (raster) and active and dirichlet c...
Definition n_les_assemble.c:525
N_alloc_nquad_les_Ax_b
N_les * N_alloc_nquad_les_Ax_b(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A,...
Definition n_les.c:85
N_calc_arith_mean
double N_calc_arith_mean(double a, double b)
Calculate the arithmetic mean of values a and b.
Definition n_tools.c:31
N_create_gradient_neighbours_x
N_gradient_neighbours_x * N_create_gradient_neighbours_x(double NWN, double NEN, double WC, double EC, double SWS, double SES)
Allocate and initialize a N_gradient_neighbours_x structure.
Definition n_gradient.c:326
N_create_gradient_neighbours_2d
N_gradient_neighbours_2d * N_create_gradient_neighbours_2d(N_gradient_neighbours_x *x, N_gradient_neighbours_y *y)
Allocate and initialize a N_gradient_neighbours_2d structure.
Definition n_gradient.c:618
N_copy_array_2d
void N_copy_array_2d(N_array_2d *source, N_array_2d *target)
Copy the source N_array_2d struct to the target N_array_2d struct.
Definition n_arrays_calc.c:43
N_alloc_gradient_neighbours_3d
N_gradient_neighbours_3d * N_alloc_gradient_neighbours_3d(void)
Allocate a N_gradient_neighbours_3d structure.
Definition n_gradient.c:752
N_create_gradient_neighbours_y
N_gradient_neighbours_y * N_create_gradient_neighbours_y(double NWW, double NEE, double NC, double SC, double SWW, double SEE)
Allocate and initialize a N_gradient_neighbours_y structure.
Definition n_gradient.c:418
N_callback_template_2d
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.
Definition n_les_assemble.c:465
N_create_7star
N_data_star * N_create_7star(double C, double W, double E, double N, double S, double T, double B, double V)
allocate and initialize a 7 point star data structure
Definition n_les_assemble.c:159
N_read_rast3d_to_array_3d
N_array_3d * N_read_rast3d_to_array_3d(char *name, N_array_3d *array, int mask)
Read a volume map into a N_array_3d structure.
Definition n_arrays_io.c:253
N_alloc_5star
N_data_star * N_alloc_5star(void)
allocate a 5 point star data structure
Definition n_les_assemble.c:42
N_alloc_les_Ax_b
N_les * N_alloc_les_Ax_b(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A,...
Definition n_les.c:149
N_get_gradient_2d
N_gradient_2d * N_get_gradient_2d(N_gradient_field_2d *field, N_gradient_2d *gradient, int col, int row)
Return a N_gradient_2d structure calculated from the input gradient field at position [row][col].
Definition n_gradient.c:114
N_les_pivot_create
int N_les_pivot_create(N_les *les)
N_full_upwinding
double N_full_upwinding(double sprod, double distance, double D)
full upwinding stabilization algorithm
Definition n_upwind.c:32
N_get_gradient_3d
N_gradient_3d * N_get_gradient_3d(N_gradient_field_3d *field, N_gradient_3d *gradient, int col, int row, int depth)
Return a N_gradient_3d structure calculated from the input gradient field at position [depth][row][co...
Definition n_gradient.c:246
N_alloc_array_2d
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
Definition n_arrays.c:75
N_free_gradient_2d
void N_free_gradient_2d(N_gradient_2d *grad)
Free's a N_gradient_2d structure.
Definition n_gradient.c:41
N_copy_gradient_neighbours_y
int N_copy_gradient_neighbours_y(N_gradient_neighbours_y *source, N_gradient_neighbours_y *target)
copy a N_gradient_neighbours_y structure
Definition n_gradient.c:447
N_compute_gradient_field_3d
N_gradient_field_3d * N_compute_gradient_field_3d(N_array_3d *pot, N_array_3d *weight_x, N_array_3d *weight_y, N_array_3d *weight_z, N_geom_data *geom, N_gradient_field_3d *gradfield)
This function computes the gradient based on the input N_array_3d pot (that means potential),...
Definition n_gradient_calc.c:400
N_free_les
void N_free_les(N_les *les)
Release the memory of the linear equation system.
Definition n_les.c:307
N_alloc_les_param
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.
Definition n_les.c:182
N_is_array_3d_value_null
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,...
Definition n_arrays.c:873
N_alloc_les
N_les * N_alloc_les(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A,...
Definition n_les.c:101
N_put_array_2d_d_value
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.
Definition n_arrays.c:576
N_copy_gradient_2d
int N_copy_gradient_2d(N_gradient_2d *source, N_gradient_2d *target)
copy a N_gradient_2d structure
Definition n_gradient.c:83
N_get_array_2d_type
int N_get_array_2d_type(N_array_2d *array2d)
Return the data type of the N_array_2d struct.
Definition n_arrays.c:164
N_free_gradient_3d
void N_free_gradient_3d(N_gradient_3d *grad)
Free's a N_gradient_3d structure.
Definition n_gradient.c:164
N_assemble_les_2d_active
N_les * N_assemble_les_2d_active(int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback)
Assemble a linear equation system (les) based on 2d location data (raster) and active cells.
Definition n_les_assemble.c:510
N_write_array_2d_to_rast
void N_write_array_2d_to_rast(N_array_2d *array, char *name)
Write a N_array_2d struct to a raster map.
Definition n_arrays_io.c:172
N_put_array_2d_value_null
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.
Definition n_arrays.c:459
N_alloc_les_callback_2d
N_les_callback_2d * N_alloc_les_callback_2d(void)
Allocate the structure holding the callback function.
Definition n_les_assemble.c:400
N_assemble_les_3d_active
N_les * N_assemble_les_3d_active(int les_type, N_geom_data *geom, N_array_3d *status, N_array_3d *start_val, void *data, N_les_callback_3d *callback)
Assemble a linear equation system (les) based on 3d location data (g3d) active cells.
Definition n_les_assemble.c:972
N_calc_array_2d_stats
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.
Definition n_arrays_calc.c:213
N_free_gradient_neighbours_y
void N_free_gradient_neighbours_y(N_gradient_neighbours_y *grad)
Free's a N_gradient_neighbours_y structure.
Definition n_gradient.c:397
N_init_geom_data_2d
N_geom_data * N_init_geom_data_2d(struct Cell_head *region, N_geom_data *geodata)
Initiate a pde geometry data structure with a 2d region.
Definition n_geom.c:117
N_get_array_3d_value
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.
Definition n_arrays.c:822
N_math_array_3d
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.
Definition n_arrays_calc.c:723
N_calc_gradient_field_3d_stats
void N_calc_gradient_field_3d_stats(N_gradient_field_3d *field)
Calculate basic statistics of a gradient field.
Definition n_gradient_calc.c:303
N_assemble_les_2d_param
N_les * N_assemble_les_2d_param(int les_type, N_geom_data *geom, N_array_2d *status, N_array_2d *start_val, void *data, N_les_callback_2d *callback, int cell_Type)
Assemble a linear equation system (les) based on 2d location data (raster).
Definition n_les_assemble.c:563
N_calc_quad_mean
double N_calc_quad_mean(double a, double b)
Calculate the quadratic mean of values a and b.
Definition n_tools.c:164
N_put_array_2d_f_value
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.
Definition n_arrays.c:546
N_get_array_3d_f_value
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.
Definition n_arrays.c:948
N_alloc_les_callback_3d
N_les_callback_3d * N_alloc_les_callback_3d(void)
Allocate the structure holding the callback function.
Definition n_les_assemble.c:379
N_calc_harmonic_mean
double N_calc_harmonic_mean(double a, double b)
Calculate the harmonical mean of values a and b.
Definition n_tools.c:115
N_get_array_3d_d_value
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.
Definition n_arrays.c:979
N_free_array_2d
void N_free_array_2d(N_array_2d *data_array)
Release the memory of a N_array_2d structure.
Definition n_arrays.c:132
N_set_les_callback_3d_func
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.
Definition n_les_assemble.c:341
N_put_array_2d_c_value
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.
Definition n_arrays.c:516
N_print_array_3d
void N_print_array_3d(N_array_3d *data)
Write info and content of the array data to stdout.
Definition n_arrays.c:1196
N_set_les_callback_2d_func
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.
Definition n_les_assemble.c:360
N_free_gradient_field_2d
void N_free_gradient_field_2d(N_gradient_field_2d *field)
Free's a N_gradient_neighbours_2d structure.
Definition n_gradient.c:920
N_free_gradient_neighbours_x
void N_free_gradient_neighbours_x(N_gradient_neighbours_x *grad)
Free's a N_gradient_neighbours_x structure.
Definition n_gradient.c:305
N_math_array_2d
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.
Definition n_arrays_calc.c:299
N_create_gradient_2d
N_gradient_2d * N_create_gradient_2d(double NC, double SC, double WC, double EC)
allocate and initialize a N_gradient_2d structure
Definition n_gradient.c:59
N_copy_gradient_field_2d
int N_copy_gradient_field_2d(N_gradient_field_2d *source, N_gradient_field_2d *target)
Copy N_gradient_field_2d structure from source to target.
Definition n_gradient.c:941
N_free_gradient_neighbours_3d
void N_free_gradient_neighbours_3d(N_gradient_neighbours_3d *grad)
Free's a N_gradient_neighbours_3d structure.
Definition n_gradient.c:777
N_put_array_2d_value
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.
Definition n_arrays.c:412
SE
#define SE
Definition dataquad.h:31
SW
#define SW
Definition dataquad.h:30
NE
#define NE
Definition dataquad.h:29
NW
#define NW
Definition dataquad.h:28
b
double b
Definition driver/set_window.c:5
D
#define D
Definition intersect.c:72
name
const char * name
Definition named_colr.c:6
min
#define min(a, b)
Definition pngdriver/draw_bitmap.c:19
max
#define max(a, b)
Definition pngdriver/draw_bitmap.c:22
N_array_2d
Definition N_pde.h:132
N_array_2d::type
int type
Definition N_pde.h:133
N_array_2d::dcell_array
DCELL * dcell_array
Definition N_pde.h:141
N_array_2d::fcell_array
FCELL * fcell_array
Definition N_pde.h:139
N_array_2d::cell_array
CELL * cell_array
Definition N_pde.h:137
N_array_2d::cols
int cols
Definition N_pde.h:134
N_array_2d::rows_intern
int rows_intern
Definition N_pde.h:135
N_array_2d::rows
int rows
Definition N_pde.h:134
N_array_2d::offset
int offset
Definition N_pde.h:136
N_array_2d::cols_intern
int cols_intern
Definition N_pde.h:135
N_array_3d
Definition N_pde.h:175
N_array_3d::cols_intern
int cols_intern
Definition N_pde.h:178
N_array_3d::type
int type
Definition N_pde.h:176
N_array_3d::offset
int offset
Definition N_pde.h:179
N_array_3d::rows
int rows
Definition N_pde.h:177
N_array_3d::dcell_array
double * dcell_array
Definition N_pde.h:182
N_array_3d::fcell_array
float * fcell_array
Definition N_pde.h:180
N_array_3d::depths_intern
int depths_intern
Definition N_pde.h:178
N_array_3d::rows_intern
int rows_intern
Definition N_pde.h:178
N_array_3d::depths
int depths
Definition N_pde.h:177
N_array_3d::cols
int cols
Definition N_pde.h:177
N_data_star
Matrix entries for a mass balance 5/7/9 star system.
Definition N_pde.h:295
N_data_star::W_B
double W_B
Definition N_pde.h:302
N_data_star::E
double E
Definition N_pde.h:298
N_data_star::S
double S
Definition N_pde.h:298
N_data_star::NE
double NE
Definition N_pde.h:298
N_data_star::E_B
double E_B
Definition N_pde.h:302
N_data_star::N_T
double N_T
Definition N_pde.h:300
N_data_star::SE
double SE
Definition N_pde.h:298
N_data_star::N_B
double N_B
Definition N_pde.h:302
N_data_star::NW
double NW
Definition N_pde.h:298
N_data_star::W
double W
Definition N_pde.h:298
N_data_star::S_T
double S_T
Definition N_pde.h:300
N_data_star::NW_T
double NW_T
Definition N_pde.h:300
N_data_star::E_T
double E_T
Definition N_pde.h:300
N_data_star::NW_B
double NW_B
Definition N_pde.h:302
N_data_star::S_B
double S_B
Definition N_pde.h:302
N_data_star::W_T
double W_T
Definition N_pde.h:300
N_data_star::SW
double SW
Definition N_pde.h:298
N_data_star::SW_T
double SW_T
Definition N_pde.h:300
N_data_star::C
double C
Definition N_pde.h:298
N_data_star::type
int type
Definition N_pde.h:296
N_data_star::T
double T
Definition N_pde.h:300
N_data_star::SW_B
double SW_B
Definition N_pde.h:302
N_data_star::NE_T
double NE_T
Definition N_pde.h:300
N_data_star::N
double N
Definition N_pde.h:298
N_data_star::B
double B
Definition N_pde.h:302
N_data_star::SE_T
double SE_T
Definition N_pde.h:300
N_data_star::count
int count
Definition N_pde.h:297
N_data_star::SE_B
double SE_B
Definition N_pde.h:302
N_data_star::NE_B
double NE_B
Definition N_pde.h:302
N_data_star::V
double V
Definition N_pde.h:298
N_geom_data
Geometric information about the structured grid.
Definition N_pde.h:101
N_geom_data::dx
double dx
Definition N_pde.h:108
N_geom_data::depths
int depths
Definition N_pde.h:114
N_geom_data::dy
double dy
Definition N_pde.h:109
N_geom_data::area
double * area
Definition N_pde.h:104
N_geom_data::dz
double dz
Definition N_pde.h:110
N_geom_data::dim
int dim
Definition N_pde.h:106
N_geom_data::rows
int rows
Definition N_pde.h:115
N_geom_data::planimetric
int planimetric
Definition N_pde.h:102
N_geom_data::cols
int cols
Definition N_pde.h:116
N_geom_data::Az
double Az
Definition N_pde.h:112
N_gradient_2d
Gradient between the cells in X and Y direction.
Definition N_pde.h:457
N_gradient_2d::EC
double EC
Definition N_pde.h:459
N_gradient_2d::SC
double SC
Definition N_pde.h:459
N_gradient_2d::WC
double WC
Definition N_pde.h:459
N_gradient_2d::NC
double NC
Definition N_pde.h:459
N_gradient_3d
Gradient between the cells in X, Y and Z direction.
Definition N_pde.h:464
N_gradient_3d::WC
double WC
Definition N_pde.h:466
N_gradient_3d::NC
double NC
Definition N_pde.h:466
N_gradient_3d::EC
double EC
Definition N_pde.h:466
N_gradient_3d::SC
double SC
Definition N_pde.h:466
N_gradient_3d::BC
double BC
Definition N_pde.h:466
N_gradient_3d::TC
double TC
Definition N_pde.h:466
N_gradient_field_2d
Definition N_pde.h:559
N_gradient_field_2d::cols
int cols
Definition N_pde.h:563
N_gradient_field_2d::sum
double sum
Definition N_pde.h:564
N_gradient_field_2d::y_array
N_array_2d * y_array
Definition N_pde.h:562
N_gradient_field_2d::x_array
N_array_2d * x_array
Definition N_pde.h:561
N_gradient_field_2d::max
double max
Definition N_pde.h:564
N_gradient_field_2d::min
double min
Definition N_pde.h:564
N_gradient_field_2d::rows
int rows
Definition N_pde.h:563
N_gradient_field_2d::mean
double mean
Definition N_pde.h:564
N_gradient_field_2d::nonull
int nonull
Definition N_pde.h:565
N_gradient_field_3d
Definition N_pde.h:570
N_gradient_field_3d::sum
double sum
Definition N_pde.h:576
N_gradient_field_3d::depths
int depths
Definition N_pde.h:575
N_gradient_field_3d::y_array
N_array_3d * y_array
Definition N_pde.h:573
N_gradient_field_3d::cols
int cols
Definition N_pde.h:575
N_gradient_field_3d::nonull
int nonull
Definition N_pde.h:577
N_gradient_field_3d::x_array
N_array_3d * x_array
Definition N_pde.h:572
N_gradient_field_3d::mean
double mean
Definition N_pde.h:576
N_gradient_field_3d::z_array
N_array_3d * z_array
Definition N_pde.h:574
N_gradient_field_3d::min
double min
Definition N_pde.h:576
N_gradient_field_3d::rows
int rows
Definition N_pde.h:575
N_gradient_field_3d::max
double max
Definition N_pde.h:576
N_gradient_neighbours_2d
Gradient between the cell neighbours in X and Y direction.
Definition N_pde.h:535
N_gradient_neighbours_2d::y
N_gradient_neighbours_y * y
Definition N_pde.h:538
N_gradient_neighbours_2d::x
N_gradient_neighbours_x * x
Definition N_pde.h:537
N_gradient_neighbours_3d
Gradient between the cell neighbours in X, Y and Z direction.
Definition N_pde.h:543
N_gradient_neighbours_3d::yb
N_gradient_neighbours_y * yb
Definition N_pde.h:551
N_gradient_neighbours_3d::zb
N_gradient_neighbours_z * zb
Definition N_pde.h:554
N_gradient_neighbours_3d::yt
N_gradient_neighbours_y * yt
Definition N_pde.h:549
N_gradient_neighbours_3d::zt
N_gradient_neighbours_z * zt
Definition N_pde.h:553
N_gradient_neighbours_3d::yc
N_gradient_neighbours_y * yc
Definition N_pde.h:550
N_gradient_neighbours_3d::xb
N_gradient_neighbours_x * xb
Definition N_pde.h:547
N_gradient_neighbours_3d::xt
N_gradient_neighbours_x * xt
Definition N_pde.h:545
N_gradient_neighbours_3d::xc
N_gradient_neighbours_x * xc
Definition N_pde.h:546
N_gradient_neighbours_x
Gradient between the cell neighbours in X direction.
Definition N_pde.h:514
N_gradient_neighbours_x::SES
double SES
Definition N_pde.h:516
N_gradient_neighbours_x::NEN
double NEN
Definition N_pde.h:516
N_gradient_neighbours_x::WC
double WC
Definition N_pde.h:516
N_gradient_neighbours_x::NWN
double NWN
Definition N_pde.h:516
N_gradient_neighbours_x::EC
double EC
Definition N_pde.h:516
N_gradient_neighbours_x::SWS
double SWS
Definition N_pde.h:516
N_gradient_neighbours_y
Gradient between the cell neighbours in Y direction.
Definition N_pde.h:521
N_gradient_neighbours_y::SEE
double SEE
Definition N_pde.h:523
N_gradient_neighbours_y::SC
double SC
Definition N_pde.h:523
N_gradient_neighbours_y::SWW
double SWW
Definition N_pde.h:523
N_gradient_neighbours_y::NEE
double NEE
Definition N_pde.h:523
N_gradient_neighbours_y::NWW
double NWW
Definition N_pde.h:523
N_gradient_neighbours_y::NC
double NC
Definition N_pde.h:523
N_gradient_neighbours_z
Gradient between the cell neighbours in Z direction.
Definition N_pde.h:528
N_gradient_neighbours_z::NZ
double NZ
Definition N_pde.h:530
N_gradient_neighbours_z::WZ
double WZ
Definition N_pde.h:530
N_gradient_neighbours_z::SEZ
double SEZ
Definition N_pde.h:530
N_gradient_neighbours_z::EZ
double EZ
Definition N_pde.h:530
N_gradient_neighbours_z::NWZ
double NWZ
Definition N_pde.h:530
N_gradient_neighbours_z::SZ
double SZ
Definition N_pde.h:530
N_gradient_neighbours_z::CZ
double CZ
Definition N_pde.h:530
N_gradient_neighbours_z::SWZ
double SWZ
Definition N_pde.h:530
N_gradient_neighbours_z::NEZ
double NEZ
Definition N_pde.h:530
N_les_callback_2d
callback structure for 2d matrix assembling
Definition N_pde.h:315
N_les_callback_3d
callback structure for 3d matrix assembling
Definition N_pde.h:308
N_les
The linear equation system (les) structure.
Definition N_pde.h:71
N_les::cols
int cols
Definition N_pde.h:77
N_les::quad
int quad
Definition N_pde.h:78
N_les::rows
int rows
Definition N_pde.h:76
N_les::x
double * x
Definition N_pde.h:72
N_les::A
double ** A
Definition N_pde.h:74
N_les::b
double * b
Definition N_pde.h:73
N_les::type
int type
Definition N_pde.h:79
N_les::Asp
G_math_spvector ** Asp
Definition N_pde.h:75
x
#define x