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;
172 if (
orientation() && !other.orientation())
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);
255 V::swap(
static_cast<V&
>(other));
270 template <
typename T,
int codim>
305 template <
typename T,
int codim>
318 return e.orientation() ?
Struct that hods all the data needed to represent a Cpgrid.
Definition CpGridData.hpp:147
Represents an entity of a given codim, with positive or negative orientation.
Definition PartitionTypeIndicator.hpp:47
EntityRep()
Default constructor.
Definition EntityRep.hpp:104
bool orientation() const
Returns true if the entity has positive orientation.
Definition EntityRep.hpp:140
int signedIndex() const
The signed index that also tells us the orientation.
Definition EntityRep.hpp:132
bool operator!=(const EntityRep &other) const
Inequality operator.
Definition EntityRep.hpp:187
bool operator<(const EntityRep &other) const
Ordering relation used for maps etc.
Definition EntityRep.hpp:167
bool operator==(const EntityRep &other) const
Equality operator.
Definition EntityRep.hpp:179
void setValue(int index_arg, bool orientation_arg)
Set entity value.
Definition EntityRep.hpp:119
EntityRep(int index_arg, bool orientation_arg)
Constructor taking an entity index and an orientation.
Definition EntityRep.hpp:111
EntityRep opposite() const
Returns an EntityRep with opposite orientation.
Definition EntityRep.hpp:147
int index() const
The (positive) index of an entity.
Definition EntityRep.hpp:126
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:272
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:281
T & operator[](const EntityRep< codim > &e)
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:288
EntityVariable()
Default constructor.
Definition EntityRep.hpp:275
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:307
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:316
SignedEntityVariable()
Default constructor.
Definition EntityRep.hpp:310
Copyright 2019 Equinor AS.
Definition CartesianIndexMapper.hpp:10