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>
100 enum{ codimension=codim};
111 : entityrep_(orientation_arg ? index_arg : ~index_arg)
113 assert(index_arg >= 0);
120 assert(index_arg >= 0);
121 entityrep_ = orientation_arg ? index_arg : ~index_arg;
127 return entityrep_ < 0 ? ~entityrep_ : entityrep_;
141 return entityrep_ >= 0;
154 if (entityrep_ < 0) {
169 int i2 = other.
index();
170 if (i1 < i2)
return true;
180 return entityrep_ == other.entityrep_;
191 enum { InvalidIndex = INT_MAX };
216 template <
typename T>
221 typedef std::vector<T> V;
222 typedef typename std::vector<T>::iterator iterator;
223 typedef typename std::vector<T>::const_iterator const_iterator;
230 using typename V::value_type;
240 const T& get(
int i)
const
242 return V::operator[](i);
247 return V::operator[](i);
262 template <
typename T,
int codim>
297 template <
typename T,
int codim>
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:123
Represents an entity of a given codim, with positive or negative orientation.
Definition: EntityRep.hpp:98
bool operator<(const EntityRep &other) const
Ordering relation used for maps etc.
Definition: EntityRep.hpp:166
EntityRep(int index_arg, bool orientation_arg)
Constructor taking an entity index and an orientation.
Definition: EntityRep.hpp:110
bool operator!=(const EntityRep &other) const
Inequality operator.
Definition: EntityRep.hpp:186
bool orientation() const
Returns true if the entity has positive orientation.
Definition: EntityRep.hpp:139
void setValue(int index_arg, bool orientation_arg)
Set entity value.
Definition: EntityRep.hpp:118
EntityRep opposite() const
Returns an EntityRep with opposite orientation.
Definition: EntityRep.hpp:146
bool operator==(const EntityRep &other) const
Equality operator.
Definition: EntityRep.hpp:178
int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:125
EntityRep()
Default constructor.
Definition: EntityRep.hpp:103
int signedIndex() const
The signed index that also tells us the orientation.
Definition: EntityRep.hpp:131
void increment()
Increments the entityrep's index() by one.
Definition: EntityRep.hpp:152
Base class for EntityVariable and SignedEntityVariable.
Definition: EntityRep.hpp:218
EntityVariableBase()
Default constructor.
Definition: EntityRep.hpp:236
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:264
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:273
T & operator[](const EntityRep< codim > &e)
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:280
EntityVariable()
Default constructor.
Definition: EntityRep.hpp:267
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:299
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:308
SignedEntityVariable()
Default constructor.
Definition: EntityRep.hpp:302
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10