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 >:
Inheritance graph

Public Types

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

Public Member Functions

 OrientedEntityTable ()
 Default constructor. More...
 
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...
 
mutable_row_type row (const FromType &e)
 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...
 
bool empty () const
 True if the table contains no rows. More...
 
int size () const
 Returns the number of rows in the table. More...
 
int dataSize () const
 Returns the number of data elements. More...
 
void clear ()
 Makes the table empty(). More...
 
template<typename DataIter >
void appendRow (DataIter row_beg, DataIter row_end)
 Appends a row to the table. More...
 
template<typename IntegerIter >
void allocate (IntegerIter rowsize_beg, IntegerIter rowsize_end)
 

Private Member Functions

int rowSize (int row) const
 Returns the size of a table row. More...
 
row_type operator[] (int row) const
 Returns a row of the table. More...
 
mutable_row_type operator[] (int row)
 Returns a mutable row of the table. More...
 
bool operator== (const SparseTable &other) const
 Equality. 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

Member Typedef Documentation

◆ FromType

template<int codim_from, int codim_to>
typedef EntityRep<codim_from> Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::FromType

◆ mutable_row_type

template<int codim_from, int codim_to>
typedef super_t::mutable_row_type Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::mutable_row_type

◆ row_type

template<int codim_from, int codim_to>
typedef OrientedEntityRange<codim_to> Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::row_type

◆ super_t

template<int codim_from, int codim_to>
typedef Opm::SparseTable<ToType> Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::super_t

◆ ToType

template<int codim_from, int codim_to>
typedef EntityRep<codim_to> Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::ToType

Constructor & Destructor Documentation

◆ OrientedEntityTable() [1/2]

template<int codim_from, int codim_to>
Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::OrientedEntityTable ( )
inline

Default constructor.

◆ OrientedEntityTable() [2/2]

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

◆ allocate()

template<int codim_from, int codim_to>
template<typename IntegerIter >
void Opm::SparseTable< T >::allocate ( IntegerIter  rowsize_beg,
IntegerIter  rowsize_end 
)
inline

Request storage for table of given size.

Parameters
rowsize_begStart of row size data.
rowsize_endOne beyond end of row size data.

◆ appendRow()

template<int codim_from, int codim_to>
template<typename DataIter >
void Opm::SparseTable< T >::appendRow ( DataIter  row_beg,
DataIter  row_end 
)
inline

Appends a row to the table.

Referenced by Dune::cpgrid::Geometry< 3, cdim >::refineCellifiedPatch().

◆ clear()

template<int codim_from, int codim_to>
void Opm::SparseTable< T >::clear ( )
inline

Makes the table empty().

◆ dataSize()

template<int codim_from, int codim_to>
int Opm::SparseTable< T >::dataSize ( ) const
inline

Returns the number of data elements.

◆ empty()

template<int codim_from, int codim_to>
bool Opm::SparseTable< T >::empty ( ) const
inline

True if the table contains no rows.

◆ makeInverseRelation()

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

◆ operator==()

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.

References Opm::SparseTable< T >::operator==().

◆ operator[]()

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.

References Dune::cpgrid::EntityRep< codim >::index(), and Dune::cpgrid::EntityRep< codim >::orientation().

Referenced by Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::makeInverseRelation(), Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::printRelationMatrix(), and Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::printSparseRelationMatrix().

◆ printRelationMatrix()

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.

References Dune::cpgrid::EntityRep< codim >::index(), Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::operator[](), Dune::cpgrid::EntityRep< codim >::orientation(), Dune::cpgrid::OrientedEntityRange< codim_to >::size(), and Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::size().

◆ printSparseRelationMatrix()

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.

References Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::operator[](), Dune::cpgrid::OrientedEntityRange< codim_to >::size(), and Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::size().

◆ row()

template<int codim_from, int codim_to>
mutable_row_type Dune::cpgrid::OrientedEntityTable< codim_from, codim_to >::row ( const FromType e)
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.

References Dune::cpgrid::EntityRep< codim >::index(), and Opm::SparseTable< T >::operator[]().

◆ rowSize()

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.

References Dune::cpgrid::EntityRep< codim >::index(), and Opm::SparseTable< T >::rowSize().

◆ size()

Friends And Related Function Documentation

◆ CpGridData

template<int codim_from, int codim_to>
friend class CpGridData
friend

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