Peano
Loading...
Searching...
No Matches
FaceEnumerator.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5
7#include "tarch/Assertions.h"
8
9
10namespace peano4 {
11 namespace datamanagement {
12 template <class Face>
13 class FaceEnumerator;
14 }
15}
16
17
37template <class Face>
39 private:
40 Face* _faces[ TwoTimesD ];
41
42 public:
48 #if PeanoDebug>0
49 for (int i=0; i<TwoTimesD; i++) {
50 _faces[i] = nullptr;
51 }
52 #endif
53 }
54
55
60 FaceEnumerator(Face* firstFace) {
61 assertion(firstFace!=nullptr);
62 for (int i=0; i<TwoTimesD; i++) {
63 _faces[i] = firstFace+i;
64 }
65 }
66
71 void setPointer(int i, Face* value) {
72 assertion(i>=0);
74 assertion(value!=nullptr);
75 _faces[i] = value;
76 }
77
81 Face& operator()(int i) const {
82 assertion1(i>=0,i);
84 assertion1( _faces[i]!=nullptr,i );
85 return *(_faces[i]);
86 }
87};
88
#define assertion1(expr, param)
#define assertion(expr)
#define TwoTimesD
Definition Globals.h:30
Enumerator over an array of faces.
FaceEnumerator()
Usually is only used by the observers, i.e.
Face & operator()(int i) const
Get a certain face.
FaceEnumerator(Face *firstFace)
Face enumerator with standard ordering of faces within a consecutive array.
void setPointer(int i, Face *value)
Usually is only used by the observers, i.e.