53 |
//! Pointers on vertices of the cell |
//! Pointers on vertices of the cell |
54 |
Vertex** __vertices; |
Vertex** __vertices; |
55 |
|
|
56 |
|
//! indicates if the cell is to be taken into accounts for computations |
57 |
|
bool __isFictitious; |
58 |
|
|
59 |
public: |
public: |
60 |
//! Returns the value of the volume. (read only) |
|
61 |
inline const real_t volume() const |
/** |
62 |
|
* Read-only access to the volume of the cell |
63 |
|
* |
64 |
|
* @return the volume |
65 |
|
*/ |
66 |
|
inline const real_t& volume() const |
67 |
{ |
{ |
68 |
return __volume; |
return __volume; |
69 |
} |
} |
70 |
|
|
71 |
/** |
/** |
72 |
* Replaces |
* Replaces a vertex by another |
73 |
* |
* |
74 |
* @param v0 |
* @param v0 the vertex to replace |
75 |
* @param v1 |
* @param v1 the new vertex |
76 |
*/ |
*/ |
77 |
inline void replace(Vertex* v0, Vertex* v1) |
inline void replace(Vertex* v0, Vertex* v1) |
78 |
{ |
{ |
87 |
std::exit(1); |
std::exit(1); |
88 |
} |
} |
89 |
|
|
90 |
//! Number of Vertices. |
/** |
91 |
virtual const size_t numberOfVertices() const = 0; |
* Read-only access to the fictitious state of the cell |
92 |
|
* |
93 |
|
* @return true if the cell is fictitious |
94 |
|
*/ |
95 |
|
const bool& isFictitious() const |
96 |
|
{ |
97 |
|
return __isFictitious; |
98 |
|
} |
99 |
|
|
100 |
//! Number of Vertices. |
/** |
101 |
virtual const Cell::Type type() const = 0; |
* Access to the fictitious state of the cell |
102 |
|
* |
103 |
|
* @return the fictitious state |
104 |
|
*/ |
105 |
|
bool& isFictitious() |
106 |
|
{ |
107 |
|
return __isFictitious; |
108 |
|
} |
109 |
|
|
110 |
//! Read-only access to the reference of the Cell. |
/** |
111 |
|
* Read-only ccess to the number of vertices |
112 |
|
* |
113 |
|
* @return the number of vertices |
114 |
|
*/ |
115 |
|
virtual size_t numberOfVertices() const = 0; |
116 |
|
|
117 |
|
/** |
118 |
|
* Access to the type of the cell |
119 |
|
* |
120 |
|
* @return the cell type |
121 |
|
*/ |
122 |
|
virtual Cell::Type type() const = 0; |
123 |
|
|
124 |
|
/** |
125 |
|
* Read-only access to the reference of the Cell. |
126 |
|
* |
127 |
|
* @return a const reference to the reference |
128 |
|
*/ |
129 |
inline const size_t& reference() const |
inline const size_t& reference() const |
130 |
{ |
{ |
131 |
return __reference; |
return __reference; |
132 |
} |
} |
133 |
|
|
134 |
//! Access to the reference of the Cell. |
/** |
135 |
|
* Access to the reference of the Cell. |
136 |
|
* |
137 |
|
* @return a reference to the reference |
138 |
|
*/ |
139 |
inline size_t& reference() |
inline size_t& reference() |
140 |
{ |
{ |
141 |
return __reference; |
return __reference; |
142 |
} |
} |
143 |
|
|
144 |
//! Access to the ith Vertex of the Cell. |
/** |
145 |
|
* Access to the ith Vertex of the Cell. |
146 |
|
* |
147 |
|
* @param the local number of the vertex |
148 |
|
* |
149 |
|
* @return a reference to a the vertex |
150 |
|
*/ |
151 |
inline Vertex& operator () (const size_t& i) |
inline Vertex& operator () (const size_t& i) |
152 |
{ |
{ |
153 |
assert (i<numberOfVertices()); |
assert (i<numberOfVertices()); |
154 |
return *__vertices[i]; |
return *__vertices[i]; |
155 |
} |
} |
156 |
|
|
157 |
//! Read-only access to the ith Vertex of the Cell. |
/** |
158 |
|
* Read-only access to the ith Vertex of the Cell. |
159 |
|
* |
160 |
|
* @param the local number of the vertex |
161 |
|
* |
162 |
|
* @return a const reference to a the vertex |
163 |
|
*/ |
164 |
inline const Vertex& operator () (const size_t& i) const |
inline const Vertex& operator () (const size_t& i) const |
165 |
{ |
{ |
166 |
assert (i<numberOfVertices()); |
assert (i<numberOfVertices()); |
167 |
return *(__vertices[i]); |
return *(__vertices[i]); |
168 |
} |
} |
169 |
|
|
170 |
|
/** |
171 |
|
* Sets the cell to a given one |
172 |
|
* |
173 |
|
* @param C the given cell |
174 |
|
* |
175 |
|
* @return the modified cell |
176 |
|
*/ |
177 |
const Cell& operator=(const Cell& C) |
const Cell& operator=(const Cell& C) |
178 |
{ |
{ |
179 |
__reference = C.__reference; |
__reference = C.__reference; |
185 |
return *this; |
return *this; |
186 |
} |
} |
187 |
|
|
188 |
//! Default Constructor |
/** |
189 |
Cell(const size_t& nbV) |
* Constructs a cell with a given number of vertices |
190 |
|
* |
191 |
|
* @param numberOfVertices the number of vertices |
192 |
|
*/ |
193 |
|
Cell(const size_t& numberOfVertices) |
194 |
: __reference(0), |
: __reference(0), |
195 |
__volume(0) |
__volume(0), |
196 |
|
__isFictitious(false) |
197 |
{ |
{ |
198 |
assert(nbV > 0); |
assert(numberOfVertices > 0); |
199 |
__vertices = new Vertex*[nbV]; |
__vertices = new Vertex*[numberOfVertices]; |
200 |
} |
} |
201 |
|
|
202 |
//! Default Constructor |
/** |
203 |
Cell(const size_t& nbV, const size_t& reference) |
* Constructs a cell with a given number of vertices and a given |
204 |
|
* reference |
205 |
|
* |
206 |
|
* @param numberOfVertices the number of vertices |
207 |
|
* @param reference the given reference |
208 |
|
*/ |
209 |
|
Cell(const size_t& numberOfVertices, const size_t& reference) |
210 |
: __reference(reference), |
: __reference(reference), |
211 |
__volume(0) |
__volume(0), |
212 |
|
__isFictitious(false) |
213 |
{ |
{ |
214 |
assert(nbV > 0); |
assert(numberOfVertices > 0); |
215 |
__vertices = new Vertex*[nbV]; |
__vertices = new Vertex*[numberOfVertices]; |
216 |
} |
} |
217 |
|
|
218 |
//! Copy constructor. |
/** |
219 |
|
* Copies a given cell |
220 |
|
* |
221 |
|
* @param C the given cell |
222 |
|
*/ |
223 |
Cell(const Cell& C) |
Cell(const Cell& C) |
224 |
: __reference(C.__reference), |
: __reference(C.__reference), |
225 |
__volume(C.__volume) |
__volume(C.__volume), |
226 |
|
__isFictitious(C.__isFictitious) |
227 |
{ |
{ |
228 |
__vertices = new Vertex*[C.numberOfVertices()]; |
__vertices = new Vertex*[C.numberOfVertices()]; |
229 |
for (size_t i=0; i<C.numberOfVertices(); ++i) |
for (size_t i=0; i<C.numberOfVertices(); ++i) |
230 |
__vertices[i] = C.__vertices[i]; |
__vertices[i] = C.__vertices[i]; |
231 |
} |
} |
232 |
|
|
233 |
//! Destructor. |
/** |
234 |
|
* The destructor |
235 |
|
* |
236 |
|
*/ |
237 |
virtual ~Cell() |
virtual ~Cell() |
238 |
{ |
{ |
239 |
delete [] __vertices; |
delete [] __vertices; |