Heidelberg Educational Numerics Library Version 0.27 (from 15 March 2021)
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
hdnum::SGrid< N, DF, dimension > Class Template Reference

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_typegetGridSize () const
 
Vector< number_typegetCellWidth () const
 Returns the cell width h of the structured grid.
 
Vector< number_typegetCoordinates (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
 

Detailed Description

template<class N, class DF, int dimension>
class hdnum::SGrid< N, DF, dimension >

Structured Grid for Finite Differences.

Template Parameters
NA continuous type representing coordinate values.
DFA boolean function which defines the domain.
dimensionThe grid dimension.

Constructor & Destructor Documentation

◆ SGrid()

template<class N , class DF , int dimension>
hdnum::SGrid< N, DF, dimension >::SGrid ( const Vector< number_type > extent_,
const Vector< size_type > size_,
const DomainFunction & df_ )
inline

Constructor.

Parameters
[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.

Member Function Documentation

◆ getNeighborIndex()

template<class N , class DF , int dimension>
size_type hdnum::SGrid< N, DF, dimension >::getNeighborIndex ( const size_type ln,
const size_type n_dim,
const int n_side,
const int k = 1 ) const
inline

Provides the index of the k-th neighbor of the node with index ln.

Parameters
[in]lnIndex of the node whose neighbor is to be determined.
[in]n_dimThe 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_sideDetermines whether the neighbor is in positive of negative direction of the given axes. Should be either SGrid::positive or SGrid::negative .
[in]kFor 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.
Returns
size_type The index of the neighbor node.

The documentation for this class was generated from the following file: