TrioCFD 1.9.8
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 Classe Polyedre Cette represente l'element geometrique Polyedre.
22 *
23 * Un polyedre est un element defini par ses faces de 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 // Fonctions d'acces aux membres prives:
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] premier indice de sommet de la face f dans 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 Renvoie le numero du j-ieme sommet de la i-ieme face de l'element.
97 *
98 * @param (int i) un numero de face
99 * @param (int j) un numero de sommet
100 * @return (int) le numero du j-ieme sommet de la i-ieme 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 Renvoie le nombre de sommets d'un Polyedre
111 *
112 * @return (int) le nombre de sommets maximum d'un polyedre
113 */
114template <typename _SIZE_>
119
120
121/*! @brief Renvoie le nombre de faces du type specifie que possede l'element geometrique.
122 *
123 * Un Polyedre a 1 type de faces: polygon_3D
124 *
125 * @param (int i) le type de face
126 */
127template <typename _SIZE_>
128inline int Polyedre_32_64<_SIZE_>::nb_faces(int i) const
129{
130 assert(i==0);
131 switch(i)
132 {
133 case 0:
135 default :
136 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
138 return -1;
139 }
140}
141
142
143/*! @brief Renvoie le nombre maximum de sommets des faces du type specifie.
144 *
145 * @param (int i) le type de face
146 * @return (int) le nombre de sommets des faces de type i
147 */
148template <typename _SIZE_>
150{
151 assert(i==0);
152 return get_nb_som_face_max();
153}
154
155
156/*! @brief Renvoie le i-ieme type de face.
157 *
158 * Un polyedre a 2 types de face: quadrangle et triangle
159 *
160 * @param (int i) le rang du type de face a renvoyer
161 * @return (Type_Face) le type de la face i
162 */
163template <typename _SIZE_>
164inline Type_Face Polyedre_32_64<_SIZE_>::type_face(int i) const
165{
166 assert(i<=0);
167 switch(i)
168 {
169 case 0:
170 return Type_Face::polygone_3D;
171 default :
172 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
174 return Type_Face::quadrangle_3D;
175 }
176}
177
178
179using Polyedre = Polyedre_32_64<int>;
180using Polyedre_64 = Polyedre_32_64<trustIdType>;
181
182#endif
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
Definition Domaine.h:62
Classe Elem_geom_base Cette classe est la classe de base pour la definition d'elements.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
static int dimension
Definition Objet_U.h:99
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
Classe Polyedre Cette represente l'element geometrique Polyedre.
Definition Polyedre.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
remplit le tableau faces_som_local(i,j)
Definition Polyedre.cpp:327
int_t get_somme_nb_faces_elem() const override
Definition Polyedre.cpp:627
int nb_som_face(int=0) const override
Renvoie le nombre maximum de sommets des faces du type specifie.
Definition Polyedre.h:149
void affecte_connectivite_numero_global(const ArrOfInt_t &Nodes, const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolyhedronIndex, IntTab_t &les_elems)
Definition Polyedre.cpp:361
int nb_som() const override
Renvoie le nombre de sommets d'un Polyedre.
Definition Polyedre.h:115
const Nom & nom_lml() const override
Renvoie le nom LML d'un polyedre = "POLYEDRE_"+nb_som_max.
Definition Polyedre.cpp:162
void compute_virtual_index() override
Definition Polyedre.cpp:545
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
NE FAIT RIEN: A CODER, renvoie toujours 0 Renvoie 1 si les sommets specifies par le parametre "pos".
Definition Polyedre.cpp:250
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:333
friend class Polyedre_32_64
Definition Polyedre.h:35
int face_sommet(int i, int j) const override
Renvoie le numero du j-ieme sommet de la i-ieme face de l'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)
on va ajouter les elements de type new_elem aux elements deja presents dans les_elems et dans new_ele...
Definition Polyedre.cpp:456
int nb_faces(int=0) const override
Renvoie le nombre de faces du type specifie que possede l'element geometrique.
Definition Polyedre.h:128
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:520
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Polyedre.h:41
int contient(const ArrOfDouble &pos, int_t elem) const override
NE FAIT RIEN: A CODER, renvoie toujours 0.
Definition Polyedre.cpp:184
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:439
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Polyedre.h:38
Type_Face type_face(int=0) const override
Renvoie le i-ieme type de face.
Definition Polyedre.h:164
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
NE FAIT RIEN: A CODER Calcule les volumes des elements du domaine associe.
Definition Polyedre.cpp:262
ArrOfInt_t & getsetPolyhedronIndex()
Definition Polyedre.h:70
BigArrOfInt_t & getsetNodes()
Definition Polyedre.h:68
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81