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