TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Prisme.h
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Prisme_included
17#define Prisme_included
18
19#include <Elem_geom_base.h>
20
21template <typename _SIZE_> class Domaine_32_64;
22
23/*! @brief Class Prisme: represents the geometric element Prism.
24 *
25 * A prism is a polyhedron with 5 faces, 6 vertices, and two face types:
26 * 2 triangles with 3 vertices
27 * 3 quadrangles with 4 vertices
28 *
29 * @sa Elem_geom_base Elem_geom
30 */
31template <typename _SIZE_>
32class Prisme_32_64 : public Elem_geom_base_32_64<_SIZE_>
33{
34
35 Declare_instanciable_32_64(Prisme_32_64);
36
37public :
38
39 using int_t = _SIZE_;
40 using IntTab_t = IntTab_T<_SIZE_>;
41 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
42 using DoubleVect_t = DoubleVect_T<_SIZE_>;
43 using DoubleTab_t = DoubleTab_T<_SIZE_>;
45
46 inline int face_sommet(int i, int j) const override;
47 inline int face_sommet0(int i) const;
48 inline int face_sommet1(int i) const;
49 inline int face_sommet2(int i) const;
50 inline int face_sommet3(int i) const;
51 inline int face_sommet4(int i) const;
52
53 inline int nb_som() const override { return 6; }
54 inline int nb_faces(int=0) const override;
55 inline int nb_som_face(int=0) const override;
56 inline bool est_structure() const override { return false; }
57 const Nom& nom_lml() const override;
58
59 int contient(const ArrOfDouble& pos, int_t elem) const override;
60 int contient(const SmallArrOfTID_t& soms, int_t elem) const override;
61 inline Type_Face type_face(int=0) const override;
62 void calculer_volumes(DoubleVect_t& vols) const override;
63
64 void reordonner() override ;
65
66 int nb_type_face() const override { return 2; }
67 int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const override;
68};
69
70
71/*! @brief Returns the index of the j-th vertex of the i-th face of the element.
72 *
73 * @param i a face index
74 * @param j a vertex index
75 * @return the index of the j-th vertex of the i-th face
76 */
77template <typename _SIZE_>
78inline int Prisme_32_64<_SIZE_>::face_sommet(int face, int sommet) const
79{
80 assert(face<5);
81 switch(face)
82 {
83 case 0:
84 return face_sommet0(sommet);
85 case 1:
86 return face_sommet1(sommet);
87 case 2:
88 return face_sommet2(sommet);
89 case 3:
90 return face_sommet3(sommet);
91 case 4:
92 return face_sommet4(sommet);
93 default :
94 return -1;
95 }
96}
97
98
99/*! @brief Returns the number of faces of the specified type that the geometric element has.
100 *
101 * A prism has 2 face types: quadrangle or triangle.
102 *
103 * @param i the face type
104 * @return the number of faces of type i
105 */
106template <typename _SIZE_>
107inline int Prisme_32_64<_SIZE_>::nb_faces(int i) const
108{
109 assert(i < nb_type_face());
110 switch(i)
111 {
112 case 0:
113 return 3; //quadrangles
114 case 1:
115 return 2; //triangles
116 default :
117 Cerr << "Error, a prism has 2 types of faces and not " << i << finl;
119 return -1;
120 }
121
122}
123
124
125/*! @brief Returns the number of vertices of the faces of the specified type.
126 *
127 * @param i the face type
128 * @return the number of vertices of faces of type i
129 */
130template <typename _SIZE_>
132{
133 assert(i < nb_type_face());
134 switch(i)
135 {
136 case 0:
137 return 4;
138 case 1:
139 return 3;
140 default :
141 Cerr << "Error, a prism has 2 types of faces and not " << i << finl;
143 return -1;
144 }
145}
146
147
148/*! @brief Returns the index of the i-th vertex of face 0.
149 *
150 * @param i the index of the vertex to return
151 * @return the index of the i-th vertex of face 0
152 */
153template <typename _SIZE_>
155{
156 //face_sommet0(0)=0;
157 //face_sommet0(1)=1;
158 //face_sommet0(2)=3;
159 //face_sommet0(3)=4;
160 assert(i>=0);
161 assert(i<4);
162 switch(i)
163 {
164 case 0:
165 return 0;
166 case 1:
167 return 1;
168 case 2:
169 return 3;
170 case 3:
171 return 4;
172 default :
173 Cerr << "Error in Prisme_32_64<_SIZE_>::face_sommet0" << finl;
175 // For some compilers:
176 return -1;
177 }
178}
179
180
181/*! @brief Returns the index of the i-th vertex of face 1.
182 *
183 * @param i the index of the vertex to return
184 * @return the index of the i-th vertex of face 1
185 */
186template <typename _SIZE_>
188{
189 //face_sommet0(0)=0;
190 //face_sommet0(1)=2;
191 //face_sommet0(2)=3;
192 //face_sommet0(3)=5;
193 assert(i>=0);
194 assert(i<4);
195 switch(i)
196 {
197 case 0:
198 return 0;
199 case 1:
200 return 2;
201 case 2:
202 return 3;
203 case 3:
204 return 5;
205 default :
206 Cerr << "Error in Prisme_32_64<_SIZE_>::face_sommet1" << finl;
208 // For some compilers:
209 return -1;
210 }
211}
212
213
214/*! @brief Returns the index of the i-th vertex of face 2.
215 *
216 * @param i the index of the vertex to return
217 * @return the index of the i-th vertex of face 2
218 */
219template <typename _SIZE_>
221{
222 //face_sommet0(0)=1;
223 //face_sommet0(1)=2;
224 //face_sommet0(2)=4;
225 //face_sommet0(3)=5;
226 assert(i>=0);
227 assert(i<4);
228 switch(i)
229 {
230 case 0:
231 return 1;
232 case 1:
233 return 2;
234 case 2:
235 return 4;
236 case 3:
237 return 5;
238 default :
239 Cerr << "Error in Prisme_32_64<_SIZE_>::face_sommet2" << finl;
241 // For some compilers:
242 return -1;
243 }
244}
245
246
247/*! @brief Returns the index of the i-th vertex of face 3.
248 *
249 * @param i the index of the vertex to return
250 * @return the index of the i-th vertex of face 3
251 */
252template <typename _SIZE_>
254{
255 //face_sommet0(0)=0;
256 //face_sommet0(1)=1;
257 //face_sommet0(2)=2;
258 assert(i>=0);
259 assert(i<3);
260 return i;
261}
262
263
264/*! @brief Returns the index of the i-th vertex of face 4.
265 *
266 * @param i the index of the vertex to return
267 * @return the index of the i-th vertex of face 4
268 */
269template <typename _SIZE_>
271{
272 //face_sommet0(0)=0;
273 //face_sommet0(1)=1;
274 //face_sommet0(2)=2;
275 assert(i>=0);
276 assert(i<3);
277 return i+3;
278}
279
280/*! @brief Returns the i-th face type.
281 *
282 * A prism has 2 face types: quadrangle and triangle.
283 *
284 * @param i the rank of the face type to return
285 * @return the type of face i
286 */
287template <typename _SIZE_>
288inline Type_Face Prisme_32_64<_SIZE_>::type_face(int i) const
289{
290 assert(i<=1);
291 switch(i)
292 {
293 case 0:
294 return Type_Face::quadrangle_3D;
295 case 1:
296 return Type_Face::triangle_3D;
297 default :
298 Cerr << "Error, a prism has 2 types of faces and not " << i << finl;
300 return Type_Face::quadrangle_3D;
301 }
302}
303
304
305using Prisme = Prisme_32_64<int>;
306using Prisme_64 = Prisme_32_64<trustIdType>;
307
308#endif
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
Class Elem_geom_base This class is the base class for the definition of elements.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Class Prisme: represents the geometric element Prism.
Definition Prisme.h:33
bool est_structure() const override
Definition Prisme.h:56
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Prisme.h:43
const Nom & nom_lml() const override
Returns the LML name of a prism = "PRISM6".
Definition Prisme.cpp:71
int nb_faces(int=0) const override
Returns the number of faces of the specified type that the geometric element has.
Definition Prisme.h:107
int face_sommet4(int i) const
Returns the index of the i-th vertex of face 4.
Definition Prisme.h:270
IntTab_T< _SIZE_ > IntTab_t
Definition Prisme.h:40
int contient(const SmallArrOfTID_t &soms, int_t elem) const override
DOES NOTHING: TO BE CODED, always returns 0. Returns 1 if the vertices specified by parameter "pos".
Definition Prisme.cpp:186
int face_sommet(int i, int j) const override
Returns the index of the j-th vertex of the i-th face of the element.
Definition Prisme.h:78
int nb_som_face(int=0) const override
Returns the number of vertices of the faces of the specified type.
Definition Prisme.h:131
int face_sommet2(int i) const
Returns the index of the i-th vertex of face 2.
Definition Prisme.h:220
void reordonner() override
Reorders the vertices of the Prism.
Definition Prisme.cpp:58
void calculer_volumes(DoubleVect_t &vols) const override
DOES NOTHING: TO BE CODED. Computes the volumes of the elements of the associated domain.
Definition Prisme.cpp:199
int face_sommet3(int i) const
Returns the index of the i-th vertex of face 3.
Definition Prisme.h:253
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Prisme.h:41
Type_Face type_face(int=0) const override
Returns the i-th face type.
Definition Prisme.h:288
int face_sommet0(int i) const
Returns the index of the i-th vertex of face 0.
Definition Prisme.h:154
Domaine_32_64< _SIZE_ > Domaine_t
Definition Prisme.h:44
_SIZE_ int_t
Definition Prisme.h:39
int face_sommet1(int i) const
Returns the index of the i-th vertex of face 1.
Definition Prisme.h:187
int contient(const ArrOfDouble &pos, int_t elem) const override
DOES NOTHING: TO BE CODED; always returns 0.
Definition Prisme.cpp:89
int nb_type_face() const override
Nb of face types of the elemnt (for example 2 for a prism).
Definition Prisme.h:66
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Prisme.h:42
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
Fills the array faces_som_local(i,j) giving, for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i),...
Definition Prisme.cpp:262
int nb_som() const override
Nb of vertices for the element.
Definition Prisme.h:53
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466