TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Polyedre.h
1/****************************************************************************
2* Copyright (c) 2025, 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 Polyedre_included
17#define Polyedre_included
18
19#include <Poly_geom_base.h>
20
21/*! @brief Class Polyedre: represents the Polyedre geometric element.
22 *
23 * A polyhedron is an element defined by its faces of type Type_Face::polygone_3D.
24 *
25 * @sa Poly_geom_base Elem_geom
26 */
27template <typename _SIZE_>
29{
30
31 Declare_instanciable_32_64(Polyedre_32_64);
32
33public :
34 // Template classes with different template parameter do not see each other - build_reduced() needs this.
35 template <class T> friend class Polyedre_32_64;
36
37 using int_t = _SIZE_;
38 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
39 using BigArrOfInt_t = TRUSTArray<int, _SIZE_>; // Very specific to polyhedrons: a big array of small values
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 void calculer_un_centre_gravite(const int_t elem,DoubleVect& xp) const override;
47 // Accessor functions for private members:
48 inline int face_sommet(int i, int j) const override;
49 inline int nb_som() const override;
50 inline int nb_faces(int=0) const override;
51 inline int nb_som_face(int=0) const override;
52 const Nom& nom_lml() const override;
53
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 calculer_volumes(DoubleVect_t& vols) const override;
58 void calculer_centres_gravite(DoubleTab_t& xp) const override;
59
60 int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const override;
61 int get_tab_faces_sommets_locaux(IntTab& faces_som_local, int_t elem) const override;
62 void affecte_connectivite_numero_global(const ArrOfInt_t& Nodes, const ArrOfInt_t& FacesIndex,const ArrOfInt_t& PolyhedronIndex,IntTab_t& les_elems);
63 inline int get_nb_som_face_max() const { return nb_som_face_max_ ; }
64 inline void set_nb_som_face_max(int s) { nb_som_face_max_ = s; }
66
67 inline const BigArrOfInt_t& getNodes() const { return Nodes_; }
68 inline BigArrOfInt_t& getsetNodes() { return Nodes_; }
69 inline const ArrOfInt_t& getPolyhedronIndex() const { return PolyhedronIndex_; }
71 inline const ArrOfInt_t& getElemIndex() const override { return PolyhedronIndex_; }
72 void remplir_Nodes_glob(ArrOfInt_t& Nodes_glob,const IntTab_t& les_elems ) const;
73 void ajouter_elements(const Elem_geom_base_32_64<_SIZE_>& new_elem, const IntTab_t& new_elems, IntTab_t& les_elems);
74 void build_reduced(OWN_PTR(Elem_geom_base_32_64<int>)& type_elem, const ArrOfInt_t& elems_sous_part) const override;
75 inline const ArrOfInt_t& getFacesIndex() const { return FacesIndex_; }
76 void compute_virtual_index() override;
77
78protected:
79 // Members herited from top classes:
81 using Elem_geom_base_32_64<_SIZE_>::mon_dom;
82 // FacesIndex_[f] first vertex index of face f in Nodes
86
87 /// PolyhedronIndex_[ele] gives the index of the first face of the polyedron 'ele' in FaceIndex_ (see base class)
89 /// Nodes_[s] local index (in the reference frame of an element) of the vertex of a given face, where as elem(ele,s) will give the global index.
91
93};
94
95
96/*! @brief Returns the index of the j-th vertex of the i-th face of the element.
97 *
98 * @param face Face index.
99 * @param sommet Vertex index within the face.
100 * @return Index of the j-th vertex of the i-th face.
101 */
102template <typename _SIZE_>
103inline int Polyedre_32_64<_SIZE_>::face_sommet(int face, int sommet) const
104{
105 BLOQUE;
106 return -1;
107}
108
109
110/*! @brief Returns the maximum number of vertices of a polyhedron.
111 *
112 * @return Maximum number of vertices of a polyhedron.
113 */
114template <typename _SIZE_>
119
120
121/*! @brief Returns the number of faces of the specified type for this geometric element.
122 *
123 * A Polyedre has 1 type of face: polygon_3D.
124 *
125 * @param i Face type index.
126 * @return Number of faces of the given type.
127 */
128template <typename _SIZE_>
129inline int Polyedre_32_64<_SIZE_>::nb_faces(int i) const
130{
131 assert(i==0);
132 switch(i)
133 {
134 case 0:
136 default :
137 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
139 return -1;
140 }
141}
142
143
144/*! @brief Returns the maximum number of vertices of faces of the specified type.
145 *
146 * @param i Face type index.
147 * @return Number of vertices of faces of type i.
148 */
149template <typename _SIZE_>
151{
152 assert(i==0);
153 return get_nb_som_face_max();
154}
155
156
157/*! @brief Returns the i-th face type.
158 *
159 * A polyhedron has 2 types of face: quadrangle and triangle.
160 *
161 * @param i Rank of the face type to return.
162 * @return Type of face i.
163 */
164template <typename _SIZE_>
165inline Type_Face Polyedre_32_64<_SIZE_>::type_face(int i) const
166{
167 assert(i<=0);
168 switch(i)
169 {
170 case 0:
171 return Type_Face::polygone_3D;
172 default :
173 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
175 return Type_Face::quadrangle_3D;
176 }
177}
178
179
180using Polyedre = Polyedre_32_64<int>;
181using Polyedre_64 = Polyedre_32_64<trustIdType>;
182
183#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
static int dimension
Definition Objet_U.h:94
Base class for polyedrons and polygons. Connectivity is stored in descending mode:
int get_nb_som_elem_max() const
int get_nb_face_elem_max() const
Class Polyedre: represents the Polyedre geometric element.
Definition Polyedre.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
Fills the table faces_som_local(i,j), which gives for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i)...
Definition Polyedre.cpp:316
int_t get_somme_nb_faces_elem() const override
Definition Polyedre.cpp:619
int nb_som_face(int=0) const override
Returns the maximum number of vertices of faces of the specified type.
Definition Polyedre.h:150
void affecte_connectivite_numero_global(const ArrOfInt_t &Nodes, const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolyhedronIndex, IntTab_t &les_elems)
Definition Polyedre.cpp:350
int nb_som() const override
Returns the maximum number of vertices of a polyhedron.
Definition Polyedre.h:115
const Nom & nom_lml() const override
Returns the LML name of a polyhedron = "POLYEDRE_" + nb_som_max.
Definition Polyedre.cpp:162
void compute_virtual_index() override
Definition Polyedre.cpp:537
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Polyedre.h:43
const ArrOfInt_t & getElemIndex() const override
Definition Polyedre.h:71
int contient(const SmallArrOfTID_t &soms, int_t elem) const override
Not yet implemented — always returns 0. Returns 1 if the vertices specified by "pos" are those of ele...
Definition Polyedre.cpp:242
const ArrOfInt_t & getPolyhedronIndex() const
Definition Polyedre.h:69
void calculer_centres_gravite(DoubleTab_t &xp) const override
Compute all centers of mass of all elements in the domain.
Definition Polyedre.cpp:63
int get_tab_faces_sommets_locaux(IntTab &faces_som_local, int_t elem) const override
Definition Polyedre.cpp:322
friend class Polyedre_32_64
Definition Polyedre.h:35
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 Polyedre.h:103
_SIZE_ int_t
Definition Polyedre.h:37
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Polyedre.h:42
TRUSTArray< int, _SIZE_ > BigArrOfInt_t
Definition Polyedre.h:39
void ajouter_elements(const Elem_geom_base_32_64< _SIZE_ > &new_elem, const IntTab_t &new_elems, IntTab_t &les_elems)
Appends elements of type new_elem to those already present in les_elems and new_elems.
Definition Polyedre.cpp:448
int nb_faces(int=0) const override
Returns the number of faces of the specified type for this geometric element.
Definition Polyedre.h:129
const BigArrOfInt_t & getNodes() const
Definition Polyedre.h:67
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
Definition Polyedre.cpp:512
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Polyedre.h:41
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element "num_poly" of the associated domain contains the point with coordinates given by...
Definition Polyedre.cpp:179
void calculer_un_centre_gravite(const int_t elem, DoubleVect &xp) const override
Definition Polyedre.cpp:139
BigArrOfInt_t Nodes_
Definition Polyedre.h:90
void remplir_Nodes_glob(ArrOfInt_t &Nodes_glob, const IntTab_t &les_elems) const
Definition Polyedre.cpp:428
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Polyedre.h:38
Type_Face type_face(int=0) const override
Returns the i-th face type.
Definition Polyedre.h:165
const ArrOfInt_t & getFacesIndex() const
Definition Polyedre.h:75
IntTab_T< _SIZE_ > IntTab_t
Definition Polyedre.h:40
void set_nb_som_face_max(int s)
Definition Polyedre.h:64
Domaine_32_64< _SIZE_ > Domaine_t
Definition Polyedre.h:44
int get_nb_som_face_max() const
Definition Polyedre.h:63
ArrOfInt_t PolyhedronIndex_
Definition Polyedre.h:88
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
Definition Polyedre.cpp:254
ArrOfInt_t & getsetPolyhedronIndex()
Definition Polyedre.h:70
BigArrOfInt_t & getsetNodes()
Definition Polyedre.h:68
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81