36#ifndef OPM_ENTITYREP_HEADER
37#define OPM_ENTITYREP_HEADER
49#include <opm/grid/utility/platform_dependent/disable_warnings.h>
50#include <dune/common/fvector.hh>
51#include <opm/grid/utility/platform_dependent/reenable_warnings.h>
55 template<
typename K,
int n>
57 operator- (
const FieldVector<K,n>& v)
63 return FieldVector<K,n>(K(0)) - v;
72#include <opm/common/ErrorMacros.hpp>
101 enum{ codimension=codim};
112 : entityrep_(orientation_arg ? index_arg : ~index_arg)
114 assert(index_arg >= 0);
121 assert(index_arg >= 0);
122 entityrep_ = orientation_arg ? index_arg : ~index_arg;
128 return entityrep_ < 0 ? ~entityrep_ : entityrep_;
142 return entityrep_ >= 0;
155 if (entityrep_ < 0) {
170 int i2 = other.
index();
171 if (i1 < i2)
return true;
181 return entityrep_ == other.entityrep_;
192 enum { InvalidIndex = INT_MAX };
217 template <
typename T>
222 typedef std::vector<T> V;
223 typedef typename std::vector<T>::iterator iterator;
224 typedef typename std::vector<T>::const_iterator const_iterator;
231 using typename V::value_type;
243 const T& get(
int i)
const
245 return V::operator[](i);
250 return V::operator[](i);
265 template <
typename T,
int codim>
300 template <
typename T,
int codim>
Struct that hods all the data needed to represent a Cpgrid.
Definition CpGridData.hpp:131
Represents an entity of a given codim, with positive or negative orientation.
Definition EntityRep.hpp:99
bool operator<(const EntityRep &other) const
Ordering relation used for maps etc.
Definition EntityRep.hpp:167
EntityRep(int index_arg, bool orientation_arg)
Constructor taking an entity index and an orientation.
Definition EntityRep.hpp:111
bool operator!=(const EntityRep &other) const
Inequality operator.
Definition EntityRep.hpp:187
bool orientation() const
Returns true if the entity has positive orientation.
Definition EntityRep.hpp:140
void setValue(int index_arg, bool orientation_arg)
Set entity value.
Definition EntityRep.hpp:119
EntityRep opposite() const
Returns an EntityRep with opposite orientation.
Definition EntityRep.hpp:147
bool operator==(const EntityRep &other) const
Equality operator.
Definition EntityRep.hpp:179
int index() const
The (positive) index of an entity.
Definition EntityRep.hpp:126
EntityRep()
Default constructor.
Definition EntityRep.hpp:104
int signedIndex() const
The signed index that also tells us the orientation.
Definition EntityRep.hpp:132
void increment()
Increments the entityrep's index() by one.
Definition EntityRep.hpp:153
Base class for EntityVariable and SignedEntityVariable.
Definition EntityRep.hpp:219
EntityVariableBase()
Default constructor.
Definition EntityRep.hpp:239
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:267
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:276
T & operator[](const EntityRep< codim > &e)
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:283
EntityVariable()
Default constructor.
Definition EntityRep.hpp:270
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:302
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:311
SignedEntityVariable()
Default constructor.
Definition EntityRep.hpp:305
Copyright 2019 Equinor AS.
Definition CartesianIndexMapper.hpp:10