All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Dune::cpgrid::OrientedEntityTable< codim_from, codim_to > Class Template Reference

Represents the topological relationships between sets of entities, for example cells and faces. More...

#include <OrientedEntityTable.hpp>

Inheritance diagram for Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >:
Opm::SparseTable< EntityRep< codim_to > >

Public Types

typedef EntityRep< codim_from > FromType
 
typedef EntityRep< codim_to > ToType
 
typedef OrientedEntityRange
< codim_to > 
row_type
 
typedef Opm::SparseTable< ToTypesuper_t
 

Public Member Functions

 OrientedEntityTable ()
 Default constructor.
 
template<typename DataIter , typename IntegerIter >
 OrientedEntityTable (DataIter data_beg, DataIter data_end, IntegerIter rowsize_beg, IntegerIter rowsize_end)
 Constructor taking iterators to a sequence of table data and a sequence of row size data. More...
 
int rowSize (const FromType &e) const
 Given an entity e of codimension codim_from, returns the number of neighbours of codimension codim_to. More...
 
row_type operator[] (const FromType &e) const
 Given an entity e of codimension codim_from, returns a row (an indirect container) containing its neighbour entities of codimension codim_to. More...
 
bool operator== (const OrientedEntityTable &other) const
 Elementwise equality. More...
 
void printSparseRelationMatrix (std::ostream &os) const
 Prints the relation matrix corresponding to the table, sparse format. More...
 
void printRelationMatrix (std::ostream &os) const
 Prints the full relation matrix corresponding to the table. More...
 
void makeInverseRelation (OrientedEntityTable< codim_to, codim_from > &inv) const
 Makes the inverse relation, mapping codim_to entities to their codim_from neighbours. More...
 

Friends

class CpGridData
 

Detailed Description

template<int codim_from, int codim_to>
class Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >

Represents the topological relationships between sets of entities, for example cells and faces.

The purpose of this class is to hide the intricacies of handling orientations from the client code, otherwise a straight Opm::SparseTable would do.

Template Parameters
codim_fromCodimension of domain of relation mapping
codim_toCodimension of range of relation mapping

Constructor & Destructor Documentation

template<int codim_from, int codim_to>
template<typename DataIter , typename IntegerIter >
Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::OrientedEntityTable ( DataIter  data_beg,
DataIter  data_end,
IntegerIter  rowsize_beg,
IntegerIter  rowsize_end 
)
inline

Constructor taking iterators to a sequence of table data and a sequence of row size data.

These table data are in the same format as the underlying Opm::SparseTable<int> constructor with the same signature.

Template Parameters
DataIterIterator to table data.
IntegerIterIterator to the row length data.
Parameters
data_begThe start of the table data.
data_endOne-beyond-end of the table data.
rowsize_begThe start of the row length data.
rowsize_endOne beyond the end of the row length data.

Member Function Documentation

template<int codim_from, int codim_to>
void Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::makeInverseRelation ( OrientedEntityTable< codim_to, codim_from > &  inv) const
inline

Makes the inverse relation, mapping codim_to entities to their codim_from neighbours.

Implementation note: The algorithm has been changed to a three-pass O(n) algorithm.

Parameters
invThe OrientedEntityTable
template<int codim_from, int codim_to>
bool Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::operator== ( const OrientedEntityTable< codim_from, codim_to > &  other) const
inline

Elementwise equality.

Parameters
otherThe other element
Returns
Returns true if this and the other element are equal.
template<int codim_from, int codim_to>
row_type Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::operator[] ( const FromType e) const
inline

Given an entity e of codimension codim_from, returns a row (an indirect container) containing its neighbour entities of codimension codim_to.

Parameters
eEntity representation.
Returns
A row of the table.
template<int codim_from, int codim_to>
void Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::printRelationMatrix ( std::ostream &  os) const
inline

Prints the full relation matrix corresponding to the table.

Let the entities of codimensions f and t be given by the sets $E^f = { e^f_i } $ and $E^t = { e^t_j }$. A relation matrix R is defined by

\begin{equation*} R_{ij} = \begin{cases} \phantom{-} 0, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are not neighbours}, \\ \phantom{-} 1, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are neighbours with same orientation}, \\ - 1, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are neighbours with opposite orientation}. \end{cases} \end{equation*}

Warning: this method is suited only for tiny grids, use printSparseRelationMatrix() for other cases.

Parameters
osThe output stream.
template<int codim_from, int codim_to>
void Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::printSparseRelationMatrix ( std::ostream &  os) const
inline

Prints the relation matrix corresponding to the table, sparse format.

Let the entities of codimensions f and t be given by the sets $E^f = { e^f_i } $ and $E^t = { e^t_j }$. A relation matrix R is defined by

\begin{equation*} R_{ij} = \begin{cases} \phantom{-} 0, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are not neighbours}, \\ \phantom{-} 1, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are neighbours with same orientation}, \\ - 1, &\quad \text{if } e_i^f \text{ and } e_j^f \text{ are neighbours with opposite orientation}. \end{cases} \end{equation*}

The output is written one entry to each line, in the format:

row   column    entry (either 1 or -1)

The row and column numbers start from zero, so if using octave or matlab you should add 1 to those columns after loading, before calling spconvert().

Parameters
osThe output stream.
template<int codim_from, int codim_to>
int Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::rowSize ( const FromType e) const
inline

Given an entity e of codimension codim_from, returns the number of neighbours of codimension codim_to.

Parameters
eEntity representation.
Returns
the number of neighbours of codimension codim_to.

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