TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Hexaedre.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_included
17#define Hexaedre_included
18
19#include <Elem_geom_base.h>
20
21/*! @brief Class Hexaedre: represents a geometric element with 6 faces, 8 vertices, and
22 *
23 * a single face type (Type_Face::quadrangle_3D) with 4 vertices.
24 *
25 * @sa Hexaedre_axi Elem_geom_base Elem_geom, A hexahedron is a 3D element
26 */
27template <typename _SIZE_>
29{
30
31 Declare_instanciable_32_64(Hexaedre_32_64);
32
33public :
34 using int_t = _SIZE_;
35 using IntTab_t = IntTab_T<_SIZE_>;
36 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
37 using DoubleVect_t = DoubleVect_T<_SIZE_>;
38 using DoubleTab_t = DoubleTab_T<_SIZE_>;
40
41
42 int face_sommet(int i, int j) const override;
43 inline int face_sommet0(int i) const;
44 inline int face_sommet1(int i) const;
45 inline int face_sommet2(int i) const;
46 inline int face_sommet3(int i) const;
47 inline int face_sommet4(int i) const;
48 inline int face_sommet5(int i) const;
49 inline int nb_som() const override { return 8; }
50 inline int nb_faces(int=0) const override;
51 inline int nb_som_face(int=0) const override;
52 inline bool est_structure() const override { return true; };
53 const Nom& nom_lml() const override;
54 int contient(const ArrOfDouble& pos, int_t elem) const override;
55 int contient(const SmallArrOfTID_t& soms, int_t elem) const override;
56 inline Type_Face type_face(int=0) const override;
57 void reordonner() override ;
59 void calculer_volumes(DoubleVect_t& vols) const override;
60 void calculer_normales(const IntTab_t& faces_sommets , DoubleTab_t& face_normales) const override;
61 int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const override;
62};
63
64/*! @brief Returns the number of faces of the specified type that the geometric element has.
65 *
66 * @param i the face type
67 * @return the number of faces of type i
68 */
69template<typename _SIZE_>
70inline int Hexaedre_32_64<_SIZE_>::nb_faces(int i) const
71{
72 assert(i==0);
73 return 6;
74}
75
76
77/*! @brief Returns the number of vertices of the faces of the specified type.
78 *
79 * @param i the face type
80 * @return the number of vertices of faces of type i
81 */
82template<typename _SIZE_>
84{
85 assert(i==0);
86 return 4;
87}
88
89
90/*! @brief Returns the index of the i-th vertex of face 0.
91 *
92 * @param i the index of the vertex to return
93 * @return the index of the i-th vertex of face 0
94 */
95template<typename _SIZE_>
97{
98 //face_sommet0(0)=0;
99 //face_sommet0(1)=2;
100 //face_sommet0(2)=4;
101 //face_sommet0(3)=6;
102 assert(i>=0);
103 assert(i<4);
104 return 2*i;
105}
106
107
108/*! @brief Returns the index of the i-th vertex of face 1.
109 *
110 * @param i the index of the vertex to return
111 * @return the index of the i-th vertex of face 1
112 */
113template<typename _SIZE_>
115{
116 //face_sommet1(0)=0;
117 //face_sommet1(1)=1;
118 //face_sommet1(2)=4;
119 //face_sommet1(3)=5;
120 assert(i>=0);
121 assert(i<4);
122 return 2*(i/2)+i;
123}
124
125
126/*! @brief Returns the index of the i-th vertex of face 2.
127 *
128 * @param i the index of the vertex to return
129 * @return the index of the i-th vertex of face 2
130 */
131template<typename _SIZE_>
133{
134 //face_sommet2(0)=0;
135 //face_sommet2(1)=1;
136 //face_sommet2(2)=2;
137 //face_sommet2(3)=3;
138 assert(i>=0);
139 assert(i<4);
140 return i;
141}
142
143
144/*! @brief Returns the index of the i-th vertex of face 3.
145 *
146 * @param i the index of the vertex to return
147 * @return the index of the i-th vertex of face 3
148 */
149template<typename _SIZE_>
151{
152 //face_sommet3(0)=1;
153 //face_sommet3(1)=3;
154 //face_sommet3(2)=5;
155 //face_sommet3(3)=7;
156 assert(i>=0);
157 assert(i<4);
158 return 2*i+1;
159}
160
161
162/*! @brief Returns the index of the i-th vertex of face 4.
163 *
164 * @param i the index of the vertex to return
165 * @return the index of the i-th vertex of face 4
166 */
167template<typename _SIZE_>
169{
170 //face_sommet4(0)=2;
171 //face_sommet4(1)=3;
172 //face_sommet4(2)=6;
173 //face_sommet4(3)=7;
174 assert(i>=0);
175 assert(i<4);
176 return 2*(i/2)+i+2;
177}
178
179
180/*! @brief Returns the index of the i-th vertex of face 5.
181 *
182 * @param i the index of the vertex to return
183 * @return the index of the i-th vertex of face 5
184 */
185template<typename _SIZE_>
187{
188 //face_sommet4(0)=4;
189 //face_sommet4(1)=5;
190 //face_sommet4(2)=6;
191 //face_sommet4(3)=7;
192 assert(i>=0);
193 assert(i<4);
194 return i+4;
195}
196
197
198/*! @brief Returns the i-th face type.
199 *
200 * A hexahedron has only one face type.
201 *
202 * @param i the rank of the face type to return
203 * @return a face type
204 */
205template<typename _SIZE_>
206inline Type_Face Hexaedre_32_64<_SIZE_>::type_face(int i) const
207{
208 assert(i==0);
209 return Type_Face::quadrangle_3D;
210}
211
212using Hexaedre = Hexaedre_32_64<int>;
213using Hexaedre_64 = Hexaedre_32_64<trustIdType>;
214
215#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: represents a geometric element with 6 faces, 8 vertices, and.
Definition Hexaedre.h:29
int nb_som_face(int=0) const override
Returns the number of vertices of the faces of the specified type.
Definition Hexaedre.h:83
int reordonner_elem()
Reorders the vertices of the hexahedron element.
Definition Hexaedre.cpp:84
int nb_som() const override
Nb of vertices for the element.
Definition Hexaedre.h:49
void calculer_normales(const IntTab_t &faces_sommets, DoubleTab_t &face_normales) const override
Computes the face normals of the elements of the associated domain.
Definition Hexaedre.cpp:243
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element "element" of the domain associated with this geometric element contains the poin...
Definition Hexaedre.cpp:171
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Hexaedre.h:37
Type_Face type_face(int=0) const override
Returns the i-th face type.
Definition Hexaedre.h:206
int face_sommet1(int i) const
Returns the index of the i-th vertex of face 1.
Definition Hexaedre.h:114
_SIZE_ int_t
Definition Hexaedre.h:34
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 Hexaedre.cpp:292
int face_sommet2(int i) const
Returns the index of the i-th vertex of face 2.
Definition Hexaedre.h:132
int face_sommet0(int i) const
Returns the index of the i-th vertex of face 0.
Definition Hexaedre.h:96
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
Definition Hexaedre.cpp:216
int contient(const SmallArrOfTID_t &soms, int_t elem) const override
Returns 1 if the vertices specified by parameter "som" are the vertices of element "element".
Definition Hexaedre.cpp:195
int face_sommet4(int i) const
Returns the index of the i-th vertex of face 4.
Definition Hexaedre.h:168
int nb_faces(int=0) const override
Returns the number of faces of the specified type that the geometric element has.
Definition Hexaedre.h:70
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
See ElemGeomBase::get_tab_faces_sommets_locaux.
Definition Hexaedre.cpp:276
Domaine_32_64< _SIZE_ > Domaine_t
Definition Hexaedre.h:39
const Nom & nom_lml() const override
Returns the LML name of a hexahedron = "VOXEL8".
Definition Hexaedre.cpp:155
int face_sommet5(int i) const
Returns the index of the i-th vertex of face 5.
Definition Hexaedre.h:186
void reordonner() override
Reorders the vertices of the hexahedron.
Definition Hexaedre.cpp:68
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Hexaedre.h:36
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Hexaedre.h:38
bool est_structure() const override
Definition Hexaedre.h:52
int face_sommet3(int i) const
Returns the index of the i-th vertex of face 3.
Definition Hexaedre.h:150
IntTab_T< _SIZE_ > IntTab_t
Definition Hexaedre.h:35
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31