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;
171 if (
orientation() && !other.orientation())
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;
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>
304 template <
typename T,
int codim>
317 return e.orientation() ?
330 #endif // OPM_ENTITYREP_HEADER int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:125
Base class for EntityVariable and SignedEntityVariable.
Definition: EntityRep.hpp:217
const T operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:315
bool orientation() const
Returns true if the entity has positive orientation.
Definition: EntityRep.hpp:139
EntityRep opposite() const
Returns an EntityRep with opposite orientation.
Definition: EntityRep.hpp:146
EntityVariableBase()
Default constructor.
Definition: EntityRep.hpp:238
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:305
The namespace Dune is the main namespace for all Dune code.
Definition: CartesianIndexMapper.hpp:9
bool operator<(const EntityRep &other) const
Ordering relation used for maps etc.
Definition: EntityRep.hpp:166
const T & operator[](const EntityRep< codim > &e) const
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:280
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:117
bool operator==(const EntityRep &other) const
Equality operator.
Definition: EntityRep.hpp:178
SignedEntityVariable()
Default constructor.
Definition: EntityRep.hpp:309
EntityVariable()
Default constructor.
Definition: EntityRep.hpp:274
void setValue(int index_arg, bool orientation_arg)
Set entity value.
Definition: EntityRep.hpp:118
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:270
Represents an entity of a given codim, with positive or negative orientation.
Definition: CpGridData.hpp:96
void increment()
Increments the entityrep's index() by one.
Definition: EntityRep.hpp:152
int signedIndex() const
The signed index that also tells us the orientation.
Definition: EntityRep.hpp:131
bool operator!=(const EntityRep &other) const
Inequality operator.
Definition: EntityRep.hpp:186
EntityRep(int index_arg, bool orientation_arg)
Constructor taking an entity index and an orientation.
Definition: EntityRep.hpp:110
EntityRep()
Default constructor.
Definition: EntityRep.hpp:103
T & operator[](const EntityRep< codim > &e)
Random access to the variable through an EntityRep.
Definition: EntityRep.hpp:287