Directory: | ./ |
---|---|
File: | DegreeOfFreedom/duplicateSupportDof.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 145 | 206 | 70.4% |
Branches: | 56 | 148 | 37.8% |
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.cpp | ||
17 | \authors B. Fabreges, M. Fernandez and D. Corti | ||
18 | \date 23/01/2014 | ||
19 | \brief Class to manage the duplication of the support dof | ||
20 | */ | ||
21 | |||
22 | // System includes | ||
23 | #include <algorithm> | ||
24 | #include <numeric> | ||
25 | |||
26 | // External includes | ||
27 | |||
28 | // Project includes | ||
29 | #include "DegreeOfFreedom/duplicateSupportDof.hpp" | ||
30 | |||
31 | |||
32 | namespace felisce { | ||
33 | |||
34 | 2 | DuplicateSupportDof::DuplicateSupportDof() | |
35 | { | ||
36 | 2 | m_hasIntersectionChange = false; | |
37 | 2 | m_isDSPinit = false; | |
38 | |||
39 | 2 | m_verbose = 0; | |
40 | 2 | m_dim = -1; | |
41 | |||
42 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | m_oldPtrIntEltMsh.resize(FelisceParam::instance().orderBdfNS+FelisceParam::instance().orderPressureExtrapolation); |
43 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | m_oldLstIntEltMsh.resize(FelisceParam::instance().orderBdfNS+FelisceParam::instance().orderPressureExtrapolation); |
44 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | m_oldCrdMsh.resize( FelisceParam::instance().orderBdfNS+FelisceParam::instance().orderPressureExtrapolation); |
45 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | m_oldEltMsh.resize( FelisceParam::instance().orderBdfNS+FelisceParam::instance().orderPressureExtrapolation); |
46 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
2 | m_oldEltSgn.resize( FelisceParam::instance().orderBdfNS+FelisceParam::instance().orderPressureExtrapolation); |
47 | 2 | } | |
48 | |||
49 | /***********************************************************************************/ | ||
50 | /***********************************************************************************/ | ||
51 | |||
52 | 13 | void DuplicateSupportDof::duplicateIntersectedSupportElements(std::vector<SupportDofMesh>& supportDofUnknown) | |
53 | { | ||
54 | //- Check if class already initialized | ||
55 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | FEL_ASSERT(m_isDSPinit); |
56 | |||
57 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 2 taken 13 times.
|
39 | for(std::size_t iUnknown=0; iUnknown < supportDofUnknown.size(); ++iUnknown) |
58 | 26 | supportDofUnknown[iUnknown].duplicateSupportElements(m_intersectedMshEltIdx, m_intersectedEltVerSgn, m_intersectedVerMshIdx); | |
59 | 13 | } | |
60 | |||
61 | /***********************************************************************************/ | ||
62 | /***********************************************************************************/ | ||
63 | |||
64 | 20 | void DuplicateSupportDof::intersectMeshes(GeometricMeshRegion& fluidMesh, GeometricMeshRegion& /*strucMesh*/) | |
65 | { | ||
66 | //- Check if class already initialized | ||
67 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | FEL_ASSERT(m_isDSPinit); |
68 | |||
69 | //- Update old arrays | ||
70 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | updateOldArrays(); |
71 | |||
72 | //- Prepare for new intersection | ||
73 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | m_XFMInterface.prepareNextIntersection(); |
74 | |||
75 | |||
76 | //--- Compute intersection | ||
77 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | m_XFMInterface.computeIntersection(); |
78 | |||
79 | |||
80 | //--- Copy old maps | ||
81 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | std::map<felInt, felInt> oldIntersectedMshEltIdx(m_intersectedMshEltIdx); |
82 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | std::map<felInt, std::vector<felInt> > oldIntersectedEltVerSgn(m_intersectedEltVerSgn); |
83 | 20 | std::size_t oldIdVerMshSize = m_intersectedVerMshIdx.size(); | |
84 | |||
85 | |||
86 | //--- Clean everything | ||
87 | 20 | m_intersectedMshEltIdx.clear(); | |
88 | 20 | m_intersectedEltVerSgn.clear(); | |
89 | 20 | m_intersectedTipEltIdx.clear(); | |
90 | 20 | m_intersectedVerMshIdx.clear(); | |
91 | 20 | m_subBndEltCrd.clear(); | |
92 | 20 | m_subBndEltSide.clear(); | |
93 | |||
94 | |||
95 | //--- Fill data strutures for duplication | ||
96 | //- Volume elements | ||
97 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | m_XFMInterface.markElementsForDuplication(fluidMesh, m_intersectedMshEltIdx, m_intersectedEltVerSgn, m_intersectedVerMshIdx); |
98 | |||
99 | //- Boundary elements | ||
100 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | m_XFMInterface.markBoundaryForDuplication(fluidMesh, m_intersectedMshEltIdx, m_intersectedEltVerSgn, m_subBndEltCrd, m_subBndEltSide); |
101 | |||
102 | |||
103 | //--- Post processing for tip elements | ||
104 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | m_XFMInterface.postProcessTipElements(m_intersectedTipEltIdx, m_intersectedVerMshIdx); |
105 | |||
106 | |||
107 | //--- Check if new intersection have been made (comparing with the previous time step) | ||
108 | 20 | m_hasIntersectionChange = false; | |
109 | |||
110 |
3/4✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
✓ Branch 4 taken 7 times.
|
20 | if ( m_intersectedMshEltIdx != oldIntersectedMshEltIdx ) { |
111 | |||
112 | 13 | m_hasIntersectionChange = true; | |
113 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
|
7 | } else if( oldIdVerMshSize != m_intersectedVerMshIdx.size() ) { |
114 | // check the duplicated vertex. | ||
115 | // It is possible that the same elements are intersected but not the nodes. For a tip that | ||
116 | // disappears because of contact for example (the number will be different) | ||
117 | ✗ | m_hasIntersectionChange = true; | |
118 |
2/4✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
|
7 | } else if ( m_intersectedEltVerSgn != oldIntersectedEltVerSgn ) { |
119 | // check if the sign of the original vertex has changed | ||
120 | ✗ | m_hasIntersectionChange = true; | |
121 | } | ||
122 | |||
123 | //- Output | ||
124 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | print(); |
125 | 20 | } | |
126 | |||
127 | /***********************************************************************************/ | ||
128 | /***********************************************************************************/ | ||
129 | |||
130 | 2 | void DuplicateSupportDof::initAndIntersectMeshes(GeometricMeshRegion& fluidMesh, GeometricMeshRegion& strucMesh) | |
131 | { | ||
132 | |||
133 | //- Check if class is not already initialized | ||
134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | FEL_ASSERT(!m_isDSPinit); |
135 | |||
136 | //- Set dimension | ||
137 | 2 | m_dim = fluidMesh.domainDim(); | |
138 | |||
139 | |||
140 | //--- Initialize the interface to the library | ||
141 | 2 | m_XFMInterface.initialize(fluidMesh, strucMesh); | |
142 | |||
143 | |||
144 | //--- Compute intersection | ||
145 | 2 | m_XFMInterface.computeIntersection(); | |
146 | |||
147 | //- Initialize the old arrays | ||
148 | 2 | initializeOldArrays(); | |
149 | |||
150 | |||
151 | //--- Clean everything | ||
152 | 2 | m_intersectedMshEltIdx.clear(); | |
153 | 2 | m_intersectedEltVerSgn.clear(); | |
154 | 2 | m_intersectedTipEltIdx.clear(); | |
155 | 2 | m_intersectedVerMshIdx.clear(); | |
156 | 2 | m_subBndEltCrd.clear(); | |
157 | 2 | m_subBndEltSide.clear(); | |
158 | |||
159 | |||
160 | //--- Fill data strutures for duplication | ||
161 | //- Volume elements | ||
162 | 2 | m_XFMInterface.markElementsForDuplication(fluidMesh, m_intersectedMshEltIdx, m_intersectedEltVerSgn, m_intersectedVerMshIdx); | |
163 | |||
164 | //- Boundary elements | ||
165 | 2 | m_XFMInterface.markBoundaryForDuplication(fluidMesh, m_intersectedMshEltIdx, m_intersectedEltVerSgn, m_subBndEltCrd, m_subBndEltSide); | |
166 | |||
167 | |||
168 | //--- Post processing for tip elements | ||
169 | 2 | m_XFMInterface.postProcessTipElements(m_intersectedTipEltIdx, m_intersectedVerMshIdx); | |
170 | |||
171 | //- Output | ||
172 | 2 | print(); | |
173 | |||
174 | |||
175 | //--- Initialisation is done | ||
176 | 2 | m_isDSPinit = true; | |
177 | 2 | } | |
178 | |||
179 | /***********************************************************************************/ | ||
180 | /***********************************************************************************/ | ||
181 | |||
182 | 20 | void DuplicateSupportDof::updateInterfacePosition(std::vector<double>& dispArray) | |
183 | { | ||
184 | //- Check if class already initialized | ||
185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | FEL_ASSERT(m_isDSPinit); |
186 | |||
187 | 20 | m_XFMInterface.updatePosition(dispArray); | |
188 | 20 | } | |
189 | |||
190 | /***********************************************************************************/ | ||
191 | /***********************************************************************************/ | ||
192 | |||
193 | 48 | felInt DuplicateSupportDof::getNumSubMshEltMshOld(felInt iel, felInt idTimeStep) const | |
194 | { | ||
195 | |||
196 | 48 | return m_oldPtrIntEltMsh[idTimeStep][iel+1] - m_oldPtrIntEltMsh[idTimeStep][iel]; | |
197 | } | ||
198 | |||
199 | /***********************************************************************************/ | ||
200 | /***********************************************************************************/ | ||
201 | |||
202 | 144 | felInt DuplicateSupportDof::getSubMshEltIdxMshOld(felInt iel, felInt ielSub, felInt idTimeStep) const | |
203 | { | ||
204 | |||
205 | 144 | return m_oldLstIntEltMsh[idTimeStep][m_oldPtrIntEltMsh[idTimeStep][iel]+ielSub]; | |
206 | } | ||
207 | |||
208 | /***********************************************************************************/ | ||
209 | /***********************************************************************************/ | ||
210 | |||
211 | 432 | void DuplicateSupportDof::getSubMshEltVerCrdOld(felInt ielSub, felInt iPt, std::vector<double>& coor, felInt idTimeStep) const | |
212 | { | ||
213 |
2/2✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 432 times.
|
1728 | for(std::size_t i = 0; i < 3; ++i) { |
214 | 1296 | coor[i] = m_oldCrdMsh[idTimeStep][m_oldEltMsh[idTimeStep][ielSub][iPt]][i]; | |
215 | } | ||
216 | 432 | } | |
217 | |||
218 | /***********************************************************************************/ | ||
219 | /***********************************************************************************/ | ||
220 | |||
221 | 144 | sideOfInterface DuplicateSupportDof::getSubMshEltSideOld(felInt ielSub, felInt idTimeStep) const | |
222 | { | ||
223 | |||
224 | 144 | return static_cast<sideOfInterface>(m_oldEltSgn[idTimeStep][ielSub]); | |
225 | } | ||
226 | |||
227 | /***********************************************************************************/ | ||
228 | /***********************************************************************************/ | ||
229 | |||
230 | 138296 | felInt DuplicateSupportDof::getNumSubMshEltPerMshElt(felInt iel) const | |
231 | { | ||
232 | 138296 | return m_XFMInterface.getNumSubMshEltPerMshElt(iel); | |
233 | } | ||
234 | |||
235 | /***********************************************************************************/ | ||
236 | /***********************************************************************************/ | ||
237 | |||
238 | 11216 | felInt DuplicateSupportDof::getSubMshEltIdxMsh(felInt iel, felInt ielSub) const | |
239 | { | ||
240 | |||
241 | 11216 | return m_XFMInterface.getSubMshEltIdxMsh(iel, ielSub); | |
242 | } | ||
243 | |||
244 | /***********************************************************************************/ | ||
245 | /***********************************************************************************/ | ||
246 | |||
247 | 16824 | void DuplicateSupportDof::getSubMshEltVerCrd(felInt ielSub, felInt iPt, std::vector<double>& coor) const | |
248 | { | ||
249 | |||
250 | 16824 | m_XFMInterface.getSubMshEltVerCrd(ielSub,iPt,coor); | |
251 | 16824 | } | |
252 | |||
253 | /***********************************************************************************/ | ||
254 | /***********************************************************************************/ | ||
255 | |||
256 | 11216 | sideOfInterface DuplicateSupportDof::getSubMshEltSide(felInt iel, felInt ielSub) const | |
257 | { | ||
258 | |||
259 | 11216 | return static_cast<sideOfInterface>(m_XFMInterface.getSubMshEltSide(iel, ielSub)); | |
260 | } | ||
261 | |||
262 | /***********************************************************************************/ | ||
263 | /***********************************************************************************/ | ||
264 | |||
265 | 141128 | felInt DuplicateSupportDof::getNumSubItfEltPerMshElt(felInt iel) const | |
266 | { | ||
267 | |||
268 | 141128 | return m_XFMInterface.getNumSubItfEltPerMshElt(iel); | |
269 | } | ||
270 | |||
271 | /***********************************************************************************/ | ||
272 | /***********************************************************************************/ | ||
273 | |||
274 | 8224 | felInt DuplicateSupportDof::getSubItfEltIdxMsh(felInt iel, felInt ielSub) const | |
275 | { | ||
276 | |||
277 | 8224 | return m_XFMInterface.getSubItfEltIdxMsh(iel, ielSub); | |
278 | } | ||
279 | |||
280 | /***********************************************************************************/ | ||
281 | /***********************************************************************************/ | ||
282 | |||
283 | 20560 | void DuplicateSupportDof::getSubItfEltVerCrd(felInt ielSub, felInt iPt, std::vector<double>& coor) const | |
284 | { | ||
285 | |||
286 | 20560 | m_XFMInterface.getSubItfEltVerCrd(ielSub,iPt,coor); | |
287 | 20560 | } | |
288 | |||
289 | /***********************************************************************************/ | ||
290 | /***********************************************************************************/ | ||
291 | |||
292 | 720 | felInt DuplicateSupportDof::getNumSubItfEltPerItfElt(felInt iel) const | |
293 | { | ||
294 | |||
295 | 720 | return m_XFMInterface.getNumSubItfEltPerItfElt(iel); | |
296 | } | ||
297 | |||
298 | /***********************************************************************************/ | ||
299 | /***********************************************************************************/ | ||
300 | |||
301 | 2056 | felInt DuplicateSupportDof::getSubItfEltIdxItf(felInt iel, felInt ielSub) const | |
302 | { | ||
303 | |||
304 | 2056 | return m_XFMInterface.getSubItfEltIdxItf(iel, ielSub); | |
305 | } | ||
306 | |||
307 | /***********************************************************************************/ | ||
308 | /***********************************************************************************/ | ||
309 | |||
310 | 2056 | felInt DuplicateSupportDof::getMshEltIdxOfSubItfElt(felInt ielSub) const | |
311 | { | ||
312 | |||
313 | 2056 | return m_XFMInterface.getMshEltIdxOfSubItfElt(ielSub); | |
314 | } | ||
315 | |||
316 | /***********************************************************************************/ | ||
317 | /***********************************************************************************/ | ||
318 | |||
319 | 8224 | felInt DuplicateSupportDof::getItfEltIdxOfSubItfElt(felInt ielSub) const | |
320 | { | ||
321 | |||
322 | 8224 | return m_XFMInterface.getItfEltIdxOfSubItfElt(ielSub); | |
323 | } | ||
324 | |||
325 | /***********************************************************************************/ | ||
326 | /***********************************************************************************/ | ||
327 | |||
328 | ✗ | felInt DuplicateSupportDof::getNumTipElt() const | |
329 | { | ||
330 | |||
331 | ✗ | return m_XFMInterface.getNumTipElt(); | |
332 | } | ||
333 | |||
334 | /***********************************************************************************/ | ||
335 | /***********************************************************************************/ | ||
336 | |||
337 | ✗ | felInt DuplicateSupportDof::getTipEltIdx(felInt ielTip) const | |
338 | { | ||
339 | ✗ | return m_XFMInterface.getTipEltIdx(ielTip); | |
340 | } | ||
341 | |||
342 | /***********************************************************************************/ | ||
343 | /***********************************************************************************/ | ||
344 | |||
345 | ✗ | felInt DuplicateSupportDof::getItfEltRef(felInt iel) const | |
346 | { | ||
347 | |||
348 | ✗ | return m_XFMInterface.getItfEltRef(iel); | |
349 | } | ||
350 | |||
351 | /***********************************************************************************/ | ||
352 | /***********************************************************************************/ | ||
353 | |||
354 | ✗ | felInt DuplicateSupportDof::getNumSubFacPerFacTipElt(felInt ielTip, felInt ifa) const | |
355 | { | ||
356 | |||
357 | ✗ | return m_XFMInterface.getNumSubFacPerFacTipElt(ielTip, ifa); | |
358 | } | ||
359 | |||
360 | /***********************************************************************************/ | ||
361 | /***********************************************************************************/ | ||
362 | |||
363 | ✗ | felInt DuplicateSupportDof::getSubTipFacIdxMsh(felInt ielTip, felInt ifa, felInt isubFac) const | |
364 | { | ||
365 | |||
366 | ✗ | return m_XFMInterface.getSubTipFacIdxMsh(ielTip, ifa, isubFac); | |
367 | } | ||
368 | |||
369 | /***********************************************************************************/ | ||
370 | /***********************************************************************************/ | ||
371 | |||
372 | ✗ | void DuplicateSupportDof::getSubTipFacVerCrd(felInt iSubFac, felInt iPt, std::vector<double>& coor) const | |
373 | { | ||
374 | |||
375 | ✗ | m_XFMInterface.getSubTipFacVerCrd(iSubFac, iPt, coor); | |
376 | } | ||
377 | |||
378 | /***********************************************************************************/ | ||
379 | /***********************************************************************************/ | ||
380 | |||
381 | ✗ | sideOfInterface DuplicateSupportDof::getSgnSubFace(felInt iSubFac) const | |
382 | { | ||
383 | |||
384 | ✗ | return static_cast<sideOfInterface>(m_XFMInterface.getSgnSubFace(iSubFac)); | |
385 | } | ||
386 | |||
387 | /***********************************************************************************/ | ||
388 | /***********************************************************************************/ | ||
389 | |||
390 | ✗ | sideOfInterface DuplicateSupportDof::getSgnSubOppFace(felInt iSubFac) const | |
391 | { | ||
392 | |||
393 | ✗ | return static_cast<sideOfInterface>(m_XFMInterface.getSgnSubOppFace(iSubFac)); | |
394 | } | ||
395 | |||
396 | /***********************************************************************************/ | ||
397 | /***********************************************************************************/ | ||
398 | |||
399 | 40 | felInt DuplicateSupportDof::getNumFrontPoints() const | |
400 | { | ||
401 | |||
402 | 40 | return m_XFMInterface.getNumFrontPoints(); | |
403 | } | ||
404 | |||
405 | /***********************************************************************************/ | ||
406 | /***********************************************************************************/ | ||
407 | |||
408 | 160 | void DuplicateSupportDof::getFrontPointInfo(felInt iVer, std::vector<felInt>& verFro) const | |
409 | { | ||
410 | |||
411 | 160 | m_XFMInterface.getFrontPointInfo(iVer, verFro); | |
412 | 160 | } | |
413 | |||
414 | /***********************************************************************************/ | ||
415 | /***********************************************************************************/ | ||
416 | |||
417 | 16 | bool DuplicateSupportDof::checkFrontPoint(felInt iVer) const | |
418 | { | ||
419 | |||
420 | 16 | return m_XFMInterface.checkFrontPoint(iVer); | |
421 | } | ||
422 | |||
423 | /***********************************************************************************/ | ||
424 | /***********************************************************************************/ | ||
425 | |||
426 | 60 | bool DuplicateSupportDof::hasIntersectionChange() const | |
427 | { | ||
428 | |||
429 | 60 | return m_hasIntersectionChange; | |
430 | } | ||
431 | |||
432 | /***********************************************************************************/ | ||
433 | /***********************************************************************************/ | ||
434 | |||
435 | 22 | const std::map<felInt, std::map<felInt, felInt> >& DuplicateSupportDof::getIntersectedVerMsh() const | |
436 | { | ||
437 | |||
438 | 22 | return m_intersectedVerMshIdx; | |
439 | } | ||
440 | |||
441 | /***********************************************************************************/ | ||
442 | /***********************************************************************************/ | ||
443 | |||
444 | 66 | const std::map<felInt, felInt>& DuplicateSupportDof::getIntersectedMshElt() const | |
445 | { | ||
446 | |||
447 | 66 | return m_intersectedMshEltIdx; | |
448 | } | ||
449 | |||
450 | /***********************************************************************************/ | ||
451 | /***********************************************************************************/ | ||
452 | |||
453 | ✗ | const std::set<felInt>& DuplicateSupportDof::getIntersectedTipElt() const | |
454 | { | ||
455 | |||
456 | ✗ | return m_intersectedTipEltIdx; | |
457 | } | ||
458 | |||
459 | /***********************************************************************************/ | ||
460 | /***********************************************************************************/ | ||
461 | |||
462 | ✗ | void DuplicateSupportDof::getSubBndElt(felInt iel, std::vector< std::vector<Point> >& bndElem) const | |
463 | { | ||
464 | ✗ | bndElem.clear(); | |
465 | ✗ | auto it = m_subBndEltCrd.find(iel); | |
466 | ✗ | if(it != m_subBndEltCrd.end()) | |
467 | ✗ | bndElem = it->second; | |
468 | } | ||
469 | |||
470 | /***********************************************************************************/ | ||
471 | /***********************************************************************************/ | ||
472 | |||
473 | ✗ | void DuplicateSupportDof::getSubBndEltSide(felInt iel, std::vector<sideOfInterface>& bndElemSide) const | |
474 | { | ||
475 | ✗ | bndElemSide.clear(); | |
476 | ✗ | auto it = m_subBndEltSide.find(iel); | |
477 | ✗ | if( it != m_subBndEltSide.end() ) | |
478 | ✗ | bndElemSide = it->second; | |
479 | } | ||
480 | |||
481 | /***********************************************************************************/ | ||
482 | /***********************************************************************************/ | ||
483 | |||
484 | ✗ | const std::vector<short unsigned int>& DuplicateSupportDof::getMapFaceFelisceToIntersector(felInt dim) const | |
485 | { | ||
486 | |||
487 | ✗ | return m_XFMInterface.getMapFaceFelisceToIntersector(dim); | |
488 | } | ||
489 | |||
490 | /***********************************************************************************/ | ||
491 | /***********************************************************************************/ | ||
492 | |||
493 | 2 | void DuplicateSupportDof::setVerbose(felInt verbose) | |
494 | { | ||
495 | |||
496 | 2 | m_XFMInterface.setIteration(verbose); | |
497 | 2 | } | |
498 | |||
499 | /***********************************************************************************/ | ||
500 | /***********************************************************************************/ | ||
501 | |||
502 | 2 | void DuplicateSupportDof::setMeshesName(std::string fluidMesh, std::string strucMesh) | |
503 | { | ||
504 | |||
505 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | m_XFMInterface.setMeshesName(fluidMesh, strucMesh); |
506 | 2 | } | |
507 | |||
508 | /***********************************************************************************/ | ||
509 | /***********************************************************************************/ | ||
510 | |||
511 | 20 | void DuplicateSupportDof::setIteration(felInt iteration) | |
512 | { | ||
513 | |||
514 | 20 | m_XFMInterface.setIteration(iteration); | |
515 | 20 | } | |
516 | |||
517 | /***********************************************************************************/ | ||
518 | /***********************************************************************************/ | ||
519 | |||
520 | 2 | void DuplicateSupportDof::initializeOldArrays() | |
521 | { | ||
522 | |||
523 | //--- Initialize old arrays | ||
524 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
4 | for(std::size_t j = 0; j < m_oldPtrIntEltMsh.size(); ++j) |
525 | 2 | m_XFMInterface.getPtrSubMshEltPerMshElt(m_oldPtrIntEltMsh[j]); | |
526 | |||
527 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
4 | for(std::size_t j = 0; j < m_oldLstIntEltMsh.size(); ++j) |
528 | 2 | m_XFMInterface.getLstSubMshPerEltMsh(m_oldLstIntEltMsh[j]); | |
529 | |||
530 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
4 | for(std::size_t j = 0; j < m_oldCrdMsh.size(); ++j) |
531 | 2 | m_XFMInterface.getLstIntMshVerCrd(m_oldCrdMsh[j]); | |
532 | |||
533 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
4 | for(std::size_t j = 0; j < m_oldEltMsh.size(); ++j) |
534 | 2 | m_XFMInterface.getLstIntMshElt(m_oldEltMsh[j]); | |
535 | |||
536 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
4 | for(std::size_t j = 0; j < m_oldEltSgn.size(); ++j) |
537 | 2 | m_XFMInterface.getLstIntMshEltSgn(m_oldEltSgn[j]); | |
538 | 2 | } | |
539 | |||
540 | /***********************************************************************************/ | ||
541 | /***********************************************************************************/ | ||
542 | |||
543 | 20 | void DuplicateSupportDof::updateOldArrays() | |
544 | { | ||
545 | |||
546 | //--- Update old arrays | ||
547 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
20 | for(std::size_t j = m_oldPtrIntEltMsh.size() - 1; j > 0; --j) |
548 | ✗ | m_oldPtrIntEltMsh[j] = std::move(m_oldPtrIntEltMsh[j-1]); | |
549 | 20 | m_XFMInterface.getPtrSubMshEltPerMshElt(m_oldPtrIntEltMsh[0]); | |
550 | |||
551 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
20 | for(std::size_t i = m_oldLstIntEltMsh.size() - 1; i > 0; --i) |
552 | ✗ | m_oldLstIntEltMsh[i] = std::move(m_oldLstIntEltMsh[i-1]); | |
553 | 20 | m_XFMInterface.getLstSubMshPerEltMsh(m_oldLstIntEltMsh[0]); | |
554 | |||
555 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
20 | for(std::size_t i = m_oldCrdMsh.size() - 1; i > 0; --i) |
556 | ✗ | m_oldCrdMsh[i] = std::move(m_oldCrdMsh[i-1]); | |
557 | 20 | m_XFMInterface.getLstIntMshVerCrd(m_oldCrdMsh[0]); | |
558 | |||
559 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
20 | for(std::size_t i = m_oldEltMsh.size() - 1; i > 0; --i) |
560 | ✗ | m_oldEltMsh[i] = std::move(m_oldEltMsh[i-1]); | |
561 | 20 | m_XFMInterface.getLstIntMshElt(m_oldEltMsh[0]); | |
562 | |||
563 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
20 | for(std::size_t i = m_oldEltSgn.size() - 1; i > 0; --i) |
564 | ✗ | m_oldEltSgn[i] = std::move(m_oldEltSgn[i-1]); | |
565 | 20 | m_XFMInterface.getLstIntMshEltSgn(m_oldEltSgn[0]); | |
566 | 20 | } | |
567 | |||
568 | /***********************************************************************************/ | ||
569 | /***********************************************************************************/ | ||
570 | |||
571 | 22 | void DuplicateSupportDof::print() const | |
572 | { | ||
573 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if( m_verbose < 20 ) |
574 | 22 | return; | |
575 | |||
576 | ✗ | if ( MpiInfo::rankProc() == 0 ){ | |
577 | |||
578 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "\n###### Intersected elements ( volume and boundary elements ) #####\n"); | |
579 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "Number of intersected elements : %ld\n", static_cast<unsigned long>(m_intersectedMshEltIdx.size())); | |
580 | ✗ | for(auto it_elt = m_intersectedMshEltIdx.begin(); it_elt != m_intersectedMshEltIdx.end(); ++it_elt) { | |
581 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "Element %d intersected by interface %d: \n", it_elt->first, it_elt->second); | |
582 | ✗ | auto it_sgn = m_intersectedEltVerSgn.find(it_elt->first); | |
583 | ✗ | for(std::size_t ive = 0; ive < it_sgn->second.size(); ++ive) | |
584 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "--- Local vertex %ld, and sign %+d \n", static_cast<unsigned long>(ive), it_sgn->second[ive]); | |
585 | } | ||
586 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "\n"); | |
587 | |||
588 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "\n###### Intersected boundary elements ######\n"); | |
589 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "Number of intersected boundaries : %ld \n", static_cast<unsigned long>(m_subBndEltCrd.size())); | |
590 | ✗ | auto it_elt_crd = m_subBndEltCrd.begin(); | |
591 | ✗ | auto it_elt_sid = m_subBndEltSide.begin(); | |
592 | ✗ | while( it_elt_crd != m_subBndEltCrd.end() && it_elt_sid != m_subBndEltSide.end() ) { | |
593 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "Element %d :\n", it_elt_crd->first); | |
594 | ✗ | auto& it_sub_elt_crd = it_elt_crd->second; | |
595 | ✗ | auto& it_sub_elt_sid = it_elt_sid->second; | |
596 | ✗ | for(std::size_t iel = 0; iel < it_sub_elt_crd.size(); ++iel) { | |
597 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "Sub element %ld : side = %+d \n", static_cast<unsigned long>(iel), it_sub_elt_sid[iel]); | |
598 | ✗ | for(std::size_t ipt = 0; ipt < it_sub_elt_crd[iel].size(); ++ipt) | |
599 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "\t\t %12.8f %12.8f %12.8f \n", it_sub_elt_crd[iel][ipt].x(), it_sub_elt_crd[iel][ipt].y(), it_sub_elt_crd[iel][ipt].z()); | |
600 | } | ||
601 | ✗ | it_elt_crd++; | |
602 | ✗ | it_elt_sid++; | |
603 | } | ||
604 | ✗ | PetscPrintf(PETSC_COMM_WORLD, "\n"); | |
605 | } | ||
606 | } | ||
607 | |||
608 | } | ||
609 |