#include "utils.h"
#include "except.hh"
Go to the source code of this file.
Classes | |
struct | s_axis |
Axis: Basic Metadata element for regular grids. More... | |
struct | grid |
Regular grid struct. More... | |
Defines | |
#define | TOL 100.0*REAL_EPS |
#define | EXTINT 100 |
Typedefs | |
typedef s_axis | axis |
Axis: Basic Metadata element for regular grids. | |
Functions | |
void | init_default_axis (axis *a) |
default constructor. | |
void | init_axis (axis *a, size_t n, ireal d, ireal o) |
main constructor - not terribly useful. | |
void | copy_axis (axis *tgt, const axis *src) |
deep copy function | |
void | print_axis (axis a) |
print axis to stdout | |
void | fprint_axis (FILE *fp, axis a) |
print axis to stream | |
void | fprint_num_axis (FILE *fp, int i, axis a) |
int | compare_axis (axis a1, axis a2) |
compare two axes for equality | |
void | init_default_grid (grid *g) |
default constructor. | |
int | init_grid (grid *g, int dim, int gdim) |
main constructor. | |
void | copy_grid (grid *tgt, const grid *src) |
deep copy | |
void | print_grid (grid a) |
print grid to stdout | |
void | fprint_grid (FILE *fp, grid a) |
print grid to stream | |
int | compare_grid (const grid g1, const grid g2) |
compare two grids by comparing their axes | |
int | compatible_grid (const grid g1, const grid g2) |
decide if two grids are compatible, that is, define sublattices of a common parent lattice | |
int | get_dimension_grid (grid g) |
return effective (physical plus internal extended) grid dimension | |
int | get_datasize_grid (grid g) |
get number of physical gridpoints (product of n's) | |
int | get_extended_datasize_grid (grid g) |
get number of physical and internal extended gridpoints (product of n's) | |
size_t | get_global_datasize_grid (grid g) |
get total number of gridpoints (product of n's) | |
ireal | get_cellvol_grid (grid g) |
returns (physical, non-extended) cell vol | |
ireal | get_extended_cellvol_grid (grid g) |
returns physical + internal extended cell vol | |
ireal | get_global_cellvol_grid (grid g) |
returns global (all axes) cell vol | |
int | get_panelnum_grid (grid g) |
get total number of records = physical (+ internal ext'd) grids within global grid (product of n's) | |
void | get_n (IPNT n, grid g) |
get axis length array | |
void | get_d (_RPNT d, grid g) |
get step array | |
void | get_o (_RPNT o, grid g) |
get grid origin coordinate array | |
void | get_gs (IPNT gs, grid g) |
get array of indices of grid origin in global grid | |
void | get_ge (IPNT ge, grid g) |
get array of indices of grid origin in global grid | |
void | get_id (IPNT id, grid g) |
get array of axis ids as function of axis index - next function inverts this relation | |
void | get_ord (IPNT a, grid g) |
returns axis order array, i.e. | |
bool | grid_union (grid *g, axis const *ax) |
convex hull operation. | |
bool | init_step (grid g, IPNT step, bool fwd) |
initializes steps through the non-spatial axes of a grid. | |
bool | next_step (grid g, IPNT step) |
increments index array for next step in simulation - time axis first, then other non-spatial axes in order. |
Axis: Basic Metadata element for regular grids.
Defines a uniformly sampled axis, after the fashion of SEPlib77 or RSF. Struct part of RVLGrid Axis class.
Innovative feature: each axis carries an integer token (axis.id) meant to signify its position in a global ordering of axes (hence its physical meaning)..
void init_default_axis | ( | axis * | a | ) |
default constructor.
Default values: n=1, d=1.0, o=0.0, id=1
[out] | a | (axis *) - axis to be initialized |
main constructor - not terribly useful.
id defaults to 1.
[out] | a | (axis *) - axis to be initialized |
[in] | n | (int) - number of gridpoints on axis |
[in] | d | (ireal) - step |
[in] | o | (ireal) - coord of first data point |
deep copy function
[out] | tgt | - target axis |
[in] | src | - source axis |
void print_axis | ( | axis | a | ) |
print axis to stdout
[in] | a | (axis) - axis to be printed |
void fprint_axis | ( | FILE * | fp, | |
axis | a | |||
) |
print axis to stream
[in] | fp | (FILE *) - output stream f |
[in] | a | (axis) - axis to be printed |
void fprint_num_axis | ( | FILE * | fp, | |
int | i, | |||
axis | a | |||
) |
compare two axes for equality
[in] | a1 | (axis) - first axis |
[in] | a2 | (axis) - second axis |
void init_default_grid | ( | grid * | g | ) |
default constructor.
[out] | g | (grid *) - grid to be initialized |
int init_grid | ( | grid * | g, | |
int | dim, | |||
int | gdim | |||
) |
main constructor.
initializes metadata (dim) but not data (axes). Since no dynamic allocation takes place, only real role is to sanity-check dim.
[out] | g | (grid *) - grid to be initialized |
[in] | dim | (int) - dimension of grid, at most RARR_MAX_NDIM |
deep copy
[out] | tgt | - target grid |
[in] | src | - source grid |
void print_grid | ( | grid | a | ) |
print grid to stdout
[in] | a | (grid) - grid to be printed |
void fprint_grid | ( | FILE * | fp, | |
grid | a | |||
) |
print grid to stream
[in] | a | (grid) - grid to be printed |
[in] | fp | (FILE *) - stream to which to print |
compare two grids by comparing their axes
decide if two grids are compatible, that is, define sublattices of a common parent lattice
int get_dimension_grid | ( | grid | g | ) |
return effective (physical plus internal extended) grid dimension
int get_datasize_grid | ( | grid | g | ) |
get number of physical gridpoints (product of n's)
int get_extended_datasize_grid | ( | grid | g | ) |
get number of physical and internal extended gridpoints (product of n's)
size_t get_global_datasize_grid | ( | grid | g | ) |
get total number of gridpoints (product of n's)
int get_panelnum_grid | ( | grid | g | ) |
get total number of records = physical (+ internal ext'd) grids within global grid (product of n's)
get grid origin coordinate array
[out] | o | (RPNT) - grid origin |
get array of indices of grid origin in global grid
[out] | gs | (IPNT) - global indices of grid origin |
get array of indices of grid origin in global grid
[out] | gs | (IPNT) - global indices of grid origin |
get array of axis ids as function of axis index - next function inverts this relation
returns axis order array, i.e.
axis index as a function of id, rather than id as a function of axis index (which is stored).
[out] | a | (IPNT) - axis order array |
convex hull operation.
Loops through axis vector input. If axis has new id, then added to grid. If axis id same as existing, then axis enlarged convex hull of existing and new axis. Axes must be commensurable.
initializes steps through the non-spatial axes of a grid.
Assumption is that time is the first axis, so should be reversed for adjoint stepping.
increments index array for next step in simulation - time axis first, then other non-spatial axes in order.
Time axis decremented for adjoint case. Returns true until no more steps are possible (including along non-time axes), then false.