TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Hexaedre_VEF.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 Hexaedre_VEF_included
17#define Hexaedre_VEF_included
18
19
20#include <Elem_geom_base.h>
21
22/*! @brief Class Hexaedre_VEF: represents the geometric element Hexaedre_VEF.
23 *
24 * A Hexaedre_VEF is a polyhedron with 6 faces, 8 vertices, and
25 * a single face type with 4 vertices per face.
26 *
27 * @sa Elem_geom_base Elem_geom, This element is usable in 3D
28 */
29template <typename _SIZE_>
31{
32
33 Declare_instanciable_32_64(Hexaedre_VEF_32_64);
34
35public :
36 using int_t = _SIZE_;
37 using IntTab_t = IntTab_T<_SIZE_>;
38 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
39 using DoubleVect_t = DoubleVect_T<_SIZE_>;
40 using DoubleTab_t = DoubleTab_T<_SIZE_>;
42
43 inline int face_sommet(int i, int j) const override;
44 inline int face_sommet0(int i) const;
45 inline int face_sommet1(int i) const;
46 inline int face_sommet2(int i) const;
47 inline int face_sommet3(int i) const;
48 inline int face_sommet4(int i) const;
49 inline int face_sommet5(int i) const;
50 inline int nb_som() const override { return 8; }
51 inline int nb_faces(int=0) const override;
52 inline int nb_som_face(int=0) const override;
53 inline bool est_structure() const override { return false; }
54 const Nom& nom_lml() const override;
55 int contient(const ArrOfDouble& pos, int_t elem) const override;
56 int contient(const SmallArrOfTID_t& soms, int_t elem) const override;
57 inline Type_Face type_face(int=0) const override;
58 void reordonner() override ;
59 void calculer_volumes(DoubleVect_t& vols) const override;
60
61 int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const override;
62
63private:
64 bool entre_faces(const ArrOfDouble& pos, int_t Asom0_, int_t Asom1_, int_t Asom2_, int_t Bsom0_, int_t Bsom1_, int_t Bsom2_) const;
65 bool contient_Tetra(const ArrOfDouble& pos, int_t som0_, int_t som1_, int_t som2_, int_t som3_, int aff) const;
66 int reordonne(int i0,int i1,int i2,int i3,const DoubleTab_t& coord, IntTab_t& elem, int_t& num_poly,int test,
67 DoubleTab& v, ArrOfDouble& prod_,ArrOfDouble& prod_v, ArrOfDouble& dist, DoubleTab& prod_v2);
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 Hexaedre_VEF_32_64<_SIZE_>::face_sommet(int i, int j) const
79{
80 assert(i<6);
81 switch(i)
82 {
83 case 0:
84 return face_sommet0(j);
85 case 1:
86 return face_sommet1(j);
87 case 2:
88 return face_sommet2(j);
89 case 3:
90 return face_sommet3(j);
91 case 4:
92 return face_sommet4(j);
93 case 5:
94 return face_sommet5(j);
95 default :
96 return -1;
97 }
98}
99
100
101/*! @brief Returns the number of faces of the specified type that the geometric element has.
102 *
103 * @param i the face type
104 * @return the number of faces of type i
105 */
106template <typename _SIZE_>
108{
109 assert(i==0);
110 return 6;
111}
112
113
114/*! @brief Returns the number of vertices of faces of the specified type.
115 *
116 * @param i the face type
117 * @return the number of vertices of faces of type i
118 */
119template <typename _SIZE_>
121{
122 assert(i==0);
123 return 4;
124}
125
126
127/*! @brief Returns the index of the i-th vertex of face 0.
128 *
129 * @param i the index of the vertex to return
130 * @return the index of the i-th vertex of face 0
131 */
132template <typename _SIZE_>
134{
135 assert(i>=0);
136 assert(i<4);
137 return 2*i;
138}
139
140
141/*! @brief Returns the index of the i-th vertex of face 1.
142 *
143 * @param i the index of the vertex to return
144 * @return the index of the i-th vertex of face 1
145 */
146template <typename _SIZE_>
148{
149 assert(i>=0);
150 assert(i<4);
151 switch(i)
152 {
153 case 0:
154 return 0;
155 case 1:
156 return 1;
157 case 2:
158 return 4;
159 case 3:
160 return 5;
161 default :
162 Cerr << "A VEF hexahedron (Hexaedre_VEF) has not " << i << " nodes per face" << finl;
164 return -1;
165 }
166}
167
168
169/*! @brief Returns the index of the i-th vertex of face 2.
170 *
171 * @param i the index of the vertex to return
172 * @return the index of the i-th vertex of face 2
173 */
174template <typename _SIZE_>
176{
177 assert(i>=0);
178 assert(i<4);
179 return i;
180}
181
182
183/*! @brief Returns the index of the i-th vertex of face 3.
184 *
185 * @param i the index of the vertex to return
186 * @return the index of the i-th vertex of face 3
187 */
188template <typename _SIZE_>
190{
191 assert(i>=0);
192 assert(i<4);
193 return 2*i+1;
194}
195
196/*! @brief Returns the index of the i-th vertex of face 4.
197 *
198 * @param i the index of the vertex to return
199 * @return the index of the i-th vertex of face 4
200 */
201template <typename _SIZE_>
203{
204 assert(i>=0);
205 assert(i<4);
206 switch(i)
207 {
208 case 0:
209 return 2;
210 case 1:
211 return 3;
212 case 2:
213 return 6;
214 case 3:
215 return 7;
216 default :
217 Cerr << "A VEF hexahedron (Hexaedre_VEF) has not " << i << " nodes per face" << finl;
219 return -1;
220 }
221}
222
223/*! @brief Returns the index of the i-th vertex of face 5.
224 *
225 * @param i the index of the vertex to return
226 * @return the index of the i-th vertex of face 5
227 */
228template <typename _SIZE_>
230{
231 assert(i>=0);
232 assert(i<4);
233 return i+4;
234}
235
236
237/*! @brief Returns the i-th face type.
238 *
239 * A Hexaedre_VEF has only one face type.
240 *
241 * @param i the rank of the face type to return
242 * @return a face type
243 */
244template <typename _SIZE_>
245inline Type_Face Hexaedre_VEF_32_64<_SIZE_>::type_face(int i) const
246{
247 assert(i==0);
248 return Type_Face::quadrangle_3D;
249}
250
251using Hexaedre_VEF = Hexaedre_VEF_32_64<int>;
252using Hexaedre_VEF_64 = Hexaedre_VEF_32_64<trustIdType>;
253
254#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 Hexaedre_VEF: represents the geometric element Hexaedre_VEF.
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
voir ElemGeomBase::get_tab_faces_sommets_locaux
int face_sommet2(int i) const
Returns the index of the i-th vertex of face 2.
int nb_faces(int=0) const override
Returns the number of faces of the specified type that the geometric element has.
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element ielem of the domain associated with the geometric element contains the point.
DoubleTab_T< _SIZE_ > DoubleTab_t
int face_sommet5(int i) const
Returns the index of the i-th vertex of face 5.
int face_sommet0(int i) const
Returns the index of the i-th vertex of face 0.
int contient(const SmallArrOfTID_t &soms, int_t elem) const override
Returns 1 if the vertices specified by parameter "pos" are the vertices of element "element" of the d...
int face_sommet4(int i) const
Returns the index of the i-th vertex of face 4.
int nb_som() const override
Nb of vertices for the element.
IntTab_T< _SIZE_ > IntTab_t
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.
const Nom & nom_lml() const override
Returns the LML name of a Hexaedre_VEF = "HEXA8".
int face_sommet3(int i) const
Returns the index of the i-th vertex of face 3.
DoubleVect_T< _SIZE_ > DoubleVect_t
void reordonner() override
int face_sommet1(int i) const
Returns the index of the i-th vertex of face 1.
int nb_som_face(int=0) const override
Returns the number of vertices of faces of the specified type.
bool est_structure() const override
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Type_Face type_face(int=0) const override
Returns the i-th face type.
Domaine_32_64< _SIZE_ > Domaine_t
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466