36 #ifndef OPM_INDEXSETS_HEADER 37 #define OPM_INDEXSETS_HEADER 39 #include <dune/geometry/type.hh> 40 #include <opm/grid/utility/ErrorMacros.hpp> 41 #include "GlobalIdMapping.hpp" 42 #include "Intersection.hpp" 61 typedef std::vector<GeometryType>
Types;
71 geom_types_[0].push_back(t);
73 geom_types_[3].push_back(t);
86 return geom_types_[codim];
95 return geom_types_[codim];
102 int size(GeometryType type)
const 104 return grid_.
size(type);
114 return grid_.
size(codim);
134 template<
class EntityType>
148 return index(e.template subEntity<cc>(i));
163 default: OPM_THROW(std::runtime_error,
"Codimension " << cc <<
" not supported.");
172 DUNE_THROW(NotImplemented,
"subIndex not implemented for codim" 173 << codim <<
"entities.");
180 template <
class EntityType>
183 return index(e) >= 0 &&
index(e) < grid_.
size(EntityType::codimension);
188 Types geom_types_[4];
208 template<
class EntityType>
209 IdType id(
const EntityType& e)
const 217 return intersection.id();
223 return id(e.template subEntity<cc>(i));
233 default: OPM_THROW(std::runtime_error,
"Cannot get subId of codimension " << cc);
238 template<
class EntityType>
239 IdType computeId(
const EntityType& e)
const 242 for(
int c=0; c<EntityType::codimension; ++c )
244 return myId + e.index();
246 const CpGridData& grid_;
256 void swap(std::vector<int>& cellMapping,
257 std::vector<int>& faceMapping,
258 std::vector<int>& pointMapping)
271 template<
class EntityType>
272 IdType id(
const EntityType& e)
const 275 return idSet_->id(e);
277 return this->
template getMapping<EntityType::codimension>()[e.index()];
283 return id(e.template subEntity<cc>(i));
293 default: OPM_THROW(std::runtime_error,
"Cannot get subId of codimension " << cc);
305 #endif // OPM_INDEXSETS_HEADER Definition: CpGridData.hpp:93
int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:126
const IndexSet & indexSet() const
Get the index set.
Definition: CpGridData.hpp:233
int size(int codim) const
Definition: Indexsets.hpp:112
int IndexType
Definition: Indexsets.hpp:57
Holds the implementation of the CpGrid as a pimple.
Definition: OpmParserIncludes.hpp:42
Definition: Indexsets.hpp:192
Definition: Intersection.hpp:67
std::vector< GeometryType > Types
Definition: Indexsets.hpp:61
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:105
void swap(std::vector< int > &cellMapping, std::vector< int > &faceMapping, std::vector< int > &pointMapping)
Swap data for initialization.
Definition: GlobalIdMapping.hpp:38
IndexType subIndex(const cpgrid::Entity< 0 > &e, int i) const
Definition: Indexsets.hpp:146
const Types & geomTypes(int codim) const
Definition: Indexsets.hpp:84
IdType id(const cpgrid::Intersection &intersection) const
return id of intersection (here face number)
Definition: Indexsets.hpp:215
int size(GeometryType type) const
Definition: Indexsets.hpp:102
IndexSet(const CpGridData &grid)
Definition: Indexsets.hpp:66
Class managing the mappings of local indices to global ids.
Definition: GlobalIdMapping.hpp:30
IndexType index(const EntityType &e) const
Definition: Indexsets.hpp:135
const Types & types(int codim) const
Definition: Indexsets.hpp:93
int size(int codim) const
number of leaf entities per codim in this process
Definition: CpGridData.cpp:132
IndexType subIndex(const cpgrid::Entity< 0 > &e, int i, unsigned int cc) const
Definition: Indexsets.hpp:156
Definition: Indexsets.hpp:250
IndexType index(const cpgrid::Entity< cd > &e) const
Definition: Indexsets.hpp:124
Definition: Indexsets.hpp:52
bool contains(const EntityType &e) const
Definition: Indexsets.hpp:181
Codim< cc >::EntityPointer subEntity(int i) const
Obtain subentity.
~IndexSet()
Destructor.
Definition: Indexsets.hpp:77