GCC Code Coverage Report


Directory: ./
File: DegreeOfFreedom/duplicateSupportDof.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // ______ ______ _ _ _____ ______
2 // | ____| ____| | (_)/ ____| | ____|
3 // | |__ | |__ | | _| (___ ___| |__
4 // | __| | __| | | | |\___ \ / __| __|
5 // | | | |____| |____| |____) | (__| |____
6 // |_| |______|______|_|_____/ \___|______|
7 // Finite Elements for Life Sciences and Engineering
8 //
9 // License: LGL2.1 License
10 // FELiScE default license: LICENSE in root folder
11 //
12 // Main authors: B. Fabreges, M. Fernandez and D. Corti
13 //
14
15 /*!
16 \file duplicateSupportDof.hpp
17 \authors B. Fabreges, M. Fernandez and D. Corti
18 \date 23/01/2014
19 \brief hpp file for the class DuplicateSupportDof
20 */
21
22 #ifndef _DuplicateSupportDof_HPP
23 #define _DuplicateSupportDof_HPP
24
25 // System includes
26
27 // External includes
28
29 // Project includes
30 #include "CommunicationInterfaces/XFMInterface.hpp"
31 #include "DegreeOfFreedom/supportDofMesh.hpp"
32 #include "Geometry/geometricMeshRegion.hpp"
33 #include "PETScInterface/petscVector_fwd.hpp"
34
35
36 namespace felisce {
37 /*!
38 * Class to manage the intersection of the two meshes and the duplication of the support elements
39 */
40 class DuplicateSupportDof
41 {
42
43 public:
44
45 // Constructor
46 DuplicateSupportDof();
47
48 // Destructor
49 2 ~DuplicateSupportDof() = default;
50
51 // Duplicate the support dofs
52 void duplicateIntersectedSupportElements(std::vector<SupportDofMesh>& supportDofUnknown);
53
54 /*!
55 * \brief Intersect two meshes
56 * \param[in] fluidMesh The fluid mesh.
57 * \param[in] strucMesh The solid mesh.
58 *
59 * After the update, the following steps are executed:
60 * - The intersection is computed and the information are extracted.
61 * - The intersected elements (volume and boundary) are marked for duplication aswell as their vertices.
62 */
63 void intersectMeshes(GeometricMeshRegion& fluidMesh, GeometricMeshRegion& strucMesh);
64
65 // As intersectMeshes + class initialization
66 void initAndIntersectMeshes(GeometricMeshRegion& fluidMesh, GeometricMeshRegion& strucMesh);
67
68 // Update the position of the solid mesh
69 void updateInterfacePosition(std::vector<double>& dispArray);
70
71 // Get the number of fluid sub-element for an element of the fluid mesh
72 felInt getNumSubMshEltMshOld(felInt iel, felInt idTimeStep) const;
73
74 // Get the id of the ielSub-th fluid sub-element of fluid element iel
75 felInt getSubMshEltIdxMshOld(felInt iel, felInt ielSub, felInt idTimeStep) const;
76
77 // Get the coordinates of the iPt-th vertex of the sub-element ielSub for the fluid
78 void getSubMshEltVerCrdOld(felInt ielSub, felInt iPt, std::vector<double>& coor, felInt idTimeStep) const;
79
80 // Get the side of the sub-element
81 sideOfInterface getSubMshEltSideOld(felInt ielSub, felInt idTimeStep) const;
82
83 // Get the number of fluid sub-element for an element of the fluid mesh
84 felInt getNumSubMshEltPerMshElt(felInt iel) const;
85
86 // Get the id of the ielSub-th fluid sub-element of fluid element iel
87 felInt getSubMshEltIdxMsh(felInt iel, felInt ielSub) const;
88
89 // Get the coordinates of the iPt-th vertex of the sub-element ielSub for the fluid
90 void getSubMshEltVerCrd(felInt ielSub, felInt iPt, std::vector<double>& coor) const;
91
92 // Get the side of the sub-element
93 sideOfInterface getSubMshEltSide(felInt iel, felInt ielSub) const;
94
95 // Get the number of solid sub-element for an element of the fluid mesh
96 felInt getNumSubItfEltPerMshElt(felInt iel) const;
97
98 // Get the id of the ielSub-th solid sub-element of fluid element iel
99 felInt getSubItfEltIdxMsh(felInt iel, felInt ielSub) const;
100
101 // Get the coordinates of the iPt-th vertex of the sub-element ielSub for the solid
102 void getSubItfEltVerCrd(felInt ielSub, felInt iPt, std::vector<double>& coor) const;
103
104 // Get the number of solid sub-element for an element of the solid mesh
105 felInt getNumSubItfEltPerItfElt(felInt iel) const;
106
107 // Get the id of the ielSub-th solid sub-element of solid element iel
108 felInt getSubItfEltIdxItf(felInt iel, felInt ielSub) const;
109
110 // Get the id of the fluid element owning the sub-solid element ielSub
111 felInt getMshEltIdxOfSubItfElt(felInt ielSub) const;
112
113 // Get the id of the solid element owning the sub-solid element ielSub
114 felInt getItfEltIdxOfSubItfElt(felInt ielSub) const;
115
116 // Get the number of fluid Tip element
117 felInt getNumTipElt() const;
118
119 // Get the Id of fluid Tip element iTipElt
120 felInt getTipEltIdx(felInt ielTip) const;
121
122 // Get the reference of iterface element iel
123 felInt getItfEltRef(felInt iel) const;
124
125 // Get the number of subfaces of the ifa^th face of ielTip
126 felInt getNumSubFacPerFacTipElt(felInt ielTip, felInt ifa) const;
127
128 // Get the idx of the isubFac-th sub-face of the ifa-th face of ielTip
129 felInt getSubTipFacIdxMsh(felInt ielTip, felInt ifa, felInt isubFac) const;
130
131 // Get the coordinates of the iPt point of the tip isubFac
132 void getSubTipFacVerCrd(felInt iSubFac, felInt iPt, std::vector<double>& coor) const;
133
134 // Get the side of the subFace
135 sideOfInterface getSgnSubFace(felInt SubFac) const;
136
137 // Get the side of the opposite subFace
138 sideOfInterface getSgnSubOppFace(felInt SubFac) const;
139
140 // Get the number of front points
141 felInt getNumFrontPoints() const;
142
143 // Get the information on the iVer-th front point
144 void getFrontPointInfo(felInt iVer, std::vector<felInt>& verFro) const;
145
146 // Check if the vertex iVer is a front point
147 bool checkFrontPoint(felInt iVer) const;
148
149 // Check if the intersection has change after moving the interface
150 bool hasIntersectionChange() const;
151
152 // Get a reference to the map m_idVerMsh
153 const std::map<felInt, std::map<felInt, felInt> >& getIntersectedVerMsh() const;
154
155 // Get a reference to the map m_intersectedMshEltIdx
156 const std::map<felInt, felInt>& getIntersectedMshElt() const;
157
158 // Get a reference to the map m_idTipElement
159 const std::set<felInt>& getIntersectedTipElt() const;
160
161 // Get the sub element of a boundary element
162 void getSubBndElt(felInt iel, std::vector< std::vector <Point> >& bndElem) const;
163
164 // Get the side of a boundary sub element
165 void getSubBndEltSide(felInt iel, std::vector<sideOfInterface>& bndElemSide) const;
166
167 // Get map edge/face
168 const std::vector<short unsigned int>& getMapFaceFelisceToIntersector(felInt dim) const;
169
170 // Set the verbose level
171 void setVerbose(felInt verbose);
172
173 // Set meshes name
174 void setMeshesName(std::string fluidMesh, std::string strucMesh);
175
176 // Set iteration
177 void setIteration(felInt iteration);
178
179
180 private:
181
182 // Initialize old arrays to store information about previous intersections
183 void initializeOldArrays();
184
185 // Update old arrays with current intersection info
186 void updateOldArrays();
187
188 // Print
189 void print() const;
190
191 // Interface to Xfm library
192 XFMInterface m_XFMInterface;
193
194 // Dynamic update
195 bool m_hasIntersectionChange;
196
197 // Initialization
198 bool m_isDSPinit;
199
200 // Verbosity
201 felInt m_verbose;
202
203 // Dimension of the fluid mesh
204 felInt m_dim;
205
206 // map of the original id of the fluid mesh paired with the iterface Idx to its duplicated id
207 std::map<felInt, std::map<felInt, felInt> > m_intersectedVerMshIdx;
208
209 // Idx of the intersected element to Idx interface intersecting the element
210 std::map<felInt, felInt> m_intersectedMshEltIdx;
211
212 // Vertices local signs for every intersected element
213 std::map<felInt, std::vector<felInt> > m_intersectedEltVerSgn;
214
215 // Idx of the intersected tip element
216 std::set<felInt> m_intersectedTipEltIdx;
217
218 // sub element of the intersected boundary elements
219 std::map<felInt, std::vector< std::vector<Point> > > m_subBndEltCrd;
220
221 // side of the sub boundary elements
222 std::map<felInt, std::vector<sideOfInterface> > m_subBndEltSide;
223
224 // Old arrays
225 std::vector<std::vector<felInt>> m_oldPtrIntEltMsh;
226 std::vector<std::vector<felInt>> m_oldLstIntEltMsh;
227 std::vector<std::vector<std::array<double,3>>> m_oldCrdMsh;
228 std::vector<std::vector<std::array<felInt,4>>> m_oldEltMsh;
229 std::vector<std::vector<felInt>> m_oldEltSgn;
230 };
231 }
232
233 #endif
234