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;
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>
219 friend class CpGridData;
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;
242 const T& get(
int i)
const
244 return V::operator[](i);
249 return V::operator[](i);
254 V::swap(
static_cast<V&
>(other));
269 template <
typename T,
int codim>
282 return EntityVariableBase<T>::get(e.
index());
289 return EntityVariableBase<T>::get(e.
index());
304 template <
typename T,
int codim>
318 EntityVariableBase<T>::get(e.
index()) :
319 -EntityVariableBase<T>::get(e.
index());
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
EntityVariableBase()
Default constructor.
Definition EntityRep.hpp:238
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:280
T & operator[](const EntityRep< codim > &e)
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:287
EntityVariable()
Default constructor.
Definition EntityRep.hpp:274
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition EntityRep.hpp:315
SignedEntityVariable()
Default constructor.
Definition EntityRep.hpp:309
Copyright 2019 Equinor AS.
Definition GridPartitioning.cpp:673
The namespace Dune is the main namespace for all Dune code.
Definition CartesianIndexMapper.hpp:10