TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Faces.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 Faces_included
17#define Faces_included
18
19#include <TRUST_Ref.h>
20#include <TRUSTTab.h>
21
22class Motcle;
23#include <Domaine_forward.h>
24
25/*! @brief enum Type_Face The different geometric types of faces.
26 * @sa Faces
27 */
28enum class Type_Face
29{
30 vide_0D,
31 point_1D,
32 point_1D_axi,
33 segment_2D,
34 segment_2D_axi,
35 triangle_3D,
36 quadrilatere_2D_axi,
37 quadrangle_3D,
38 quadrangle_3D_axi,
39 polygone_3D
40};
41
42
43/*! @brief Class Faces Faces describes a set of faces by their type (point, segment, triangle or quadrangle),
44 * their vertices and their adjacent elements.
45 *
46 * @sa IntTab Frontiere
47 */
48template <typename _SIZE_>
49class Faces_32_64 : public Objet_U
50{
51 Declare_instanciable_32_64(Faces_32_64);
52
53public:
54
55 using int_t = _SIZE_;
56 using IntVect_t = IntVect_T<_SIZE_>;
57 using IntTab_t = IntTab_T<_SIZE_>;
58 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
59 using DoubleVect_t = DoubleVect_T<_SIZE_>;
60 using DoubleTab_t = DoubleTab_T<_SIZE_>;
63
64
65 inline Type_Face type_face() const { return type_face_; }
66 inline int_t nb_faces() const { return sommets.dimension(0); }
67 /// @brief Returns the total number of Faces i (real and virtual) on the current processor
68 inline int_t nb_faces_tot() const { return sommets.dimension_tot(0); }
69 inline int nb_som_faces() const;
70
71 inline int_t sommet(int_t, int) const;
72 inline int_t& sommet(int_t, int);
73 /// Returns the array of vertices of all faces
74 inline const IntTab_t& les_sommets() const { return sommets; }
75 inline IntTab_t& les_sommets() { return sommets; }
76
77 Type_Face type(const Motcle&) const;
78 Motcle& type(const Type_Face&) const;
79
80 void ajouter(const IntTab_t&);
81 void typer(const Motcle&);
82 void typer(const Type_Face&);
83
85
86 inline int_t voisin(int_t, int) const;
87 inline int_t& voisin(int_t, int);
88 /// @brief Returns the array of neighbors (of the faces).
89 inline IntTab_t& voisins() { return faces_voisins; }
90 inline const IntTab_t& voisins() const { return faces_voisins; }
91
92 void completer(int_t face, int_t num_elem);
93
94 inline void associer_domaine(const Domaine_t& z) { mon_dom=z; }
95 inline const Domaine_t& domaine() const { return mon_dom.valeur(); }
96
99 void reordonner();
100 IntVect_t& compare(const Faces_32_64& other_fac, IntVect_t& renum);
101 void initialiser_faces_joint(int_t nb_faces_joints);
103
105 Sortie& ecrit(Sortie&) const ;
106
107 // Static because used by others (like DecoupeBord):
108 static void Calculer_centres_gravite(DoubleTab_t& xv, Type_Face type_face_, const DoubleTab_t& coord, const IntTab_t& sommet);
109
110private :
111 // Useful tool methods:
112 int_t ppsf(int_t face, int nb_som) const;
113 bool same_face(int_t f1, const Faces_32_64& faces2, int_t f2, int nb_som) const;
114
115 Type_Face type_face_ = Type_Face::vide_0D;
116 int nb_som_face = 0; ///< Number of vertices per face
117 IntTab_t sommets;
118 IntTab_t faces_voisins;
119 OBS_PTR(Domaine_t) mon_dom;
120};
121
122
123/*! @brief Returns the number of the j-th vertex of the i-th face
124 *
125 * @param (int i) index of the face of the vertex to return
126 * @param (int j) index of the vertex to return
127 * @return (int) the number of the j-th vertex of the i-th face
128 */
129template <typename _SIZE_>
131{
132 return sommets(i,j);
133}
134
135/*! @brief Returns a reference to the number of the j-th vertex of the i-th face
136 *
137 * @param (int i) index of the face of the vertex to return
138 * @param (int j) index of the vertex to return
139 * @return (int&) reference to the number of the j-th vertex of the i-th face
140 */
141template <typename _SIZE_>
143{
144 return sommets(i,j);
145}
146
147/// @brief Returns the number of vertices per face.
148template <typename _SIZE_>
150{
151 if (nb_som_face!=-1)
152 return nb_som_face;
153 else
154 return sommets.dimension_int(1);
155}
156
157
158/*! @brief Returns the number of the i-th neighbor of face.
159 *
160 * @param (int face) the number of the face whose neighbor we seek
161 * @param (int i) the index of the neighbor to return
162 * @return (int) the i-th neighbor number of face
163 */
164template <typename _SIZE_>
166{
167 return faces_voisins(face,i);
168}
169
170/*! @brief Returns a reference to the number of the i-th neighbor of face.
171 *
172 * @param (int face) the number of the face whose neighbor we seek
173 * @param (int i) the index of the neighbor to return
174 * @return (int&) reference to the number of the i-th neighbor of face
175 */
176template <typename _SIZE_>
178{
179 return faces_voisins(face,i);
180}
181
182
183using Faces = Faces_32_64<int>;
184using Faces_64 = Faces_32_64<trustIdType>;
185
186#endif
: class DomaineAxi1d
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 Faces Faces describes a set of faces by their type (point, segment, triangle or quadrangle),...
Definition Faces.h:50
int_t nb_faces_tot() const
Returns the total number of Faces i (real and virtual) on the current processor.
Definition Faces.h:68
SmallArrOfTID_T< int > SmallArrOfTID_t
Definition Faces.h:58
void typer(const Motcle &)
Sets the type of the faces.
Definition Faces.cpp:382
void associer_domaine(const Domaine_t &z)
Definition Faces.h:94
void initialiser_sommets_faces_joint(int_t nb_faces_joints)
Initializes the vertices of joint faces to -1.
Definition Faces.cpp:369
IntTab_t & voisins()
Returns the array of neighbors (of the faces).
Definition Faces.h:89
void calculer_surfaces(DoubleVect_t &surf) const
Computes the surface area of the faces.
Definition Faces.cpp:487
int_t & sommet(int_t, int)
Returns a reference to the number of the j-th vertex of the i-th face.
Definition Faces.h:142
DoubleVect_T< int > DoubleVect_t
Definition Faces.h:59
Motcle & type(const Type_Face &) const
Returns the name associated with a face type.
Definition Faces.cpp:265
void reordonner()
Reorders the faces.
Definition Faces.cpp:881
void typer(const Type_Face &)
Sets the type of the faces.
Definition Faces.cpp:393
Type_Face type(const Motcle &) const
Returns a Type_Face object representing the type with the specified name.
Definition Faces.cpp:199
const Domaine_t & domaine() const
Definition Faces.h:95
int_t & voisin(int_t, int)
Returns a reference to the number of the i-th neighbor of face.
Definition Faces.h:177
int_t nb_faces() const
Definition Faces.h:66
IntVect_t & compare(const Faces_32_64 &other_fac, IntVect_t &renum)
Compares the Faces_32_64 object passed as parameter with this Faces_32_64 object.
Definition Faces.cpp:1094
void completer(int_t face, int_t num_elem)
Completes the specified face: updates its neighbors.
Definition Faces.cpp:458
Entree & lit(Entree &)
Reads the specifications of a face object from an input stream (binary format).
Definition Faces.cpp:119
void calculer_centres_gravite(DoubleTab_t &xv) const
Computes the centers of gravity of each face.
Definition Faces.cpp:768
int_t dimensionner(int_t)
(Re-)sizes the faces. The neighbors are resized accordingly.
Definition Faces.cpp:336
Sortie & ecrit(Sortie &) const
Writes the faces to an output stream (binary format).
Definition Faces.cpp:61
IntTab_T< int > IntTab_t
Definition Faces.h:57
Domaine_32_64< int > Domaine_t
Definition Faces.h:61
int_t voisin(int_t, int) const
Returns the number of the i-th neighbor of face.
Definition Faces.h:165
IntVect_T< int > IntVect_t
Definition Faces.h:56
void initialiser_faces_joint(int_t nb_faces_joints)
Initializes the neighbors of joint faces to -1.
Definition Faces.cpp:357
DomaineAxi1d_32_64< int > DomaineAxi1d_t
Definition Faces.h:62
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
Definition Faces.h:74
IntTab_t & les_sommets()
Definition Faces.h:75
void ajouter(const IntTab_t &)
Adds faces.
Definition Faces.cpp:317
int_t sommet(int_t, int) const
Returns the number of the j-th vertex of the i-th face.
Definition Faces.h:130
DoubleTab_T< int > DoubleTab_t
Definition Faces.h:60
Type_Face type_face() const
Definition Faces.h:65
static void Calculer_centres_gravite(DoubleTab_t &xv, Type_Face type_face_, const DoubleTab_t &coord, const IntTab_t &sommet)
Definition Faces.cpp:778
int nb_som_faces() const
Returns the number of vertices per face.
Definition Faces.h:149
const IntTab_t & voisins() const
Definition Faces.h:90
A character string (Nom) in uppercase.
Definition Motcle.h:26
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54