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/grid/utility/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_;
137 return entityrep_ >= 0;
150 if (entityrep_ < 0) {
165 int i2 = other.index();
166 if (i1 < i2)
return true;
167 if (
orientation() && !other.orientation())
return true;
176 return entityrep_ == other.entityrep_;
187 enum { InvalidIndex = INT_MAX };
212 template <
typename T>
217 typedef std::vector<T> V;
218 typedef typename std::vector<T>::iterator iterator;
219 typedef typename std::vector<T>::const_iterator const_iterator;
231 const T&
get(
int i)
const 233 return V::operator[](i);
247 template <
typename T,
int codim>
275 template <
typename T,
int codim>
288 return e.orientation() ?
301 #endif // OPM_ENTITYREP_HEADER int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:126
Base class for EntityVariable and SignedEntityVariable.
Definition: EntityRep.hpp:213
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:286
bool orientation() const
Returns true if the entity has positive orientation.
Definition: EntityRep.hpp:135
EntityRep opposite() const
Returns an EntityRep with opposite orientation.
Definition: EntityRep.hpp:142
EntityVariableBase()
Default constructor.
Definition: EntityRep.hpp:227
A class design to hold a variable with a value for each entity of the given codimension, where the variable is changing in sign with orientation.
Definition: EntityRep.hpp:276
Holds the implementation of the CpGrid as a pimple.
Definition: OpmParserIncludes.hpp:42
bool operator<(const EntityRep &other) const
Ordering relation used for maps etc.
Definition: EntityRep.hpp:162
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:258
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:105
bool operator==(const EntityRep &other) const
Equality operator.
Definition: EntityRep.hpp:174
SignedEntityVariable()
Default constructor.
Definition: EntityRep.hpp:280
EntityVariable()
Default constructor.
Definition: EntityRep.hpp:252
void setValue(int index_arg, bool orientation_arg)
Set entity value.
Definition: EntityRep.hpp:119
A class design to hold a variable with a value for each entity of the given codimension, where the variable is not changing in sign with orientation.
Definition: EntityRep.hpp:248
Represents an entity of a given codim, with positive or negative orientation.
Definition: CpGridData.hpp:94
void increment()
Increments the entityrep's index() by one.
Definition: EntityRep.hpp:148
bool operator!=(const EntityRep &other) const
Inequality operator.
Definition: EntityRep.hpp:182
EntityRep(int index_arg, bool orientation_arg)
Constructor taking an entity index and an orientation.
Definition: EntityRep.hpp:111
EntityRep()
Default constructor.
Definition: EntityRep.hpp:104