Heidelberg Educational Numerics Library Version 0.27 (from 15 March 2021)
|
Structured Grid for Finite Differences. More...
#include <sgrid.hh>
Public Types | |
enum | { dim = dimension } |
typedef std::size_t | size_type |
Export size type. | |
typedef N | number_type |
Export number type. | |
typedef DF | DomainFunction |
Type of the function defining the domain. | |
Public Member Functions | |
SGrid (const Vector< number_type > extent_, const Vector< size_type > size_, const DomainFunction &df_) | |
Constructor. | |
size_type | getNeighborIndex (const size_type ln, const size_type n_dim, const int n_side, const int k=1) const |
Provides the index of the k-th neighbor of the node with index ln. | |
bool | isBoundaryNode (const size_type ln) const |
Returns true if the node is on the boundary of the discrete compuational domain. | |
size_type | getNumberOfNodes () const |
Returns the number of nodes which are in the compuational domain. | |
Vector< size_type > | getGridSize () const |
Vector< number_type > | getCellWidth () const |
Returns the cell width h of the structured grid. | |
Vector< number_type > | getCoordinates (const size_type ln) const |
Returns the world coordinates of the node with the given node index. | |
std::vector< Vector< number_type > > | getNodeCoordinates () const |
Public Attributes | |
const size_type | invalid_node |
The value which is returned to indicate an invalid node. | |
Static Public Attributes | |
static const int | positive = 1 |
Side definitions for usage in getNeighborIndex(..) | |
static const int | negative = -1 |
Structured Grid for Finite Differences.
N | A continuous type representing coordinate values. |
DF | A boolean function which defines the domain. |
dimension | The grid dimension. |
|
inline |
Constructor.
[in] | extent_ | The extent of the grid domain. The actual computational domain may be smaller and is defined by the domain function df_. |
[in] | size_ | The number of nodes in each grid dimension. |
[in] | df_ | The domain function. It has to provide a boolean function evaluate(Vector<number_type> x) which returns true if the node which is positioned at the coordinates of x is within the computational domain. |
|
inline |
Provides the index of the k-th neighbor of the node with index ln.
[in] | ln | Index of the node whose neighbor is to be determined. |
[in] | n_dim | The axes which connects the node and its neighbor (e.g. n_dim = 0 for a neighbor in the direction of the x-axes |
[in] | n_side | Determines whether the neighbor is in positive of negative direction of the given axes. Should be either SGrid::positive or SGrid::negative . |
[in] | k | For k=1 it will return the direct neighbor. Higher values will give distant nodes in the given direction. If the indicated node is not within the grid any more, then invalid_node will be returned. For k=0 it will simply return ln. |