TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Polygone.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 Polygone_included
17#define Polygone_included
18
19#include <Poly_geom_base.h>
20
21/*! @brief Classe Polygone Cette represente l'element geometrique Polygone.
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(Polygone_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 Polygone_32_64;
36
37 using int_t = _SIZE_;
38 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
39 using IntTab_t = IntTab_T<_SIZE_>;
40 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
41 using DoubleVect_t = DoubleVect_T<_SIZE_>;
42 using DoubleTab_t = DoubleTab_T<_SIZE_>;
44
45
46 inline int face_sommet(int i, int j) const override;
47 inline int nb_som() const override;
48 inline int nb_faces(int=0) const override;
49 inline int nb_som_face(int=0) const override;
50 const Nom& nom_lml() const override;
51
52 int contient(const ArrOfDouble& pos, int_t elem) const override;
53 int contient(const SmallArrOfTID_t& soms, int_t elem) const override;
54 inline Type_Face type_face(int=0) const override;
55 void calculer_volumes(DoubleVect_t& vols) const override;
56 void calculer_centres_gravite(DoubleTab_t& xp) const override;
57
58 void calculer_un_centre_gravite(const int_t elem, DoubleVect& 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& FacesIndex,const ArrOfInt_t& PolygonIndex,IntTab_t& les_elems);
63
65 inline int get_nb_face_elem_max() const { return nb_face_elem_max_ ; }
66
67 _SIZE_ get_somme_nb_faces_elem() const override;
68
69 inline const ArrOfInt_t& getPolygonIndex() const { return PolygonIndex_; }
70 inline const ArrOfInt_t& getElemIndex() const override { return PolygonIndex_; }
72 void build_reduced(OWN_PTR(Elem_geom_base_32_64<int>)& type_elem, const ArrOfInt_t& elems_sous_part) const override;
73 void compute_virtual_index() override;
74
75protected:
76 // Members herited from top classes:
78 using Elem_geom_base_32_64<_SIZE_>::mon_dom;
79 // FacesIndex_[f] premier indice de sommet de la face f dans Nodes
83
84 /*! PolygonIndex_[ele] gives the index of the first face of element 'ele'
85 * See FaceIndex_ in base class.
86 */
88};
89
90
91/*! @brief Renvoie le numero du j-ieme sommet de la i-ieme face de l'element.
92 *
93 * @param (int i) un numero de face
94 * @param (int j) un numero de sommet
95 * @return (int) le numero du j-ieme sommet de la i-ieme face
96 */
97template <typename _SIZE_>
98inline int Polygone_32_64<_SIZE_>::face_sommet(int face, int sommet) const
99{
100 BLOQUE;
101 return -1;
102}
103
104
105/*! @brief Renvoie le nombre de sommets d'un Polygone
106 *
107 * @return (int) le nombre de sommets maximum d'un polyedre
108 */
109template <typename _SIZE_>
111{
112 return get_nb_som_elem_max();
113}
114
115
116/*! @brief Renvoie le nombre de faces du type specifie que possede l'element geometrique.
117 *
118 * Un Polygone a 1 type de faces: polygon_3D
119 *
120 * @param (int i) le type de face
121 */
122template <typename _SIZE_>
123inline int Polygone_32_64<_SIZE_>::nb_faces(int i) const
124{
125 assert(i==0);
126 switch(i)
127 {
128 case 0:
129 return get_nb_face_elem_max();
130 default :
131 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
133 return -1;
134 }
135}
136
137
138/*! @brief Renvoie le nombre maximum de sommets des faces du type specifie.
139 *
140 * @param (int i) le type de face
141 * @return (int) le nombre de sommets des faces de type i
142 */
143template <typename _SIZE_>
145{
146 assert(i==0);
147 return 2;
148}
149
150/*! @brief Renvoie le i-ieme type de face.
151 *
152 * Un polyedre a 2 types de face: quadrangle et triangle
153 *
154 * @param (int i) le rang du type de face a renvoyer
155 * @return (Type_Face) le type de la face i
156 */
157template <typename _SIZE_>
158inline Type_Face Polygone_32_64<_SIZE_>::type_face(int i) const
159{
160 assert(i<=0);
161 switch(i)
162 {
163 case 0:
164 return Type_Face::segment_2D;
165 default :
166 Cerr << "Error, a polyhedron has 1 type of faces and not " << i << finl;
168 return Type_Face::quadrangle_3D;
169 }
170}
171
172
173using Polygone = Polygone_32_64<int>;
174using Polygone_64 = Polygone_32_64<trustIdType>;
175
176#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:
Classe Polygone Cette represente l'element geometrique Polygone.
Definition Polygone.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
remplit le tableau faces_som_local(i,j)
Definition Polygone.cpp:293
_SIZE_ get_somme_nb_faces_elem() const override
Definition Polygone.cpp:121
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
Definition Polygone.cpp:87
int get_tab_faces_sommets_locaux(IntTab &faces_som_local, int_t elem) const override
Definition Polygone.cpp:299
friend class Polygone_32_64
Definition Polygone.h:35
int nb_som() const override
Renvoie le nombre de sommets d'un Polygone.
Definition Polygone.h:110
Domaine_32_64< _SIZE_ > Domaine_t
Definition Polygone.h:43
void calculer_un_centre_gravite(const int_t elem, DoubleVect &xp) const override
Definition Polygone.cpp:411
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Polygone.h:38
void calculer_centres_gravite(DoubleTab_t &xp) const override
Compute all centers of mass of all elements in the domain.
Definition Polygone.cpp:364
void calculer_volumes(DoubleVect_t &vols) const override
NE FAIT RIEN: A CODER Calcule les volumes des elements du domaine associe.
Definition Polygone.cpp:246
int get_nb_som_elem_max() const
Definition Polygone.cpp:127
int nb_som_face(int=0) const override
Renvoie le nombre maximum de sommets des faces du type specifie.
Definition Polygone.h:144
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Polygone.h:40
ArrOfInt_t PolygonIndex_
Definition Polygone.h:87
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Polygone.h:42
void affecte_connectivite_numero_global(const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolygonIndex, IntTab_t &les_elems)
Definition Polygone.cpp:325
_SIZE_ int_t
Definition Polygone.h:37
void compute_virtual_index() override
Definition Polygone.cpp:114
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 Polygone.cpp:234
int get_nb_face_elem_max() const
Definition Polygone.h:65
IntTab_T< _SIZE_ > IntTab_t
Definition Polygone.h:39
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 Polygone.h:98
const ArrOfInt_t & getElemIndex() const override
Definition Polygone.h:70
int nb_faces(int=0) const override
Renvoie le nombre de faces du type specifie que possede l'element geometrique.
Definition Polygone.h:123
int contient(const ArrOfDouble &pos, int_t elem) const override
NE FAIT RIEN: A CODER, renvoie toujours 0.
Definition Polygone.cpp:200
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Polygone.h:41
const Nom & nom_lml() const override
Renvoie le nom LML d'un polyedre = "POLYEDRE_"+nb_som_max.
Definition Polygone.cpp:140
void rebuild_index()
Definition Polygone.cpp:58
Type_Face type_face(int=0) const override
Renvoie le i-ieme type de face.
Definition Polygone.h:158
const ArrOfInt_t & getPolygonIndex() const
Definition Polygone.h:69
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455