1#ifndef DUNE_SPGRID_ENTITYINFO_HH
2#define DUNE_SPGRID_ENTITYINFO_HH
8#include <dune/grid/common/gridenums.hh>
10#include <dune/grid/spgrid/direction.hh>
11#include <dune/grid/spgrid/gridlevel.hh>
22 template<
class Gr
id,
int codim >
25 typedef EntityInfo< Grid, codim > This;
28 typedef SPGridLevel< typename std::remove_const< Grid >::type > GridLevel;
30 static const int dimension = GridLevel::dimension;
31 static const int codimension = codim;
32 static const int mydimension = dimension - codimension;
35 typedef SPEntityDirection< dimension, mydimension > EntityDirection;
38 typedef typename EntityDirection::Direction Direction;
40 typedef typename GridLevel::MultiIndex MultiIndex;
41 typedef typename GridLevel::GlobalVector GlobalVector;
43 typedef typename GridLevel::Traits Traits;
45 typedef typename GridLevel::template Codim< codimension >::GeometryCache GeometryCache;
48 : gridLevel_( nullptr ),
49 partitionNumber_(
std::numeric_limits< unsigned int >::
max() )
52 EntityInfo (
const GridLevel &gridLevel )
53 : gridLevel_( &gridLevel ),
54 partitionNumber_(
std::numeric_limits< unsigned int >::
max() )
57 EntityInfo (
const GridLevel &gridLevel,
const MultiIndex &
id,
unsigned int partitionNumber )
58 : gridLevel_( &gridLevel ),
61 partitionNumber_( partitionNumber )
66 const GridLevel &gridLevel ()
const { assert( gridLevel_ );
return *gridLevel_; }
68 const MultiIndex &id ()
const {
return id_; }
69 MultiIndex &id () {
return id_; }
71 Direction direction ()
const {
return direction_; }
73 unsigned int partitionNumber ()
const {
return partitionNumber_; }
77 bool equals (
const This &other )
const
79 return (gridLevel_ == other.gridLevel_) && (id() == other.id());
84 return gridLevel().template partitionType< codimension >(
id(), partitionNumber() );
87 const GeometryCache &geometryCache ()
const
89 return gridLevel().template geometryCache< codimension >( direction() );
94 bool hasFather ()
const
96 return ((codim == 0) || gridLevel().refinement().hasFather(
id() ));
101 const Grid &grid = gridLevel().grid();
102 const int level = gridLevel().level();
103 gridLevel().refinement().father(
id() );
104 gridLevel_ = &grid.gridLevel( level-1 );
109 const Grid &grid = gridLevel().grid();
110 const int level = gridLevel().level();
111 gridLevel_ = &grid.gridLevel( level+1 );
112 gridLevel().refinement().firstChild(
id() );
117 return gridLevel().refinement().nextChild(
id() );
125 assert( gridLevel().
template partition< All_Partition >().contains(
id(), partitionNumber() ) );
126 direction_ = EntityDirection(
id() );
129 void update (
unsigned int partitionNumber )
131 partitionNumber_ = partitionNumber;
136 const GridLevel *gridLevel_;
138 EntityDirection direction_;
139 unsigned int partitionNumber_;
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition: hybridutilities.hh:402
auto max(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::max()
Definition: defaults.hh:81
Dune namespace.
Definition: alignedallocator.hh:13