Utopia  2
Framework for studying models of complex & adaptive systems.
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Utopia::TriangularGrid< Space > Class Template Reference

A grid discretization using triangular cells. More...

#include <triangular.hh>

Inheritance diagram for Utopia::TriangularGrid< Space >:
Inheritance graph
[legend]
Collaboration diagram for Utopia::TriangularGrid< Space >:
Collaboration graph
[legend]

Public Types

using Base = Grid< Space >
 Base class type. More...
 
using SpaceVec = typename Space::SpaceVec
 The type of vectors that have a relation to physical space. More...
 
using MultiIndex = MultiIndexType< dim >
 The type of multi-index like arrays, e.g. the grid shape. More...
 
using Config = DataIO::Config
 The configuration type. More...
 
- Public Types inherited from Utopia::Grid< Space >
using Self = Grid< Space >
 Type of this class, i.e. the base grid class. More...
 
using SpaceVec = typename Space::SpaceVec
 The type of vectors that have a relation to physical space. More...
 
using MultiIndex = MultiIndexType< dim >
 The type of multi-index like arrays, e.g. the grid shape. More...
 
using Config = DataIO::Config
 The configuration type. More...
 

Public Member Functions

 TriangularGrid (std::shared_ptr< Space > space, const Config &cfg)
 Construct a triangular grid discretization. More...
 
IndexType num_cells () const override
 Number of triangular cells required to fill the physical space. More...
 
SpaceVec effective_resolution () const override
 The effective cell resolution into each physical space dimension. More...
 
MultiIndex shape () const override
 Get shape of the triangular grid. More...
 
GridStructure structure () const override
 Structure of the grid. More...
 
MultiIndex midx_of (const IndexType) const override
 Returns the multi index of the cell with the given ID. More...
 
SpaceVec barycenter_of (const IndexType) const override
 Returns the barycenter of the cell with the given ID. More...
 
SpaceVec extent_of (const IndexType) const override
 Returns the extent of the cell with the given ID. More...
 
std::vector< SpaceVecvertices_of (const IndexType) const override
 Returns the vertices of the cell with the given ID. More...
 
IndexType cell_at (const SpaceVec &) const override
 Return the ID of the cell covering the given point in physical space. More...
 
std::set< IndexTypeboundary_cells (std::string={}) const override
 Retrieve a set of cell indices that are at a specified boundary. More...
 
- Public Member Functions inherited from Utopia::Grid< Space >
 Grid (std::shared_ptr< Space > space, const Config &cfg)
 Construct a grid discretization. More...
 
virtual ~Grid ()=default
 Virtual destructor to allow polymorphic destruction. More...
 
IndexContainer neighbors_of (const IndexType id) const
 Returns the indices of the neighbors of the cell with the given ID. More...
 
void select_neighborhood (NBMode nb_mode, const Config &nb_params={})
 
const NBModenb_mode () const
 Const reference to the currently selected neighborhood mode. More...
 
const Confignb_params () const
 The neighborhood parameters of the currently selected neighborhood. More...
 
auto nb_size () const
 Maximum size of the currently selected neighborhood. More...
 
auto resolution () const
 Get scalar resolution value of this grid. More...
 
std::string structure_name () const
 Structure of the grid as std::string. More...
 
const std::shared_ptr< Space > & space () const
 Const reference to the space this grid maps to. More...
 
bool is_periodic () const
 Whether the space this grid maps to is periodic. More...
 

Static Public Attributes

static constexpr DimType dim = Space::dim
 The dimensionality of the space to be discretized (for easier access) More...
 
- Static Public Attributes inherited from Utopia::Grid< Space >
static constexpr DimType dim = Space::dim
 The dimensionality of the space to be discretized (for easier access) More...
 

Protected Member Functions

NBFuncID< Baseget_nb_func (NBMode nb_mode, const Config &) override
 Retrieve the neighborhood function depending on the mode. More...
 
DistType expected_num_neighbors (const NBMode &nb_mode, const Config &) const override
 Computes the expected number of neighbors for a neighborhood mode. More...
 

Additional Inherited Members

- Protected Attributes inherited from Utopia::Grid< Space >
const std::shared_ptr< Space_space
 The space that is to be discretized. More...
 
const DistType _resolution
 How many cells to place per length unit of space. More...
 
NBMode _nb_mode
 Neighborhood mode. More...
 
Config _nb_params
 Neighborhood parameters. More...
 
NBFuncID< Self_nb_func
 Neighborhood function (working on cell IDs) More...
 
NBFuncID< Self_nb_empty
 A neighborhood function for empty neighborhood. More...
 

Detailed Description

template<class Space>
class Utopia::TriangularGrid< Space >

A grid discretization using triangular cells.

Member Typedef Documentation

◆ Base

template<class Space >
using Utopia::TriangularGrid< Space >::Base = Grid<Space>

Base class type.

◆ Config

template<class Space >
using Utopia::TriangularGrid< Space >::Config = DataIO::Config

The configuration type.

◆ MultiIndex

template<class Space >
using Utopia::TriangularGrid< Space >::MultiIndex = MultiIndexType<dim>

The type of multi-index like arrays, e.g. the grid shape.

◆ SpaceVec

template<class Space >
using Utopia::TriangularGrid< Space >::SpaceVec = typename Space::SpaceVec

The type of vectors that have a relation to physical space.

Constructor & Destructor Documentation

◆ TriangularGrid()

template<class Space >
Utopia::TriangularGrid< Space >::TriangularGrid ( std::shared_ptr< Space space,
const Config cfg 
)
inline

Construct a triangular grid discretization.

Parameters
spaceThe space to construct the discretization for
cfgFurther configuration parameters

Member Function Documentation

◆ barycenter_of()

template<class Space >
SpaceVec Utopia::TriangularGrid< Space >::barycenter_of ( const  IndexType) const
inlineoverridevirtual

Returns the barycenter of the cell with the given ID.

Note
This method does not perform bounds checking of the given ID!

Implements Utopia::Grid< Space >.

◆ boundary_cells()

template<class Space >
std::set<IndexType> Utopia::TriangularGrid< Space >::boundary_cells ( std::string  = {}) const
inlineoverridevirtual

Retrieve a set of cell indices that are at a specified boundary.

Note
For a periodic space, an empty container is returned; no error or warning is emitted.
Parameters
selectWhich boundary to return the cell IDs of. If 'all', all boundary cells are returned. Other available values depend on the dimensionality of the grid: 1D: left, right 2D: bottom, top 3D: back, front

Implements Utopia::Grid< Space >.

◆ cell_at()

template<class Space >
IndexType Utopia::TriangularGrid< Space >::cell_at ( const SpaceVec ) const
inlineoverridevirtual

Return the ID of the cell covering the given point in physical space.

Cells are interpreted as covering half-open intervals in space, i.e., including their low-value edges and excluding their high-value edges. The special case of points on high-value edges for non-periodic space behaves such that these points are associated with the cells at the boundary.

Note
This function always returns IDs of cells that are inside physical space. For non-periodic space, a check is performed whether the given point is inside the physical space associated with this grid. For periodic space, the given position is mapped back into the physical space.

Implements Utopia::Grid< Space >.

◆ effective_resolution()

template<class Space >
SpaceVec Utopia::TriangularGrid< Space >::effective_resolution ( ) const
inlineoverridevirtual

The effective cell resolution into each physical space dimension.

Implements Utopia::Grid< Space >.

◆ expected_num_neighbors()

template<class Space >
DistType Utopia::TriangularGrid< Space >::expected_num_neighbors ( const NBMode nb_mode,
const Config  
) const
inlineoverrideprotectedvirtual

Computes the expected number of neighbors for a neighborhood mode.

Implements Utopia::Grid< Space >.

◆ extent_of()

template<class Space >
SpaceVec Utopia::TriangularGrid< Space >::extent_of ( const  IndexType) const
inlineoverridevirtual

Returns the extent of the cell with the given ID.

Note
This method does not perform bounds checking of the given ID!

Implements Utopia::Grid< Space >.

◆ get_nb_func()

template<class Space >
NBFuncID<Base> Utopia::TriangularGrid< Space >::get_nb_func ( NBMode  nb_mode,
const Config  
)
inlineoverrideprotectedvirtual

Retrieve the neighborhood function depending on the mode.

Implements Utopia::Grid< Space >.

◆ midx_of()

template<class Space >
MultiIndex Utopia::TriangularGrid< Space >::midx_of ( const  IndexType) const
inlineoverridevirtual

Returns the multi index of the cell with the given ID.

Note
This method does not perform bounds checking of the given ID!

Implements Utopia::Grid< Space >.

◆ num_cells()

template<class Space >
IndexType Utopia::TriangularGrid< Space >::num_cells ( ) const
inlineoverridevirtual

Number of triangular cells required to fill the physical space.

Implements Utopia::Grid< Space >.

◆ shape()

template<class Space >
MultiIndex Utopia::TriangularGrid< Space >::shape ( ) const
inlineoverridevirtual

Get shape of the triangular grid.

Implements Utopia::Grid< Space >.

◆ structure()

template<class Space >
GridStructure Utopia::TriangularGrid< Space >::structure ( ) const
inlineoverridevirtual

Structure of the grid.

Implements Utopia::Grid< Space >.

◆ vertices_of()

template<class Space >
std::vector<SpaceVec> Utopia::TriangularGrid< Space >::vertices_of ( const  IndexType) const
inlineoverridevirtual

Returns the vertices of the cell with the given ID.

Warning
The order of the vertices is not guaranteed.
Note
This method does not perform bounds checking of the given ID!

Implements Utopia::Grid< Space >.

Member Data Documentation

◆ dim

template<class Space >
constexpr DimType Utopia::TriangularGrid< Space >::dim = Space::dim
staticconstexpr

The dimensionality of the space to be discretized (for easier access)


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