TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Elem_geom_base.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 Elem_geom_base_included
17#define Elem_geom_base_included
18
19#include <TRUSTTabs_forward.h>
20#include <Faces.h>
21
22template<class _SIZE_> class Domaine_32_64;
23
24/*! @brief Class Elem_geom_base This class is the base class for the definition of elements
25 *
26 * geometric constituting a mesh (i.e. a geometric Domain)
27 * A geometric element has an associated Domain to which it provides
28 * the basic routines for manipulating its elements.
29 * (A domain has only one type of geometric element)
30 *
31 * @sa Hexaedre Prisme Rectangle Segment Tetraedre Triangle, Domaine, Abstract class, Abstract methods:, int face_sommet(int i, int j) const, int nb_som() const, int nb_faces(int=0) const, int nb_som_face(int=0) const, int est_structure() const, const Nom& nom_lml() const, int contient(const ArrOfDouble&, int ) const, int contient(const ArrOfInt&, int ) const, Type_Face type_face(int=0) const, void calculer_volumes(DoubleVect& ) const, void calculer_normales(const IntTab& , DoubleTab& ) const
32 */
33template <typename _SIZE_>
35{
36
37 Declare_base_32_64(Elem_geom_base_32_64);
38
39public:
40
41 using int_t = _SIZE_;
42 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
43 using IntVect_t = IntVect_T<_SIZE_>;
44 using IntTab_t = IntTab_T<_SIZE_>;
45 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
46 using ArrOfDouble_t= ArrOfDouble_T<_SIZE_>;
47 using DoubleVect_t = DoubleVect_T<_SIZE_>;
48 using DoubleTab_t = DoubleTab_T<_SIZE_>;
51
52
53 virtual void creer_faces_elem(Faces_t& ,int_t ,Type_Face ) const;
54 inline void creer_faces_elem(Faces_t& ,int_t ) const;
55 /// Returns the number of the j-th vertex of the i-th face of the element
56 virtual int face_sommet(int i, int j) const=0;
57 inline void associer_domaine(const Domaine_32_64<int_t>& dom) { mon_dom = dom; }
58 /// Nb of vertices for the element
59 virtual int nb_som() const=0;
60 /// Nb of faces for the element
61 virtual int nb_faces(int=0) const=0;
62 /// Nb of vertices for one face of the element
63 virtual int nb_som_face(int=0) const=0;
64 virtual bool est_structure() const=0;
65 virtual const Nom& nom_lml() const=0;
66 /// DOes the element 'elem' contains the point 'pos'
67 virtual int contient(const ArrOfDouble& pos, int_t elem) const=0;
68 /// Returns 1 if the vertices specified by the parameter "pos" are the vertices of the element "element" of the associated domain
69 virtual int contient(const SmallArrOfTID_t& soms, int_t elem) const=0;
70 /// Nb of face types of the elemnt (for example 2 for a prism)
71 virtual int nb_type_face() const;
72 virtual int num_face(int face, Type_Face& type) const;
73 /// Type of the face of the element - face_typ < nb_type_face()
74 virtual Type_Face type_face(int face_typ=0) const=0;
75 /// Compute all centers of mass of all elements in the domain
76 virtual void calculer_centres_gravite(DoubleTab_t& ) const ;
77 virtual void reordonner() { }
78 /// Compute vols of all elements in the domain
79 virtual void calculer_volumes(DoubleVect_t& vols) const =0;
80 virtual void calculer_normales(const IntTab_t& faces_sommets , DoubleTab_t& face_normales) const;
81 virtual int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const;
82 virtual void get_tab_aretes_sommets_locaux(IntTab& aretes_som_local) const;
83
84protected:
86};
87
88/*! @brief Create the faces of the element of the specified domain.
89 *
90 * @param (Faces_t& faces) the faces of the elements to create
91 * @param (int elem) the number of the element of the domain whose faces we want to create
92 */
93template <typename _SIZE_>
94inline void Elem_geom_base_32_64<_SIZE_>::creer_faces_elem(Faces_t& faces, _SIZE_ elem) const
95{
96 assert(nb_type_face() == 1);
97 creer_faces_elem(faces, elem, type_face());
98}
99
100using Elem_geom_base = Elem_geom_base_32_64<int>;
101using Elem_geom_base_64 = Elem_geom_base_32_64<trustIdType>;
102
103#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.
virtual int face_sommet(int i, int j) const =0
Returns the number of the j-th vertex of the i-th face of the element.
ArrOfDouble_T< int > ArrOfDouble_t
DoubleVect_T< int > DoubleVect_t
virtual void reordonner()
ArrOfInt_T< int > ArrOfInt_t
void associer_domaine(const Domaine_32_64< int_t > &dom)
virtual void calculer_normales(const IntTab_t &faces_sommets, DoubleTab_t &face_normales) const
Exits with an error. This method is not pure virtual for convenience.
Faces_32_64< int > Faces_t
virtual int contient(const ArrOfDouble &pos, int_t elem) const =0
DOes the element 'elem' contains the point 'pos'.
virtual int num_face(int face, Type_Face &type) const
Returns the face parameter if the specified face type matches that of the geometric element.
Domaine_32_64< int > Domaine_t
void creer_faces_elem(Faces_t &, int_t) const
Create the faces of the element of the specified domain.
SmallArrOfTID_T< int > SmallArrOfTID_t
virtual void calculer_centres_gravite(DoubleTab_t &) const
Compute all centers of mass of all elements in the domain.
DoubleTab_T< int > DoubleTab_t
virtual Type_Face type_face(int face_typ=0) const =0
Type of the face of the element - face_typ < nb_type_face().
virtual int contient(const SmallArrOfTID_t &soms, int_t elem) const =0
Returns 1 if the vertices specified by the parameter "pos" are the vertices of the element "element" ...
virtual void creer_faces_elem(Faces_t &, int_t, Type_Face) const
Creates the faces of the specified geometric element of the domain using the given face type.
virtual void calculer_volumes(DoubleVect_t &vols) const =0
Compute vols of all elements in the domain.
virtual const Nom & nom_lml() const =0
virtual bool est_structure() const =0
virtual int nb_type_face() const
Nb of face types of the elemnt (for example 2 for a prism).
virtual int nb_som_face(int=0) const =0
Nb of vertices for one face of the element.
virtual int nb_faces(int=0) const =0
Nb of faces for the element.
OBS_PTR(Domaine_t) mon_dom
virtual int nb_som() const =0
Nb of vertices for the element.
virtual void get_tab_aretes_sommets_locaux(IntTab &aretes_som_local) const
Same as Elem_geom_base::get_tab_faces_sommets_locaux but for edges: aretes_som_local.
virtual int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const
Fills faces_som_local(i,j) giving for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i) the local verte...
Class Faces Faces describes a set of faces by their type (point, segment, triangle or quadrangle),...
Definition Faces.h:50
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54