TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Segment.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 Segment_included
17#define Segment_included
18
19#include <Elem_geom_base.h>
20
21/*! @brief Class Segment: represents the geometric element segment.
22 *
23 * A segment has 1 face and 2 vertices.
24 *
25 * @sa Elem_geom_base Elem_geom
26 */
27template <typename _SIZE_>
28class Segment_32_64 : public Elem_geom_base_32_64<_SIZE_>
29{
30
31 Declare_instanciable_32_64(Segment_32_64);
32
33public :
34
35 using int_t = _SIZE_;
36 using IntTab_t = IntTab_T<_SIZE_>;
37 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
38 using DoubleVect_t = DoubleVect_T<_SIZE_>;
40
41
42 inline int face_sommet(int i, int j) const override;
43 inline int face_sommet0(int i) const;
44
45 inline int nb_som() const override { return 2; }
46 inline int nb_faces(int=0) const override;
47 inline int nb_som_face(int=0) const override;
48 inline bool est_structure() const override { return true; }
49 const Nom& nom_lml() const override;
50 int contient(const ArrOfDouble& pos, int_t elem) const override;
51 int contient(const SmallArrOfTID_t& soms, int_t elem) const override;
52 inline Type_Face type_face(int=0) const override;
53 void reordonner() override ;
54 void calculer_volumes(DoubleVect_t& vols) const override;
55 int get_tab_faces_sommets_locaux(IntTab& faces_som_local) const override;
56
57protected:
58 // Members herited from top classes:
60 using Elem_geom_base_32_64<_SIZE_>::mon_dom;
61};
62
63
64/*! @brief Returns the index of the j-th vertex of the i-th face of the element.
65 *
66 * @param i a face index
67 * @param j a vertex index
68 * @return the index of the j-th vertex of the i-th face
69 */
70template <typename _SIZE_>
71inline int Segment_32_64<_SIZE_>::face_sommet(int i, int j) const
72{
73 assert(i<2);
74 switch(i)
75 {
76 case 0:
77 return face_sommet0(j);
78 default :
79 return -1;
80 }
81}
82
83
84/*! @brief Returns the index of the i-th vertex of face 0. NOTE: THE CODE DOES NOT DO WHAT ONE WOULD EXPECT.
85 *
86 * @param i the index of the vertex to return
87 * @return always returns 0 (if i=0)
88 */
89template <typename _SIZE_>
91{
92 // face_sommet0(0)=0;
93 assert(i==0);
94 return 0;
95}
96
97
98/*! @brief Returns the number of faces of the specified type that the geometric element has.
99 *
100 * @param i the face type
101 * @return the number of faces of type i
102 */
103template <typename _SIZE_>
104inline int Segment_32_64<_SIZE_>::nb_faces(int i) const
105{
106 assert(i==0);
107 return 2;
108}
109
110
111/*! @brief Returns the number of vertices of faces of the specified type.
112 *
113 * NOTE: THE CODE DOES NOT DO WHAT ONE WOULD EXPECT.
114 *
115 * @param i the face type
116 * @return the number of vertices of faces of type i
117 */
118template <typename _SIZE_>
120{
121 assert(i==0);
122 return 1;
123}
124
125/*! @brief Returns the i-th face type.
126 *
127 * A segment has only one face type.
128 *
129 * @param i the rank of the face type to return
130 * @return a face type
131 */
132template <typename _SIZE_>
133inline Type_Face Segment_32_64<_SIZE_>::type_face(int i) const
134{
135 assert(i==0);
136 return Type_Face::point_1D;
137}
138
139
140using Segment = Segment_32_64<int>;
141using Segment_64 = Segment_32_64<trustIdType>;
142
143#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
Class Segment: represents the geometric element segment.
Definition Segment.h:29
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 Segment.h:71
Type_Face type_face(int=0) const override
Returns the i-th face type.
Definition Segment.h:133
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
See ElemGeomBase::get_tab_faces_sommets_locaux.
Definition Segment.cpp:173
int contient(const SmallArrOfTID_t &soms, int_t elem) const override
Returns 1 if the vertices specified by parameter "pos" are the vertices of element "element".
Definition Segment.cpp:131
_SIZE_ int_t
Definition Segment.h:35
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
Definition Segment.cpp:147
const Nom & nom_lml() const override
Returns the LML name of a segment.
Definition Segment.cpp:76
int nb_som_face(int=0) const override
Returns the number of vertices of faces of the specified type.
Definition Segment.h:119
bool est_structure() const override
Definition Segment.h:48
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Segment.h:37
IntTab_T< _SIZE_ > IntTab_t
Definition Segment.h:36
int face_sommet0(int i) const
Returns the index of the i-th vertex of face 0. NOTE: THE CODE DOES NOT DO WHAT ONE WOULD EXPECT.
Definition Segment.h:90
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Segment.h:38
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element "element" of the domain associated with this geometric element contains the poin...
Definition Segment.cpp:94
void reordonner() override
Reorders the vertices of the segment.
Definition Segment.cpp:45
int nb_som() const override
Nb of vertices for the element.
Definition Segment.h:45
int nb_faces(int=0) const override
Returns the number of faces of the specified type that the geometric element has.
Definition Segment.h:104
Domaine_32_64< _SIZE_ > Domaine_t
Definition Segment.h:39