Directory: | ./ |
---|---|
File: | CommunicationInterfaces/XFMInterface.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 400 | 601 | 66.6% |
Branches: | 211 | 616 | 34.3% |
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: D. C. Corti | ||
13 | // | ||
14 | |||
15 | /*! | ||
16 | \file XFMInterface.hpp | ||
17 | \authors D. C. Corti | ||
18 | \date 00/00/2022 | ||
19 | \brief interface for XFM module in libXfm | ||
20 | */ | ||
21 | |||
22 | // System includes | ||
23 | #include <numeric> | ||
24 | |||
25 | // External includes | ||
26 | |||
27 | // Project includes | ||
28 | #include "Core/felisceParam.hpp" | ||
29 | #include "CommunicationInterfaces/XFMInterface.hpp" | ||
30 | |||
31 | |||
32 | namespace felisce { | ||
33 | |||
34 | 2 | XFMInterface::XFMInterface() | |
35 | { | ||
36 | #ifdef FELISCE_WITH_LIBXFM | ||
37 | |||
38 | 2 | m_xfm = nullptr; | |
39 | 2 | m_isXFMInit = false; | |
40 | 2 | m_writeXFEMmeshes = false; | |
41 | |||
42 | 2 | m_IntMethod = None; | |
43 | |||
44 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | m_fluidMeshName = "fluid"; |
45 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | m_strucMeshName = "struc"; |
46 | |||
47 | 2 | m_dim = -1; | |
48 | 2 | m_numVerMsh = 0; | |
49 | 2 | m_numVerItf = 0; | |
50 | 2 | m_numEltMsh = 0; | |
51 | 2 | m_numEltItf = 0; | |
52 | 2 | m_numBndMsh = 0; | |
53 | 2 | m_iteration = 0; | |
54 | |||
55 | 2 | m_listStrucVertCoor = nullptr; | |
56 | 2 | m_listStrucVertCoorInitial = nullptr; | |
57 | 2 | m_listStrucRef = nullptr; | |
58 | |||
59 | 2 | m_sizLstIntEltMsh = 0; | |
60 | 2 | m_ptrIntEltMsh = nullptr; | |
61 | 2 | m_lstIntEltMsh = nullptr; | |
62 | 2 | m_sizLstItfEltMsh = 0; | |
63 | 2 | m_ptrItfEltMsh = nullptr; | |
64 | 2 | m_lstItfEltMsh = nullptr; | |
65 | 2 | m_verSgn = nullptr; | |
66 | |||
67 | 2 | m_sizLstIntEltItf = 0; | |
68 | 2 | m_ptrIntEltItf = nullptr; | |
69 | 2 | m_lstIntEltItf = nullptr; | |
70 | |||
71 | 2 | m_nbrIntVerMsh = 0; | |
72 | 2 | m_crdMsh = nullptr; | |
73 | 2 | m_intVerIdx = nullptr; | |
74 | 2 | m_intVerSgn = nullptr; | |
75 | 2 | m_nbrIntEltMsh = 0; | |
76 | 2 | m_eltMsh = nullptr; | |
77 | 2 | m_elt2MshEltMsh = nullptr; | |
78 | 2 | m_eltSgn = nullptr; | |
79 | |||
80 | 2 | m_nbrIntVerItf = 0; | |
81 | 2 | m_crdItf = nullptr; | |
82 | 2 | m_nbrIntEltItf = 0; | |
83 | 2 | m_elt2DItf = nullptr; | |
84 | 2 | m_elt3DItf = nullptr; | |
85 | 2 | m_elt2MshEltItf = nullptr; | |
86 | 2 | m_elt2ItfElt = nullptr; | |
87 | |||
88 | 2 | m_sizLstIntBndMsh = 0; | |
89 | 2 | m_ptrIntBndMsh = nullptr; | |
90 | 2 | m_lstIntBndMsh = nullptr; | |
91 | 2 | m_nbrIntEltBnd = 0; | |
92 | 2 | m_elt2DBnd = nullptr; | |
93 | 2 | m_elt3DBnd = nullptr; | |
94 | |||
95 | 2 | m_sizLstTipSrf = 0; | |
96 | 2 | m_ptrTipSrf = nullptr; | |
97 | 2 | m_lstTipSrf = nullptr; | |
98 | 2 | m_nbrIntTipElt = 0; | |
99 | 2 | m_tipElt2MshElt = nullptr; | |
100 | 2 | m_nbrIntTipSrf = 0; | |
101 | 2 | m_tipSrf3D = nullptr; | |
102 | 2 | m_tipSrf2D = nullptr; | |
103 | 2 | m_tipSrfSgn = nullptr; | |
104 | |||
105 | 2 | m_nbrIntVerFro = 0; | |
106 | 2 | m_verFro = nullptr; | |
107 | 2 | m_vecFro = nullptr; | |
108 | |||
109 | 2 | m_mshItfIdx = nullptr; | |
110 | 2 | m_bndItfIdx = nullptr; | |
111 | |||
112 | #endif | ||
113 | 2 | } | |
114 | |||
115 | /***********************************************************************************/ | ||
116 | /***********************************************************************************/ | ||
117 | |||
118 | 2 | XFMInterface::~XFMInterface() | |
119 | { | ||
120 | #ifdef FELISCE_WITH_LIBXFM | ||
121 | |||
122 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if( m_isXFMInit ) |
123 | 2 | m_xfm = Xfm_FreeLibrary(m_xfm); | |
124 | |||
125 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if( m_listStrucVertCoor != nullptr ) |
126 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | delete [] m_listStrucVertCoor; |
127 | |||
128 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if( m_listStrucVertCoorInitial != nullptr ) |
129 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | delete [] m_listStrucVertCoorInitial; |
130 | |||
131 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if( m_listStrucRef != nullptr ) |
132 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | delete [] m_listStrucRef; |
133 | |||
134 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if( MpiInfo::rankProc() != 0 ) { |
135 | |||
136 | ✗ | if( m_ptrIntEltMsh != nullptr ) | |
137 | ✗ | delete [] m_ptrIntEltMsh; | |
138 | ✗ | if( m_lstIntEltMsh != nullptr ) | |
139 | ✗ | delete [] m_lstIntEltMsh; | |
140 | ✗ | if( m_ptrItfEltMsh != nullptr ) | |
141 | ✗ | delete [] m_ptrItfEltMsh; | |
142 | ✗ | if( m_lstItfEltMsh != nullptr ) | |
143 | ✗ | delete [] m_lstItfEltMsh; | |
144 | ✗ | if( m_verSgn != nullptr ) | |
145 | ✗ | delete [] m_verSgn; | |
146 | |||
147 | ✗ | if( m_ptrIntEltItf != nullptr ) | |
148 | ✗ | delete [] m_ptrIntEltItf; | |
149 | ✗ | if( m_lstIntEltItf != nullptr ) | |
150 | ✗ | delete [] m_lstIntEltItf; | |
151 | |||
152 | ✗ | if( m_crdMsh != nullptr ) | |
153 | ✗ | delete [] m_crdMsh; | |
154 | ✗ | if( m_intVerIdx != nullptr ) | |
155 | ✗ | delete [] m_intVerIdx; | |
156 | ✗ | if( m_intVerSgn != nullptr ) | |
157 | ✗ | delete [] m_intVerSgn; | |
158 | ✗ | if( m_eltMsh != nullptr ) | |
159 | ✗ | delete [] m_eltMsh; | |
160 | ✗ | if( m_elt2MshEltMsh != nullptr ) | |
161 | ✗ | delete [] m_elt2MshEltMsh; | |
162 | ✗ | if( m_eltSgn != nullptr ) | |
163 | ✗ | delete [] m_eltSgn; | |
164 | |||
165 | ✗ | if( m_crdItf != nullptr ) | |
166 | ✗ | delete [] m_crdItf; | |
167 | ✗ | if( m_elt2DItf != nullptr ) | |
168 | ✗ | delete [] m_elt2DItf; | |
169 | ✗ | if( m_elt3DItf != nullptr ) | |
170 | ✗ | delete [] m_elt3DItf; | |
171 | ✗ | if( m_elt2MshEltItf != nullptr ) | |
172 | ✗ | delete [] m_elt2MshEltItf; | |
173 | ✗ | if( m_elt2ItfElt != nullptr ) | |
174 | ✗ | delete [] m_elt2ItfElt; | |
175 | |||
176 | ✗ | if( m_ptrIntBndMsh != nullptr ) | |
177 | ✗ | delete [] m_ptrIntBndMsh; | |
178 | ✗ | if( m_lstIntBndMsh != nullptr ) | |
179 | ✗ | delete [] m_lstIntBndMsh; | |
180 | ✗ | if( m_elt2DBnd != nullptr ) | |
181 | ✗ | delete [] m_elt2DBnd; | |
182 | ✗ | if( m_elt3DBnd != nullptr ) | |
183 | ✗ | delete [] m_elt3DBnd; | |
184 | |||
185 | ✗ | if( m_ptrTipSrf != nullptr ) | |
186 | ✗ | delete [] m_ptrTipSrf; | |
187 | ✗ | if( m_lstTipSrf != nullptr ) | |
188 | ✗ | delete [] m_lstTipSrf; | |
189 | ✗ | if( m_tipElt2MshElt != nullptr ) | |
190 | ✗ | delete [] m_tipElt2MshElt; | |
191 | ✗ | if( m_tipSrf3D != nullptr ) | |
192 | ✗ | delete [] m_tipSrf3D; | |
193 | ✗ | if( m_tipSrf2D != nullptr ) | |
194 | ✗ | delete [] m_tipSrf2D; | |
195 | ✗ | if( m_tipSrfSgn != nullptr ) | |
196 | ✗ | delete [] m_tipSrfSgn; | |
197 | |||
198 | ✗ | if( m_verFro != nullptr ) | |
199 | ✗ | delete [] m_verFro; | |
200 | ✗ | if( m_vecFro != nullptr ) | |
201 | ✗ | delete [] m_vecFro; | |
202 | |||
203 | ✗ | if( m_mshItfIdx != nullptr ) | |
204 | ✗ | delete [] m_mshItfIdx; | |
205 | ✗ | if( m_bndItfIdx != nullptr ) | |
206 | ✗ | delete [] m_bndItfIdx; | |
207 | } | ||
208 | |||
209 | #endif | ||
210 | 2 | } | |
211 | |||
212 | /***********************************************************************************/ | ||
213 | /***********************************************************************************/ | ||
214 | |||
215 | 2 | void XFMInterface::initialize(const GeometricMeshRegion& fluidMesh, const GeometricMeshRegion& strucMesh) | |
216 | { | ||
217 | #ifdef FELISCE_WITH_LIBXFM | ||
218 | |||
219 | //- Check if class already initialized | ||
220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if( m_isXFMInit ) |
221 | ✗ | FEL_ERROR("XFMInterface already initialized"); | |
222 | |||
223 | //- Get the dimension of the fluid mesh | ||
224 | 2 | m_dim = fluidMesh.domainDim(); | |
225 | |||
226 | //- Intersection method | ||
227 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if( FelisceParam::instance().confIntersection ) |
228 | 2 | m_IntMethod = ConfCutByItfMesh; | |
229 | else | ||
230 | ✗ | m_IntMethod = NonConfCutByItfMesh; | |
231 | |||
232 | |||
233 | //--- Initialize interface | ||
234 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if ( MpiInfo::rankProc() == 0 ) |
235 |
1/2✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | m_xfm = Xfm_NewLibrary(m_dim, m_strucMeshName.data(), m_fluidMeshName.data(), m_IntMethod, 0, 0); |
236 | |||
237 | |||
238 | //--- Initialize meshes dimensions | ||
239 | 2 | const GeometricMeshRegion::ElementType fluidType = fluidMesh.bagElementTypeDomain()[0]; | |
240 | 2 | const GeometricMeshRegion::ElementType strucType = strucMesh.bagElementTypeDomain()[0]; | |
241 | 2 | const GeometricMeshRegion::ElementType bndryType = fluidMesh.bagElementTypeDomainBoundary()[0]; | |
242 | |||
243 | 2 | m_numVerMsh = fluidMesh.numPoints(); | |
244 | 2 | m_numEltMsh = fluidMesh.numElements(fluidType); | |
245 | 2 | m_numBndMsh = fluidMesh.numElements(bndryType); | |
246 | 2 | m_numVerItf = strucMesh.numPoints(); | |
247 | 2 | m_numEltItf = strucMesh.numElements(strucType); | |
248 | |||
249 | //- Build fictitious structures to physical structures map | ||
250 | 2 | std::unordered_map<int,int> ref2XFMlabel; | |
251 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | buildFictitiousToStructureMap(strucMesh, ref2XFMlabel); |
252 | |||
253 | |||
254 | //--- Initialize meshes in XFM library: points and elements | ||
255 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if ( MpiInfo::rankProc() == 0 ) { |
256 | |||
257 | 2 | const felInt numFluidPtPerElt = GeometricMeshRegion::m_numVerticesPerElt[fluidType]; | |
258 | 2 | const felInt numStrucPtPerElt = GeometricMeshRegion::m_numVerticesPerElt[strucType]; | |
259 | 2 | const felInt numBndryPtPerElt = GeometricMeshRegion::m_numVerticesPerElt[bndryType]; | |
260 | |||
261 | //- List of vertices coordinates of the fluid | ||
262 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | double3d*listFluidVertCoor = new double3d[m_numVerMsh + 1]; |
263 |
2/2✓ Branch 0 taken 3620 times.
✓ Branch 1 taken 2 times.
|
3622 | for(felInt iVert=0; iVert<m_numVerMsh; ++iVert) { |
264 |
2/2✓ Branch 0 taken 10860 times.
✓ Branch 1 taken 3620 times.
|
14480 | for(std::size_t iCoor=0; iCoor<3; ++iCoor) { |
265 | 10860 | listFluidVertCoor[iVert+1][iCoor] = fluidMesh.listPoint(iVert)[iCoor]; | |
266 | } | ||
267 | } | ||
268 | |||
269 | //- List of element of the fluid | ||
270 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | int4d* listFluidElt = new int4d[m_numEltMsh + 1]; |
271 |
2/2✓ Branch 0 taken 6844 times.
✓ Branch 1 taken 2 times.
|
6846 | for(felInt iel=0; iel<m_numEltMsh; ++iel) { |
272 |
2/2✓ Branch 0 taken 20532 times.
✓ Branch 1 taken 6844 times.
|
27376 | for(felInt iPt=0; iPt<numFluidPtPerElt; ++iPt) { |
273 | 20532 | listFluidElt[iel + 1][iPt] = fluidMesh.listElements(fluidType)[numFluidPtPerElt*iel + iPt] + 1; | |
274 | } | ||
275 | } | ||
276 | |||
277 | //- List of vertices coordinates (initial and the one that will be updated in the future) | ||
278 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | m_listStrucVertCoor = new double3d[m_numVerItf + 1]; |
279 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | m_listStrucVertCoorInitial = new double3d[m_numVerItf + 1]; |
280 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 2 times.
|
42 | for(felInt iVert=0; iVert<m_numVerItf; ++iVert) { |
281 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 40 times.
|
160 | for(std::size_t iCoor=0; iCoor<3; ++iCoor) { |
282 | 120 | m_listStrucVertCoor[iVert + 1][iCoor] = strucMesh.listPoint(iVert)[iCoor]; | |
283 | 120 | m_listStrucVertCoorInitial[iVert + 1][iCoor] = strucMesh.listPoint(iVert)[iCoor]; | |
284 | } | ||
285 | } | ||
286 | |||
287 | //- Count number not boundary surface elements | ||
288 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | std::vector<felInt>& notBndLabel = FelisceParam::instance().notBoundarySurfaceLabels; |
289 | 2 | felInt numIntBndMsh = 0; | |
290 |
2/2✓ Branch 4 taken 8 times.
✓ Branch 5 taken 2 times.
|
10 | for(auto itRef = fluidMesh.intRefToBegEndMaps[bndryType].begin(); itRef != fluidMesh.intRefToBegEndMaps[bndryType].end(); itRef++) |
291 |
2/4✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
|
8 | if( find(notBndLabel.begin(), notBndLabel.end(), itRef->first) != notBndLabel.end() ) |
292 | ✗ | numIntBndMsh += itRef->second.second; | |
293 | |||
294 | 2 | int3d *listFluidBndElt2d = nullptr, *listStrucElt2d = nullptr; | |
295 | 2 | int4d *listFluidBndElt3d = nullptr, *listStrucElt3d = nullptr; | |
296 | |||
297 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if ( m_dim == 2 ){ |
298 | |||
299 | //- List of bundary element of the fluid | ||
300 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | listFluidBndElt2d = new int3d[m_numBndMsh + 1]; |
301 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 2 times.
|
394 | for(felInt iel=0; iel<m_numBndMsh; ++iel) { |
302 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 392 times.
|
1176 | for(felInt iPt=0; iPt<numBndryPtPerElt; ++iPt) |
303 | 784 | listFluidBndElt2d[iel + 1][iPt] = fluidMesh.listElements(bndryType)[numBndryPtPerElt*iel + iPt] + 1; | |
304 | 392 | listFluidBndElt2d[iel + 1][numBndryPtPerElt] = 0; | |
305 | } | ||
306 | |||
307 | //- list of element of the structure | ||
308 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | listStrucElt2d = new int3d[m_numEltItf + 1]; |
309 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | m_listStrucRef = new int1d[m_numEltItf + 1]; |
310 | felInt startIdx, nbrElm; | ||
311 | |||
312 | //- List of element of the structure | ||
313 |
2/2✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
|
6 | for (auto it = strucMesh.intRefToBegEndMaps[strucType].begin(); it != strucMesh.intRefToBegEndMaps[strucType].end(); ++it){ |
314 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | strucMesh.getElementsIDPerRef(strucType, it->first, &startIdx, &nbrElm); |
315 | |||
316 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 4 times.
|
40 | for(felInt iel=startIdx; iel < startIdx + nbrElm; ++iel) { |
317 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 36 times.
|
108 | for(felInt iPt=0; iPt<numStrucPtPerElt; ++iPt) |
318 | 72 | listStrucElt2d[iel + 1][iPt] = strucMesh.listElements(strucType)[numStrucPtPerElt*iel + iPt] + 1; | |
319 | 36 | listStrucElt2d[iel + 1][numStrucPtPerElt] = 0; | |
320 |
1/2✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
|
36 | m_listStrucRef[iel + 1] = ref2XFMlabel.find(it->first)->second; |
321 | } | ||
322 | } | ||
323 | |||
324 | //- Initialisation of the library (allocation) | ||
325 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if( MpiInfo::rankProc() == 0 ) |
326 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | Xfm_LibraryInitialization_Array(m_xfm, m_numVerMsh, listFluidVertCoor, 0, nullptr, 0, m_numEltMsh, listFluidElt, numIntBndMsh, m_numBndMsh, listFluidBndElt2d, |
327 | m_numVerItf, m_listStrucVertCoor, m_numEltItf, nullptr, listStrucElt2d, m_listStrucRef); | ||
328 | } else { | ||
329 | |||
330 | //- List of bundary element of the fluid | ||
331 | ✗ | listFluidBndElt3d = new int4d[m_numBndMsh + 1]; | |
332 | ✗ | for(felInt iel=0; iel<m_numBndMsh; ++iel) { | |
333 | ✗ | for(felInt iPt=0; iPt<numBndryPtPerElt; ++iPt) | |
334 | ✗ | listFluidBndElt3d[iel + 1][iPt] = fluidMesh.listElements(bndryType)[numBndryPtPerElt*iel + iPt] + 1; | |
335 | ✗ | listFluidBndElt3d[iel + 1][numBndryPtPerElt] = 0; | |
336 | } | ||
337 | |||
338 | //- List of element of the structure | ||
339 | ✗ | listStrucElt3d = new int4d[m_numEltItf + 1]; | |
340 | ✗ | m_listStrucRef = new int1d[m_numEltItf + 1]; | |
341 | felInt startIdx, nbrElm; | ||
342 | |||
343 | //- list of element of the structure | ||
344 | ✗ | for (auto it = strucMesh.intRefToBegEndMaps[strucType].begin(); it != strucMesh.intRefToBegEndMaps[strucType].end(); ++it){ | |
345 | ✗ | strucMesh.getElementsIDPerRef(strucType, it->first, &startIdx, &nbrElm); | |
346 | |||
347 | ✗ | for(felInt iel=startIdx; iel < startIdx + nbrElm; ++iel) { | |
348 | ✗ | for(felInt iPt=0; iPt<numStrucPtPerElt; ++iPt) | |
349 | ✗ | listStrucElt3d[iel + 1][iPt] = strucMesh.listElements(strucType)[numStrucPtPerElt*iel + iPt] + 1; | |
350 | ✗ | listStrucElt3d[iel + 1][numStrucPtPerElt] = 0; | |
351 | ✗ | m_listStrucRef[iel + 1] = ref2XFMlabel.find(it->first)->second; | |
352 | } | ||
353 | } | ||
354 | |||
355 | //- Initialisation of the library (allocation) | ||
356 | ✗ | if( MpiInfo::rankProc() == 0) | |
357 | ✗ | Xfm_LibraryInitialization_Array(m_xfm, m_numVerMsh, listFluidVertCoor, m_numEltMsh, listFluidElt, numIntBndMsh, m_numBndMsh, listFluidBndElt3d, 0, 0, nullptr, | |
358 | m_numVerItf, m_listStrucVertCoor, m_numEltItf, listStrucElt3d, nullptr, m_listStrucRef); | ||
359 | } | ||
360 | |||
361 | |||
362 | //--- Clean memory | ||
363 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if( listFluidVertCoor != nullptr ) delete [] listFluidVertCoor; |
364 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if( listFluidElt != nullptr ) delete [] listFluidElt; |
365 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if( listFluidBndElt2d != nullptr ) delete [] listFluidBndElt2d; |
366 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if( listStrucElt2d != nullptr ) delete [] listStrucElt2d; |
367 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if( listFluidBndElt3d != nullptr ) delete [] listFluidBndElt3d; |
368 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if( listStrucElt3d != nullptr ) delete [] listStrucElt3d; |
369 | } | ||
370 | else { | ||
371 | |||
372 | ✗ | m_listStrucRef = new int1d[m_numEltItf + 1]; | |
373 | felInt startIdx, nbrElm; | ||
374 | |||
375 | ✗ | if ( m_dim == 2 ) { | |
376 | //- List of element of the structure | ||
377 | ✗ | for (auto it = strucMesh.intRefToBegEndMaps[strucType].begin(); it != strucMesh.intRefToBegEndMaps[strucType].end(); ++it){ | |
378 | ✗ | strucMesh.getElementsIDPerRef(strucType, it->first, &startIdx, &nbrElm); | |
379 | |||
380 | ✗ | for(felInt iel=startIdx; iel < startIdx + nbrElm; ++iel) | |
381 | ✗ | m_listStrucRef[iel + 1] = ref2XFMlabel.find(it->first)->second; | |
382 | } | ||
383 | } | ||
384 | else { | ||
385 | //- List of element of the structure | ||
386 | ✗ | for (auto it = strucMesh.intRefToBegEndMaps[strucType].begin(); it != strucMesh.intRefToBegEndMaps[strucType].end(); ++it){ | |
387 | ✗ | strucMesh.getElementsIDPerRef(strucType, it->first, &startIdx, &nbrElm); | |
388 | |||
389 | ✗ | for(felInt iel=startIdx; iel < startIdx + nbrElm; ++iel) | |
390 | ✗ | m_listStrucRef[iel + 1] = ref2XFMlabel.find(it->first)->second; | |
391 | } | ||
392 | } | ||
393 | |||
394 | ✗ | m_ptrIntEltMsh = (int1d*)malloc(sizeof(int1d)*(m_numEltMsh+2)); | |
395 | ✗ | m_ptrItfEltMsh = (int1d*)malloc(sizeof(int1d)*(m_numEltMsh+2)); | |
396 | ✗ | m_ptrIntEltItf = (int1d*)malloc(sizeof(int1d)*(m_numEltItf+2)); | |
397 | ✗ | m_ptrIntBndMsh = (int1d*)malloc(sizeof(int1d)*(m_numBndMsh+2)); | |
398 | // m_verSgn = (int1d*)malloc(sizeof(int1d)*(m_numVerMsh+1)); | ||
399 | ✗ | m_mshItfIdx = (int1d*)malloc(sizeof(int1d)*(m_numEltMsh+1)); | |
400 | ✗ | m_bndItfIdx = (int1d*)malloc(sizeof(int1d)*(m_numBndMsh+1));; | |
401 | } | ||
402 | |||
403 | |||
404 | //--- Set option writeXFMmeshes | ||
405 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | m_writeXFEMmeshes = FelisceParam::instance().writeXFEMmeshes; |
406 | |||
407 | //- Set flag to true | ||
408 | 2 | m_isXFMInit = true; | |
409 | |||
410 | #else | ||
411 | |||
412 | IGNORE_UNUSED_ARGUMENT(fluidMesh); | ||
413 | IGNORE_UNUSED_ARGUMENT(strucMesh); | ||
414 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
415 | |||
416 | #endif | ||
417 | 2 | } | |
418 | |||
419 | /***********************************************************************************/ | ||
420 | /***********************************************************************************/ | ||
421 | |||
422 | 22 | void XFMInterface::computeIntersection() | |
423 | { | ||
424 | #ifdef FELISCE_WITH_LIBXFM | ||
425 | |||
426 | //- Check if class already initialized | ||
427 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | FEL_ASSERT(m_isXFMInit); |
428 | |||
429 | |||
430 | //--- Compute intersection | ||
431 | 22 | intersectMeshes(); | |
432 | |||
433 | |||
434 | //--- Get the data about the intersection | ||
435 | //- Data of the mesh | ||
436 | 22 | returnAndBcastVolumeMeshData(); | |
437 | |||
438 | //- Data of the interface mesh | ||
439 | 22 | returnAndBcastInterfaceMeshData(); | |
440 | |||
441 | //- Data of the intersected mesh | ||
442 | 22 | returnAndBcastIntersectedVolumeMeshData(); | |
443 | |||
444 | //- Data of the intersected interface | ||
445 | 22 | returnAndBcastIntersectedInterfaceMeshData(); | |
446 | |||
447 | //- Data of the intersected boundary mesh | ||
448 | 22 | returnAndBcastIntersectedBoundaryMeshData(); | |
449 | |||
450 | //- Data of the elements containing a tip | ||
451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if( m_IntMethod == NonConfCutByItfMesh ) |
452 | ✗ | returnAndBcastIntersectedTipMeshData(); | |
453 | else | ||
454 | 22 | returnAndBcastIntersectedFrontMeshData(); | |
455 | |||
456 | //- Data for multiple interfaces | ||
457 | 22 | returnAndBcastMultipleInterfacesData(); | |
458 | |||
459 | |||
460 | //--- Write intersected meshes | ||
461 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if( m_writeXFEMmeshes ) |
462 | ✗ | writeIntersectedMeshes(); | |
463 | |||
464 | #else | ||
465 | |||
466 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
467 | |||
468 | #endif | ||
469 | 22 | } | |
470 | |||
471 | /***********************************************************************************/ | ||
472 | /***********************************************************************************/ | ||
473 | |||
474 | 20 | void XFMInterface::updatePosition(std::vector<double>& dispArray) | |
475 | { | ||
476 | #ifdef FELISCE_WITH_LIBXFM | ||
477 | |||
478 | //- Check if class already initialized | ||
479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | FEL_ASSERT(m_isXFMInit); |
480 | |||
481 | //- Update the coordinates of the interface | ||
482 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | if ( MpiInfo::rankProc() == 0 ) { |
483 | |||
484 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 20 times.
|
420 | for(felInt i = 0; i < m_numVerItf; ++i) { |
485 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 400 times.
|
1200 | for(felInt j = 0; j < m_dim; ++j) { |
486 | 800 | m_listStrucVertCoor[i+1][j] = m_listStrucVertCoorInitial[i+1][j] + dispArray[j+m_dim*i]; | |
487 | } | ||
488 | } | ||
489 | |||
490 | 20 | Xfm_LibraryUpdateInterfaceCoordinates(m_xfm, m_numVerItf, m_listStrucVertCoor); | |
491 | } | ||
492 | |||
493 | //- Write interface mesh | ||
494 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if( m_writeXFEMmeshes ) |
495 | ✗ | writeInterfaceMesh(); | |
496 | |||
497 | #else | ||
498 | |||
499 | IGNORE_UNUSED_ARGUMENT(dispArray); | ||
500 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
501 | |||
502 | #endif | ||
503 | 20 | } | |
504 | |||
505 | /***********************************************************************************/ | ||
506 | /***********************************************************************************/ | ||
507 | |||
508 | 22 | void XFMInterface::markElementsForDuplication( GeometricMeshRegion& mesh, | |
509 | std::map<felInt, felInt>& intersectedMshEltIdx, | ||
510 | std::map<felInt, std::vector<felInt> >& intersectedEltVerSgn, | ||
511 | std::map<felInt, std::map<felInt, felInt> >& idVerMsh | ||
512 | ) | ||
513 | { | ||
514 | #ifdef FELISCE_WITH_LIBXFM | ||
515 | |||
516 | //- Check if class already initialized | ||
517 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | FEL_ASSERT(m_isXFMInit); |
518 | |||
519 | felInt iSubVer, idVer, idPnt, iSubElt; | ||
520 | |||
521 | 22 | const GeometricMeshRegion::ElementType fluidType = mesh.bagElementTypeDomain()[0]; | |
522 | 22 | felInt numFluidPtPerElt = GeometricMeshRegion::m_numVerticesPerElt[fluidType]; | |
523 | |||
524 | // loop over the fluid elements | ||
525 |
2/2✓ Branch 0 taken 75284 times.
✓ Branch 1 taken 22 times.
|
75306 | for(felInt iMshElt = 1; iMshElt <= m_numEltMsh; ++iMshElt) { |
526 | |||
527 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 74508 times.
|
75284 | if ( m_ptrIntEltMsh[iMshElt+1] > m_ptrIntEltMsh[iMshElt] ) { |
528 | |||
529 |
1/2✓ Branch 1 taken 776 times.
✗ Branch 2 not taken.
|
776 | intersectedMshEltIdx[iMshElt-1] = static_cast<felInt>(m_mshItfIdx[iMshElt]); // for multiple itf in same element intersectedMshEltIdx should be a map<felInt, set<felInt>> |
530 |
2/4✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 776 times.
✗ Branch 6 not taken.
|
776 | intersectedEltVerSgn[iMshElt-1] = std::vector<felInt>(numFluidPtPerElt,0); |
531 | |||
532 |
2/2✓ Branch 0 taken 3076 times.
✓ Branch 1 taken 776 times.
|
3852 | for(felInt isubelt = m_ptrIntEltMsh[iMshElt]; isubelt < m_ptrIntEltMsh[iMshElt+1]; ++isubelt) { |
533 | |||
534 | // Get the sub element id | ||
535 | 3076 | iSubElt = m_lstIntEltMsh[isubelt]; | |
536 | |||
537 |
2/2✓ Branch 0 taken 9228 times.
✓ Branch 1 taken 3076 times.
|
12304 | for(felInt iPt = 0; iPt < numFluidPtPerElt; ++iPt) { |
538 | // Get sub elt vertex id | ||
539 | 9228 | iSubVer = m_eltMsh[iSubElt][iPt]; | |
540 | |||
541 | // Get corresponding id in mesh | ||
542 | 9228 | idVer = m_intVerIdx[iSubVer]; | |
543 | |||
544 |
2/2✓ Branch 0 taken 3896 times.
✓ Branch 1 taken 5332 times.
|
9228 | if ( idVer != 0 ) { |
545 |
1/2✓ Branch 0 taken 7875 times.
✗ Branch 1 not taken.
|
7875 | for(felInt jPt = 0; jPt < numFluidPtPerElt; ++jPt) { |
546 | |||
547 | 7875 | idPnt = mesh.listElements(fluidType)[numFluidPtPerElt*(iMshElt-1)+jPt]; | |
548 |
2/2✓ Branch 0 taken 3896 times.
✓ Branch 1 taken 3979 times.
|
7875 | if ( idPnt+1 == std::abs(idVer) ) { |
549 | |||
550 |
1/2✓ Branch 0 taken 3896 times.
✗ Branch 1 not taken.
|
3896 | if ( idVer > 0 ) |
551 |
1/2✓ Branch 1 taken 3896 times.
✗ Branch 2 not taken.
|
3896 | intersectedEltVerSgn[iMshElt-1][jPt] = static_cast<felInt>(m_eltSgn[iSubElt]); |
552 | else | ||
553 | ✗ | intersectedEltVerSgn[iMshElt-1][jPt] = 0; | |
554 | |||
555 | 3896 | break; | |
556 | } | ||
557 | } | ||
558 | } | ||
559 | } | ||
560 | } | ||
561 | |||
562 |
2/2✓ Branch 0 taken 2328 times.
✓ Branch 1 taken 776 times.
|
3104 | for(felInt iPt = 0; iPt < numFluidPtPerElt; ++iPt){ |
563 | 2328 | idPnt = mesh.listElements(fluidType)[numFluidPtPerElt*(iMshElt-1)+iPt]; | |
564 |
2/4✓ Branch 1 taken 2328 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2328 times.
✗ Branch 5 not taken.
|
2328 | idVerMsh[idPnt][static_cast<felInt>(m_mshItfIdx[iMshElt])] = -1; |
565 | } | ||
566 | } | ||
567 | } | ||
568 | |||
569 | #else | ||
570 | |||
571 | IGNORE_UNUSED_ARGUMENT(mesh); | ||
572 | IGNORE_UNUSED_ARGUMENT(intersectedMshEltIdx); | ||
573 | IGNORE_UNUSED_ARGUMENT(intersectedEltVerSgn); | ||
574 | IGNORE_UNUSED_ARGUMENT(idVerMsh); | ||
575 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
576 | |||
577 | #endif | ||
578 | 22 | } | |
579 | |||
580 | /***********************************************************************************/ | ||
581 | /***********************************************************************************/ | ||
582 | |||
583 | 22 | void XFMInterface::markBoundaryForDuplication( GeometricMeshRegion& mesh, | |
584 | std::map<felInt, felInt>& intersectedMshEltIdx, | ||
585 | std::map<felInt, std::vector<felInt> >& intersectedEltVerSgn, | ||
586 | std::map<felInt, std::vector< std::vector<Point> > >& subBndEltCrd, | ||
587 | std::map<felInt, std::vector<sideOfInterface> >& subBndEltSide | ||
588 | ) | ||
589 | { | ||
590 | #ifdef FELISCE_WITH_LIBXFM | ||
591 | |||
592 | //- Check if class already initialized | ||
593 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | FEL_ASSERT(m_isXFMInit); |
594 | |||
595 | felInt idSubVer, idVer, idPnt, idSubBnd, idSubElt; | ||
596 | 22 | felInt cptIdBndElt = m_numEltMsh; | |
597 | |||
598 | 22 | const GeometricMeshRegion::ElementType bndryType = mesh.bagElementTypeDomainBoundary()[0]; | |
599 | 22 | const felInt numBndryPtPerElt = GeometricMeshRegion::m_numVerticesPerElt[bndryType]; | |
600 | |||
601 |
1/2✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
|
22 | std::vector<Point> tmp(numBndryPtPerElt); |
602 | |||
603 |
2/2✓ Branch 0 taken 4312 times.
✓ Branch 1 taken 22 times.
|
4334 | for(felInt iBndElt = 1; iBndElt <= m_numBndMsh; ++iBndElt) { |
604 | |||
605 | // If the boundary face belongs to the intersected mesh | ||
606 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 4268 times.
|
4312 | if ( m_ptrIntBndMsh[iBndElt+1] > m_ptrIntBndMsh[iBndElt] ){ |
607 | |||
608 | // Mark the boundary element for duplication | ||
609 |
1/2✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
|
44 | intersectedMshEltIdx[cptIdBndElt] = static_cast<felInt>(m_bndItfIdx[iBndElt]); // for multiple itf in same element intersectedMshEltIdx should be a map<felInt, set<felInt>> |
610 |
2/4✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 44 times.
✗ Branch 6 not taken.
|
44 | intersectedEltVerSgn[cptIdBndElt] = std::vector<felInt>(numBndryPtPerElt,0); |
611 | |||
612 | // For every boundary sub-face of the selected face store coordinates and sign | ||
613 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 44 times.
|
132 | for(felInt isubfac = m_ptrIntBndMsh[iBndElt]; isubfac < m_ptrIntBndMsh[iBndElt+1]; ++isubfac){ |
614 | |||
615 | // Get the sub face id | ||
616 | 88 | idSubBnd = m_lstIntBndMsh[isubfac]; | |
617 | |||
618 | // Get the id of the element close to the boundary element | ||
619 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if( m_dim == 2 ) |
620 | 88 | idSubElt = m_elt2DBnd[idSubBnd][2]; | |
621 | else | ||
622 | ✗ | idSubElt = m_elt3DBnd[idSubBnd][3]; | |
623 | |||
624 | // Store coordinates | ||
625 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 88 times.
|
264 | for (int iPt = 0; iPt < numBndryPtPerElt; ++iPt) { |
626 | // Get sub elt vertex id | ||
627 |
1/2✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
|
176 | if( m_dim == 2 ) |
628 | 176 | idSubVer = m_elt2DBnd[idSubBnd][iPt]; | |
629 | else | ||
630 | ✗ | idSubVer = m_elt3DBnd[idSubBnd][iPt]; | |
631 | |||
632 | // Get corresponding id in mesh | ||
633 | 176 | idVer = m_intVerIdx[idSubVer]; | |
634 | |||
635 | // Set local signs | ||
636 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 88 times.
|
176 | if ( idVer != 0 ) { |
637 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | for(felInt jPt = 0; jPt < numBndryPtPerElt; ++jPt) { |
638 | |||
639 | 132 | idPnt = mesh.listElements(bndryType)[numBndryPtPerElt*(iBndElt-1)+jPt]; | |
640 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 44 times.
|
132 | if ( idPnt+1 == std::abs(idVer) ) { |
641 | |||
642 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if ( idVer > 0 ) |
643 |
1/2✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
|
88 | intersectedEltVerSgn[cptIdBndElt][jPt] = static_cast<felInt>(m_eltSgn[idSubElt]); |
644 | else | ||
645 | ✗ | intersectedEltVerSgn[cptIdBndElt][jPt] = 0; | |
646 | |||
647 | 88 | break; | |
648 | } | ||
649 | } | ||
650 | } | ||
651 | |||
652 | // get point coordinates | ||
653 | 176 | tmp[iPt] = Point(m_crdMsh[idSubVer][0], m_crdMsh[idSubVer][1], m_crdMsh[idSubVer][2]); | |
654 | } | ||
655 | |||
656 | // store coordinates | ||
657 |
2/4✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
|
88 | subBndEltCrd[cptIdBndElt].push_back(tmp); |
658 | |||
659 | // store sign | ||
660 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 44 times.
|
88 | if(m_eltSgn[idSubElt] > 0) |
661 |
2/4✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 44 times.
✗ Branch 5 not taken.
|
44 | subBndEltSide[cptIdBndElt].push_back(LEFT); |
662 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | else if (m_eltSgn[idSubElt] < 0) |
663 |
2/4✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 44 times.
✗ Branch 5 not taken.
|
44 | subBndEltSide[cptIdBndElt].push_back(RIGHT); |
664 | else | ||
665 | ✗ | FEL_ERROR("Error while giving the sign to the boundary element. Check markBoundaryForDuplication3D"); | |
666 | } | ||
667 | } | ||
668 | |||
669 | 4312 | ++cptIdBndElt; | |
670 | } | ||
671 | |||
672 | #else | ||
673 | |||
674 | IGNORE_UNUSED_ARGUMENT(mesh); | ||
675 | IGNORE_UNUSED_ARGUMENT(intersectedMshEltIdx); | ||
676 | IGNORE_UNUSED_ARGUMENT(intersectedEltVerSgn); | ||
677 | IGNORE_UNUSED_ARGUMENT(subBndEltCrd); | ||
678 | IGNORE_UNUSED_ARGUMENT(subBndEltSide); | ||
679 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
680 | |||
681 | #endif | ||
682 | 22 | } | |
683 | |||
684 | /***********************************************************************************/ | ||
685 | /***********************************************************************************/ | ||
686 | |||
687 | 22 | void XFMInterface::postProcessTipElements( std::set<felInt>& intersectedTipEltIdx, | |
688 | std::map<felInt, std::map<felInt, felInt> >& idVerMsh | ||
689 | ) | ||
690 | { | ||
691 | #ifdef FELISCE_WITH_LIBXFM | ||
692 | |||
693 | //- Check if class already initialized | ||
694 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | FEL_ASSERT(m_isXFMInit); |
695 | |||
696 | // tip | ||
697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if( m_IntMethod == NonConfCutByItfMesh ) { |
698 | |||
699 | // loop over the fluid tip elements | ||
700 | ✗ | for(felInt iElt = 1; iElt <= m_nbrIntTipElt; ++iElt) | |
701 | ✗ | intersectedTipEltIdx.insert(m_tipElt2MshElt[iElt] - 1); | |
702 | |||
703 | |||
704 | // std::vector<felInt> elemIdPoint(numFluidPtPerElt); | ||
705 | // GeometricMeshRegion::BallMap ball; | ||
706 | // std::map<felInt, felInt> map; | ||
707 | |||
708 | // // for every tip element fill map: idx point ---> element (full mesh felisce format) | ||
709 | // for (auto elt_idx : intersectedTipEltIdx){ | ||
710 | // fluidMesh.getOneElement(elt_idx, elemIdPoint); | ||
711 | |||
712 | // for (auto pnt_idx : elemIdPoint) | ||
713 | // map[pnt_idx] = elt_idx; | ||
714 | // } | ||
715 | |||
716 | // // for every point in the map we get the ball of elements | ||
717 | // GeometricMeshRegion::ElementType elt_typ; | ||
718 | // felInt elt_idx, ver_pos, ver_sign, pre_ver_sign; | ||
719 | // std::vector<felInt>::iterator elt_int_idx; | ||
720 | // for (auto r_map : map) { | ||
721 | |||
722 | // // if (MpiInfo::rankProc() == 0 ) std::cout << "Point = " << r_map.first << std::endl; | ||
723 | |||
724 | // fluidMesh.GetVertexBall(r_map.first, fluidType, r_map.second, ball); | ||
725 | |||
726 | // // extract info | ||
727 | // std::tie(elt_typ, elt_idx, ver_pos) = ball[0]; // id element full mesh felisce format | ||
728 | |||
729 | // // check if is intersected | ||
730 | // elt_int_idx = std::find(m_idIntersectedElement.begin(), m_idIntersectedElement.end(), elt_idx); | ||
731 | |||
732 | // // get sign | ||
733 | // pre_ver_sign = m_intersectedEltVerSgn[ std::distance(m_idIntersectedElement.begin(), elt_int_idx) ][ver_pos]; | ||
734 | |||
735 | // // what's happen for degenerated verteces??? | ||
736 | // if ( m_intVerIdx[std::abs(pre_ver_sign)] < 0 ) { | ||
737 | // if (MpiInfo::rankProc() == 0 ) std::cout << "WARNING: degenerated vertex " << m_intVerIdx[std::abs(pre_ver_sign)] << std::endl; | ||
738 | // continue; | ||
739 | // } | ||
740 | |||
741 | // // we check if the sign is the same for every vertex | ||
742 | // for (auto r_elt = ball.begin()+1; r_elt != ball.end(); ++r_elt) { | ||
743 | |||
744 | // // extract info | ||
745 | // std::tie(elt_typ, elt_idx, ver_pos) = *r_elt; // id element full mesh felisce format | ||
746 | |||
747 | // // check if is intersected | ||
748 | // elt_int_idx = std::find(m_idIntersectedElement.begin(), m_idIntersectedElement.end(), elt_idx); | ||
749 | // if ( elt_int_idx != m_idIntersectedElement.end() ){ | ||
750 | |||
751 | // // get sign | ||
752 | // ver_sign = m_intersectedEltVerSgn[ std::distance(m_idIntersectedElement.begin(), elt_int_idx) ][ver_pos]; | ||
753 | |||
754 | // // if (MpiInfo::rankProc() == 0 ) std::cout << "ver_sign = " << ver_sign << " and pre_ver_sign = " << pre_ver_sign << std::endl; | ||
755 | |||
756 | // // sign are different | ||
757 | // if ( (ver_sign ^ pre_ver_sign) < 0 ){ | ||
758 | |||
759 | // idVerMsh.erase(r_map.first); | ||
760 | |||
761 | |||
762 | // // idVerMshMulItf[r_map.first].erase(m_idItfIntersectingElt[std::distance(m_idIntersectedElement.begin(), elt_int_idx)]); | ||
763 | // // if ( idVerMshMulItf[r_map.first].empty() ) | ||
764 | // // idVerMshMulItf.erase(r_map.first); | ||
765 | |||
766 | |||
767 | // // if (MpiInfo::rankProc() == 0 ) std::cout << "Point = " << r_map.first << " erased from idVerMsh" << std::endl; | ||
768 | |||
769 | |||
770 | // break; | ||
771 | // } | ||
772 | // } | ||
773 | // } | ||
774 | // } | ||
775 | } else { | ||
776 | |||
777 | // Change verFro to get the global indices instead of the intersected ones. | ||
778 | // Now do in two stages because of [i][2] not necessarily global conversion if in same element | ||
779 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 22 times.
|
66 | for(felInt i = 1; i <= m_nbrIntVerFro; ++i) |
780 | 44 | m_verFro[i][1] = m_elt2MshEltMsh[m_verFro[i][1]]; | |
781 | |||
782 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 22 times.
|
66 | for(felInt i = 1; i <= m_nbrIntVerFro; ++i) { |
783 | |||
784 | // again check to see if two fronts in same element; if so, set the corresponding flag | ||
785 | 44 | int front_flag = 0; | |
786 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 44 times.
|
132 | for(felInt j = 1; j <= m_nbrIntVerFro; ++j) |
787 |
3/4✓ Branch 0 taken 44 times.
✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 44 times.
|
88 | if( j!=i && m_verFro[i][1] == m_verFro[j][1] ) |
788 | ✗ | front_flag = 1; | |
789 | |||
790 | // and again, the special case for the crack when the initial crack point is a duplicated point (one technical front initially) | ||
791 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 44 times.
|
44 | if( FelisceParam::instance().hasCrack && m_nbrIntVerFro == 1 ) |
792 | ✗ | front_flag=1; | |
793 | |||
794 | //now change verfro to global | ||
795 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if( !front_flag ) |
796 | 44 | m_verFro[i][2] = std::abs(m_intVerIdx[m_verFro[i][2]]); | |
797 | } | ||
798 | |||
799 | // All vertices of the elements intersected by the solid are in idVerMsh | ||
800 | // If an element has a front point, we remove the corresponding vertex | ||
801 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 22 times.
|
66 | for(felInt iVer = 1; iVer <= m_nbrIntVerFro; ++iVer) |
802 |
1/2✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
|
44 | idVerMsh.erase(m_verFro[iVer][2] - 1); |
803 | } | ||
804 | |||
805 | #else | ||
806 | |||
807 | IGNORE_UNUSED_ARGUMENT(intersectedTipEltIdx); | ||
808 | IGNORE_UNUSED_ARGUMENT(idVerMsh); | ||
809 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
810 | |||
811 | #endif | ||
812 | 22 | } | |
813 | |||
814 | /***********************************************************************************/ | ||
815 | /***********************************************************************************/ | ||
816 | |||
817 | 20 | void XFMInterface::prepareNextIntersection() const | |
818 | { | ||
819 | #ifdef FELISCE_WITH_LIBXFM | ||
820 | |||
821 | //- Check if class already initialized | ||
822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | FEL_ASSERT(m_isXFMInit); |
823 | |||
824 | //--- Reinitialize library meshes and structures | ||
825 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | if ( MpiInfo::rankProc() == 0 ) |
826 | 20 | Xfm_LibraryReinitializeMeshesAndDataStructures(m_xfm); | |
827 | |||
828 | #else | ||
829 | |||
830 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
831 | |||
832 | #endif | ||
833 | 20 | } | |
834 | |||
835 | /***********************************************************************************/ | ||
836 | /***********************************************************************************/ | ||
837 | |||
838 | ✗ | const std::vector<short unsigned int>& XFMInterface::getMapFaceFelisceToIntersector(const felInt dim) const | |
839 | { | ||
840 | #ifdef FELISCE_WITH_LIBXFM | ||
841 | |||
842 | ✗ | if ( dim == 2 ) | |
843 | ✗ | return mapEdg; | |
844 | |||
845 | ✗ | return mapFac; | |
846 | |||
847 | #else | ||
848 | |||
849 | IGNORE_UNUSED_ARGUMENT(dim); | ||
850 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
851 | |||
852 | return mapFac; | ||
853 | |||
854 | #endif | ||
855 | } | ||
856 | |||
857 | /***********************************************************************************/ | ||
858 | /***********************************************************************************/ | ||
859 | |||
860 | 22 | void XFMInterface::getPtrSubMshEltPerMshElt(std::vector<felInt>& ptrSubMshEltPerMshElt) const | |
861 | { | ||
862 | #ifdef FELISCE_WITH_LIBXFM | ||
863 | |||
864 | 22 | ptrSubMshEltPerMshElt.resize(m_numEltMsh+1); | |
865 |
2/2✓ Branch 0 taken 75306 times.
✓ Branch 1 taken 22 times.
|
75328 | for (felInt iel = 0; iel <= m_numEltMsh; ++iel) |
866 | 75306 | ptrSubMshEltPerMshElt[iel] = static_cast<felInt>(m_ptrIntEltMsh[iel+1]); | |
867 | |||
868 | #else | ||
869 | |||
870 | IGNORE_UNUSED_ARGUMENT(ptrSubMshEltPerMshElt); | ||
871 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
872 | |||
873 | #endif | ||
874 | 22 | } | |
875 | |||
876 | /***********************************************************************************/ | ||
877 | /***********************************************************************************/ | ||
878 | |||
879 | 22 | void XFMInterface::getLstSubMshPerEltMsh(std::vector<felInt>& lstSubMshEltPerMshElt) const | |
880 | { | ||
881 | #ifdef FELISCE_WITH_LIBXFM | ||
882 | |||
883 | 22 | lstSubMshEltPerMshElt.resize(m_sizLstIntEltMsh); | |
884 |
2/2✓ Branch 0 taken 3088 times.
✓ Branch 1 taken 22 times.
|
3110 | for (felInt iel = 0; iel < m_sizLstIntEltMsh; ++iel) |
885 | 3088 | lstSubMshEltPerMshElt[iel] = static_cast<felInt>(m_lstIntEltMsh[iel]) - 1; | |
886 | |||
887 | #else | ||
888 | |||
889 | IGNORE_UNUSED_ARGUMENT(lstSubMshEltPerMshElt); | ||
890 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
891 | |||
892 | #endif | ||
893 | 22 | } | |
894 | |||
895 | /***********************************************************************************/ | ||
896 | /***********************************************************************************/ | ||
897 | |||
898 | 22 | void XFMInterface::getLstIntMshVerCrd(std::vector<std::array<double,3>>& lstIntMshVerCrd) const | |
899 | { | ||
900 | #ifdef FELISCE_WITH_LIBXFM | ||
901 | |||
902 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | lstIntMshVerCrd.resize(m_nbrIntVerMsh, std::array<double,3>{}); |
903 |
2/2✓ Branch 0 taken 2044 times.
✓ Branch 1 taken 22 times.
|
2066 | for (felInt ive = 0; ive < m_nbrIntVerMsh; ++ive) |
904 |
2/2✓ Branch 0 taken 6132 times.
✓ Branch 1 taken 2044 times.
|
8176 | for (std::size_t i = 0; i < 3; ++i) |
905 | 6132 | lstIntMshVerCrd[ive][i] = static_cast<double>(m_crdMsh[ive+1][i]); | |
906 | |||
907 | #else | ||
908 | |||
909 | IGNORE_UNUSED_ARGUMENT(lstIntMshVerCrd); | ||
910 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
911 | |||
912 | #endif | ||
913 | 22 | } | |
914 | |||
915 | /***********************************************************************************/ | ||
916 | /***********************************************************************************/ | ||
917 | |||
918 | 22 | void XFMInterface::getLstIntMshElt(std::vector<std::array<felInt,4>>& lstIntMshElt) const | |
919 | { | ||
920 | #ifdef FELISCE_WITH_LIBXFM | ||
921 | |||
922 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | lstIntMshElt.resize(m_nbrIntEltMsh, std::array<felInt,4>{}); |
923 |
2/2✓ Branch 0 taken 3088 times.
✓ Branch 1 taken 22 times.
|
3110 | for (felInt iel = 0; iel < m_nbrIntEltMsh; ++iel) |
924 |
2/2✓ Branch 0 taken 12352 times.
✓ Branch 1 taken 3088 times.
|
15440 | for (std::size_t i = 0; i < 4; ++i) |
925 | 12352 | lstIntMshElt[iel][i] = static_cast<felInt>(m_eltMsh[iel+1][i]) -1; | |
926 | |||
927 | #else | ||
928 | |||
929 | IGNORE_UNUSED_ARGUMENT(lstIntMshElt); | ||
930 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
931 | |||
932 | #endif | ||
933 | 22 | } | |
934 | |||
935 | /***********************************************************************************/ | ||
936 | /***********************************************************************************/ | ||
937 | |||
938 | 22 | void XFMInterface::getLstIntMshEltSgn(std::vector<felInt>& lstIntMshEltSgn) const | |
939 | { | ||
940 | #ifdef FELISCE_WITH_LIBXFM | ||
941 | |||
942 | 22 | lstIntMshEltSgn.resize(m_nbrIntEltMsh); | |
943 |
2/2✓ Branch 0 taken 3088 times.
✓ Branch 1 taken 22 times.
|
3110 | for (felInt iel = 0; iel < m_nbrIntEltMsh; ++iel) |
944 | 3088 | lstIntMshEltSgn[iel] = static_cast<felInt>(m_eltSgn[iel+1]); | |
945 | |||
946 | #else | ||
947 | |||
948 | IGNORE_UNUSED_ARGUMENT(lstIntMshEltSgn); | ||
949 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
950 | |||
951 | #endif | ||
952 | 22 | } | |
953 | |||
954 | /***********************************************************************************/ | ||
955 | /***********************************************************************************/ | ||
956 | |||
957 | 138296 | felInt XFMInterface::getNumSubMshEltPerMshElt(const felInt iel) const | |
958 | { | ||
959 | #ifdef FELISCE_WITH_LIBXFM | ||
960 | |||
961 | 138296 | return static_cast<felInt>(m_ptrIntEltMsh[iel+2] - m_ptrIntEltMsh[iel+1]); | |
962 | |||
963 | #else | ||
964 | |||
965 | IGNORE_UNUSED_ARGUMENT(iel); | ||
966 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
967 | |||
968 | return 0; | ||
969 | |||
970 | #endif | ||
971 | } | ||
972 | |||
973 | /***********************************************************************************/ | ||
974 | /***********************************************************************************/ | ||
975 | |||
976 | 22432 | felInt XFMInterface::getSubMshEltIdxMsh(const felInt iel, const felInt ielSub) const | |
977 | { | ||
978 | #ifdef FELISCE_WITH_LIBXFM | ||
979 | |||
980 | 22432 | return static_cast<felInt>(m_lstIntEltMsh[m_ptrIntEltMsh[iel+1] + ielSub] - 1); | |
981 | |||
982 | #else | ||
983 | |||
984 | IGNORE_UNUSED_ARGUMENT(iel); | ||
985 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
986 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
987 | |||
988 | return 0; | ||
989 | |||
990 | #endif | ||
991 | } | ||
992 | |||
993 | /***********************************************************************************/ | ||
994 | /***********************************************************************************/ | ||
995 | |||
996 | 16824 | void XFMInterface::getSubMshEltVerCrd(const felInt ielSub, const felInt iPt, std::vector<double>& coor) const | |
997 | { | ||
998 | #ifdef FELISCE_WITH_LIBXFM | ||
999 | |||
1000 |
2/2✓ Branch 0 taken 50472 times.
✓ Branch 1 taken 16824 times.
|
67296 | for(std::size_t i = 0; i < 3; ++i) |
1001 | 50472 | coor[i] = static_cast<double>( m_crdMsh[ m_eltMsh[ielSub+1][iPt]][i] ); | |
1002 | |||
1003 | #else | ||
1004 | |||
1005 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1006 | IGNORE_UNUSED_ARGUMENT(iPt); | ||
1007 | IGNORE_UNUSED_ARGUMENT(coor); | ||
1008 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1009 | |||
1010 | #endif | ||
1011 | 16824 | } | |
1012 | |||
1013 | /***********************************************************************************/ | ||
1014 | /***********************************************************************************/ | ||
1015 | |||
1016 | 11216 | felInt XFMInterface::getSubMshEltSide(const felInt iel, const felInt ielSub) const | |
1017 | { | ||
1018 | #ifdef FELISCE_WITH_LIBXFM | ||
1019 | |||
1020 | 11216 | return static_cast<felInt>(m_eltSgn[getSubMshEltIdxMsh(iel, ielSub) + 1]); | |
1021 | |||
1022 | #else | ||
1023 | |||
1024 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1025 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1026 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1027 | |||
1028 | return 0; | ||
1029 | |||
1030 | #endif | ||
1031 | } | ||
1032 | |||
1033 | /***********************************************************************************/ | ||
1034 | /***********************************************************************************/ | ||
1035 | |||
1036 | 141128 | felInt XFMInterface::getNumSubItfEltPerMshElt(const felInt iel) const | |
1037 | { | ||
1038 | #ifdef FELISCE_WITH_LIBXFM | ||
1039 | |||
1040 | 141128 | return static_cast<felInt>(m_ptrItfEltMsh[iel+2] - m_ptrItfEltMsh[iel+1]); | |
1041 | |||
1042 | #else | ||
1043 | |||
1044 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1045 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1046 | |||
1047 | return 0; | ||
1048 | |||
1049 | #endif | ||
1050 | } | ||
1051 | |||
1052 | /***********************************************************************************/ | ||
1053 | /***********************************************************************************/ | ||
1054 | |||
1055 | 8224 | felInt XFMInterface::getSubItfEltIdxMsh(const felInt iel, const felInt ielSub) const | |
1056 | { | ||
1057 | #ifdef FELISCE_WITH_LIBXFM | ||
1058 | |||
1059 | 8224 | return static_cast<felInt>(m_lstItfEltMsh[m_ptrItfEltMsh[iel+1] + ielSub] - 1); | |
1060 | |||
1061 | #else | ||
1062 | |||
1063 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1064 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1065 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1066 | |||
1067 | return 0; | ||
1068 | |||
1069 | #endif | ||
1070 | } | ||
1071 | |||
1072 | /***********************************************************************************/ | ||
1073 | /***********************************************************************************/ | ||
1074 | |||
1075 | 20560 | void XFMInterface::getSubItfEltVerCrd(const felInt ielSub, const felInt iPt, std::vector<double>& coor) const | |
1076 | { | ||
1077 | #ifdef FELISCE_WITH_LIBXFM | ||
1078 | |||
1079 |
1/2✓ Branch 0 taken 20560 times.
✗ Branch 1 not taken.
|
20560 | if( m_dim == 2 ) { |
1080 | |||
1081 |
2/2✓ Branch 0 taken 61680 times.
✓ Branch 1 taken 20560 times.
|
82240 | for(std::size_t i = 0; i < 3; ++i) |
1082 | 61680 | coor[i] = static_cast<double>( m_crdItf[ m_elt2DItf[ielSub+1][iPt]][i] ); | |
1083 | } else { | ||
1084 | |||
1085 | ✗ | for(std::size_t i = 0; i < 3; ++i) | |
1086 | ✗ | coor[i] = static_cast<double>( m_crdItf[ m_elt3DItf[ielSub+1][iPt]][i] ); | |
1087 | } | ||
1088 | |||
1089 | #else | ||
1090 | |||
1091 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1092 | IGNORE_UNUSED_ARGUMENT(iPt); | ||
1093 | IGNORE_UNUSED_ARGUMENT(coor); | ||
1094 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1095 | |||
1096 | #endif | ||
1097 | 20560 | } | |
1098 | |||
1099 | /***********************************************************************************/ | ||
1100 | /***********************************************************************************/ | ||
1101 | |||
1102 | 720 | felInt XFMInterface::getNumSubItfEltPerItfElt(const felInt iel) const | |
1103 | { | ||
1104 | #ifdef FELISCE_WITH_LIBXFM | ||
1105 | |||
1106 | 720 | return static_cast<felInt>(m_ptrIntEltItf[iel+2] - m_ptrIntEltItf[iel+1]); | |
1107 | |||
1108 | #else | ||
1109 | |||
1110 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1111 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1112 | |||
1113 | return 0; | ||
1114 | |||
1115 | #endif | ||
1116 | } | ||
1117 | |||
1118 | /***********************************************************************************/ | ||
1119 | /***********************************************************************************/ | ||
1120 | |||
1121 | 2056 | felInt XFMInterface::getSubItfEltIdxItf(const felInt iel, const felInt ielSub) const | |
1122 | { | ||
1123 | #ifdef FELISCE_WITH_LIBXFM | ||
1124 | |||
1125 | 2056 | return static_cast<felInt>(m_lstIntEltItf[m_ptrIntEltItf[iel+1] + ielSub] - 1); | |
1126 | |||
1127 | #else | ||
1128 | |||
1129 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1130 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1131 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1132 | |||
1133 | return 0; | ||
1134 | |||
1135 | #endif | ||
1136 | } | ||
1137 | |||
1138 | /***********************************************************************************/ | ||
1139 | /***********************************************************************************/ | ||
1140 | |||
1141 | 2056 | felInt XFMInterface::getMshEltIdxOfSubItfElt(const felInt ielSub) const | |
1142 | { | ||
1143 | #ifdef FELISCE_WITH_LIBXFM | ||
1144 | |||
1145 | 2056 | return static_cast<felInt>(m_elt2MshEltItf[ielSub+1] - 1); | |
1146 | |||
1147 | #else | ||
1148 | |||
1149 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1150 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1151 | |||
1152 | return 0; | ||
1153 | |||
1154 | #endif | ||
1155 | } | ||
1156 | |||
1157 | /***********************************************************************************/ | ||
1158 | /***********************************************************************************/ | ||
1159 | |||
1160 | 8224 | felInt XFMInterface::getItfEltIdxOfSubItfElt(const felInt ielSub) const | |
1161 | { | ||
1162 | #ifdef FELISCE_WITH_LIBXFM | ||
1163 | |||
1164 | 8224 | return static_cast<felInt>(m_elt2ItfElt[ielSub+1] - 1); | |
1165 | |||
1166 | #else | ||
1167 | |||
1168 | IGNORE_UNUSED_ARGUMENT(ielSub); | ||
1169 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1170 | |||
1171 | return 0; | ||
1172 | |||
1173 | #endif | ||
1174 | } | ||
1175 | |||
1176 | /***********************************************************************************/ | ||
1177 | /***********************************************************************************/ | ||
1178 | |||
1179 | ✗ | felInt XFMInterface::getNumTipElt() const | |
1180 | { | ||
1181 | #ifdef FELISCE_WITH_LIBXFM | ||
1182 | |||
1183 | ✗ | return static_cast<felInt>(m_nbrIntTipElt); | |
1184 | |||
1185 | #else | ||
1186 | |||
1187 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1188 | |||
1189 | return 0; | ||
1190 | |||
1191 | #endif | ||
1192 | } | ||
1193 | |||
1194 | /***********************************************************************************/ | ||
1195 | /***********************************************************************************/ | ||
1196 | |||
1197 | ✗ | felInt XFMInterface::getTipEltIdx(const felInt ielTip) const | |
1198 | { | ||
1199 | #ifdef FELISCE_WITH_LIBXFM | ||
1200 | |||
1201 | ✗ | return static_cast<felInt>(m_tipElt2MshElt[ielTip+1]-1); | |
1202 | |||
1203 | #else | ||
1204 | |||
1205 | IGNORE_UNUSED_ARGUMENT(ielTip); | ||
1206 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1207 | |||
1208 | return 0; | ||
1209 | |||
1210 | #endif | ||
1211 | } | ||
1212 | |||
1213 | /***********************************************************************************/ | ||
1214 | /***********************************************************************************/ | ||
1215 | |||
1216 | ✗ | felInt XFMInterface::getItfEltRef(const felInt iel) const | |
1217 | { | ||
1218 | #ifdef FELISCE_WITH_LIBXFM | ||
1219 | |||
1220 | ✗ | return static_cast<felInt>(m_listStrucRef[iel+1]); | |
1221 | |||
1222 | #else | ||
1223 | |||
1224 | IGNORE_UNUSED_ARGUMENT(iel); | ||
1225 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1226 | |||
1227 | return 0; | ||
1228 | |||
1229 | #endif | ||
1230 | } | ||
1231 | |||
1232 | /***********************************************************************************/ | ||
1233 | /***********************************************************************************/ | ||
1234 | |||
1235 | ✗ | felInt XFMInterface::getNumSubFacPerFacTipElt(const felInt ielTip, const felInt ifa) const | |
1236 | { | ||
1237 | #ifdef FELISCE_WITH_LIBXFM | ||
1238 | |||
1239 | ✗ | if ( ifa == m_dim ) | |
1240 | ✗ | return static_cast<felInt>(m_ptrTipSrf[ielTip+2][0] - m_ptrTipSrf[ielTip+1][ifa]); | |
1241 | |||
1242 | ✗ | return static_cast<felInt>(m_ptrTipSrf[ielTip+1][ifa+1] - m_ptrTipSrf[ielTip+1][ifa]); | |
1243 | |||
1244 | #else | ||
1245 | |||
1246 | IGNORE_UNUSED_ARGUMENT(ielTip); | ||
1247 | IGNORE_UNUSED_ARGUMENT(ifa); | ||
1248 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1249 | |||
1250 | return 0; | ||
1251 | |||
1252 | #endif | ||
1253 | } | ||
1254 | |||
1255 | /***********************************************************************************/ | ||
1256 | /***********************************************************************************/ | ||
1257 | |||
1258 | ✗ | felInt XFMInterface::getSubTipFacIdxMsh(const felInt ielTip, const felInt ifa, felInt isubFac) const | |
1259 | { | ||
1260 | #ifdef FELISCE_WITH_LIBXFM | ||
1261 | |||
1262 | ✗ | return static_cast<felInt>(m_lstTipSrf[m_ptrTipSrf[ielTip+1][ifa]+isubFac] - 1); | |
1263 | |||
1264 | #else | ||
1265 | |||
1266 | IGNORE_UNUSED_ARGUMENT(ielTip); | ||
1267 | IGNORE_UNUSED_ARGUMENT(ifa); | ||
1268 | IGNORE_UNUSED_ARGUMENT(isubFac); | ||
1269 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1270 | |||
1271 | return 0; | ||
1272 | |||
1273 | #endif | ||
1274 | } | ||
1275 | |||
1276 | /***********************************************************************************/ | ||
1277 | /***********************************************************************************/ | ||
1278 | |||
1279 | ✗ | void XFMInterface::getSubTipFacVerCrd(const felInt iSubFac, const felInt iPt, std::vector<double>& coor) const | |
1280 | { | ||
1281 | #ifdef FELISCE_WITH_LIBXFM | ||
1282 | |||
1283 | ✗ | if ( m_dim == 2 ) { | |
1284 | ✗ | for(std::size_t i = 0; i < 3; ++i) | |
1285 | ✗ | coor[i] = static_cast<double>(m_crdMsh[m_tipSrf2D[iSubFac+1][iPt]][i]); | |
1286 | } | ||
1287 | else { | ||
1288 | ✗ | for(std::size_t i = 0; i < 3; ++i) | |
1289 | ✗ | coor[i] = static_cast<double>(m_crdMsh[m_tipSrf3D[iSubFac+1][iPt]][i]); | |
1290 | } | ||
1291 | |||
1292 | #else | ||
1293 | |||
1294 | IGNORE_UNUSED_ARGUMENT(iSubFac); | ||
1295 | IGNORE_UNUSED_ARGUMENT(iPt); | ||
1296 | IGNORE_UNUSED_ARGUMENT(coor); | ||
1297 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1298 | |||
1299 | #endif | ||
1300 | } | ||
1301 | |||
1302 | /***********************************************************************************/ | ||
1303 | /***********************************************************************************/ | ||
1304 | |||
1305 | ✗ | felInt XFMInterface::getSgnSubFace(const felInt iSubFac) const | |
1306 | { | ||
1307 | #ifdef FELISCE_WITH_LIBXFM | ||
1308 | |||
1309 | ✗ | return static_cast<felInt>(m_tipSrfSgn[iSubFac+1][0]); | |
1310 | |||
1311 | #else | ||
1312 | |||
1313 | IGNORE_UNUSED_ARGUMENT(iSubFac); | ||
1314 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1315 | |||
1316 | return 0; | ||
1317 | |||
1318 | #endif | ||
1319 | } | ||
1320 | |||
1321 | /***********************************************************************************/ | ||
1322 | /***********************************************************************************/ | ||
1323 | |||
1324 | ✗ | felInt XFMInterface::getSgnSubOppFace(const felInt iSubFac) const | |
1325 | { | ||
1326 | #ifdef FELISCE_WITH_LIBXFM | ||
1327 | |||
1328 | ✗ | return static_cast<felInt>(m_tipSrfSgn[iSubFac+1][1]); | |
1329 | |||
1330 | #else | ||
1331 | |||
1332 | IGNORE_UNUSED_ARGUMENT(iSubFac); | ||
1333 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1334 | |||
1335 | return 0; | ||
1336 | |||
1337 | #endif | ||
1338 | } | ||
1339 | |||
1340 | /***********************************************************************************/ | ||
1341 | /***********************************************************************************/ | ||
1342 | |||
1343 | 40 | felInt XFMInterface::getNumFrontPoints() const | |
1344 | { | ||
1345 | #ifdef FELISCE_WITH_LIBXFM | ||
1346 | |||
1347 | 40 | return m_nbrIntVerFro; | |
1348 | |||
1349 | #else | ||
1350 | |||
1351 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1352 | |||
1353 | return 0; | ||
1354 | |||
1355 | #endif | ||
1356 | } | ||
1357 | |||
1358 | /***********************************************************************************/ | ||
1359 | /***********************************************************************************/ | ||
1360 | |||
1361 | 160 | void XFMInterface::getFrontPointInfo(const felInt iVer, std::vector<felInt>& verFro) const | |
1362 | { | ||
1363 | #ifdef FELISCE_WITH_LIBXFM | ||
1364 | |||
1365 | 160 | verFro.resize(3); | |
1366 | 160 | verFro[0] = m_verFro[iVer+1][0] - 1; | |
1367 | 160 | verFro[1] = m_verFro[iVer+1][1] - 1; | |
1368 | 160 | verFro[2] = m_verFro[iVer+1][2] - 1; | |
1369 | |||
1370 | #else | ||
1371 | |||
1372 | IGNORE_UNUSED_ARGUMENT(iVer); | ||
1373 | IGNORE_UNUSED_ARGUMENT(verFro); | ||
1374 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1375 | |||
1376 | #endif | ||
1377 | 160 | } | |
1378 | |||
1379 | /***********************************************************************************/ | ||
1380 | /***********************************************************************************/ | ||
1381 | |||
1382 | 16 | bool XFMInterface::checkFrontPoint(const felInt iVer) const | |
1383 | { | ||
1384 | #ifdef FELISCE_WITH_LIBXFM | ||
1385 | |||
1386 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 8 times.
|
36 | for(felInt i = 1; i <= m_nbrIntVerFro; ++i) |
1387 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 20 times.
|
28 | if( m_verFro[i][0] == iVer+1 ) |
1388 | 8 | return true; | |
1389 | |||
1390 | 8 | return false; | |
1391 | |||
1392 | #else | ||
1393 | |||
1394 | IGNORE_UNUSED_ARGUMENT(iVer); | ||
1395 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1396 | |||
1397 | return false; | ||
1398 | |||
1399 | #endif | ||
1400 | } | ||
1401 | |||
1402 | /***********************************************************************************/ | ||
1403 | /***********************************************************************************/ | ||
1404 | |||
1405 | 22 | void XFMInterface::setIteration(const felInt iteration) | |
1406 | { | ||
1407 | #ifdef FELISCE_WITH_LIBXFM | ||
1408 | |||
1409 | 22 | m_iteration = iteration; | |
1410 | |||
1411 | #else | ||
1412 | |||
1413 | IGNORE_UNUSED_ARGUMENT(iteration); | ||
1414 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1415 | |||
1416 | #endif | ||
1417 | 22 | } | |
1418 | |||
1419 | /***********************************************************************************/ | ||
1420 | /***********************************************************************************/ | ||
1421 | |||
1422 | 2 | void XFMInterface::setMeshesName(const std::string fluidMesh, const std::string strucMesh) | |
1423 | { | ||
1424 | #ifdef FELISCE_WITH_LIBXFM | ||
1425 | |||
1426 | 2 | m_fluidMeshName = fluidMesh; | |
1427 | 2 | m_strucMeshName = strucMesh; | |
1428 | |||
1429 | #else | ||
1430 | |||
1431 | IGNORE_UNUSED_ARGUMENT(fluidMesh); | ||
1432 | IGNORE_UNUSED_ARGUMENT(strucMesh); | ||
1433 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1434 | |||
1435 | #endif | ||
1436 | 2 | } | |
1437 | |||
1438 | /***********************************************************************************/ | ||
1439 | /***********************************************************************************/ | ||
1440 | |||
1441 | 2 | void XFMInterface::buildFictitiousToStructureMap(const GeometricMeshRegion& strucMesh, std::unordered_map<int,int>& ref2XFMlabel) const | |
1442 | { | ||
1443 | #ifdef FELISCE_WITH_LIBXFM | ||
1444 | |||
1445 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | const std::vector<int>& r_structures = FelisceParam::instance().structures; |
1446 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | const std::vector<int>& r_numficxstr = FelisceParam::instance().numficxstr; |
1447 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | const std::vector<int>& r_fictitious = FelisceParam::instance().fictitious; |
1448 | |||
1449 | // loop over felisce label | ||
1450 | int startIndex, pos; | ||
1451 | 2 | int xfmLabel = 1; | |
1452 | 2 | GeometricMeshRegion::ElementType strucType = strucMesh.bagElementTypeDomain()[0]; | |
1453 |
2/2✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
|
6 | for (auto it = strucMesh.intRefToBegEndMaps[strucType].begin(); it != strucMesh.intRefToBegEndMaps[strucType].end(); ++it){ |
1454 | |||
1455 |
1/2✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | auto it_fic = std::find(r_fictitious.begin(), r_fictitious.end(), it->first); |
1456 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | if ( it_fic == r_fictitious.end() ) { |
1457 | |||
1458 |
1/2✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | ref2XFMlabel.insert( {it->first, xfmLabel} ); |
1459 | |||
1460 |
1/2✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | auto it_r2f = std::find(r_structures.begin(), r_structures.end(), it->first); |
1461 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | if ( it_r2f != r_structures.end() ) { |
1462 | |||
1463 | ✗ | pos = std::distance(r_structures.begin(), it_r2f); | |
1464 | |||
1465 | ✗ | startIndex = std::accumulate(r_numficxstr.begin(), r_numficxstr.begin()+pos, 0); | |
1466 | ✗ | for (auto ific=startIndex; ific<startIndex+r_numficxstr[pos]; ++ific) | |
1467 | ✗ | ref2XFMlabel.insert( {r_fictitious[ific], -xfmLabel} ); | |
1468 | } | ||
1469 | |||
1470 | 4 | xfmLabel++; | |
1471 | } | ||
1472 | } | ||
1473 | |||
1474 | #else | ||
1475 | |||
1476 | IGNORE_UNUSED_ARGUMENT(strucMesh); | ||
1477 | IGNORE_UNUSED_ARGUMENT(ref2XFMlabel); | ||
1478 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1479 | |||
1480 | #endif | ||
1481 | 2 | } | |
1482 | |||
1483 | /***********************************************************************************/ | ||
1484 | /***********************************************************************************/ | ||
1485 | |||
1486 | 22 | void XFMInterface::intersectMeshes() | |
1487 | { | ||
1488 | #ifdef FELISCE_WITH_LIBXFM | ||
1489 | |||
1490 | //- Intersect meshes | ||
1491 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1492 | 22 | Xfm_LibraryIntersection(m_xfm, 0); | |
1493 | |||
1494 | #else | ||
1495 | |||
1496 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1497 | |||
1498 | #endif | ||
1499 | 22 | } | |
1500 | |||
1501 | /***********************************************************************************/ | ||
1502 | /***********************************************************************************/ | ||
1503 | |||
1504 | 22 | void XFMInterface::returnAndBcastVolumeMeshData() | |
1505 | { | ||
1506 | #ifdef FELISCE_WITH_LIBXFM | ||
1507 | |||
1508 | //- Data of the mesh | ||
1509 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1510 | 22 | Xfm_LibraryReturnMeshData(m_xfm, &m_sizLstIntEltMsh, &m_ptrIntEltMsh, &m_lstIntEltMsh, &m_sizLstItfEltMsh, &m_ptrItfEltMsh, &m_lstItfEltMsh, &m_verSgn); | |
1511 | |||
1512 | 22 | MPI_Bcast(&m_sizLstIntEltMsh, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1513 | 22 | MPI_Bcast(&m_sizLstItfEltMsh, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1514 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1515 | ✗ | m_lstIntEltMsh = (int1d*)realloc(m_lstIntEltMsh, sizeof(int1d)*m_sizLstIntEltMsh); | |
1516 | ✗ | m_lstItfEltMsh = (int1d*)realloc(m_lstItfEltMsh, sizeof(int1d)*m_sizLstItfEltMsh); | |
1517 | } | ||
1518 | 22 | MPI_Bcast(m_ptrIntEltMsh, m_numEltMsh+2, MPI_INT, 0, MpiInfo::petscComm()); | |
1519 | 22 | MPI_Bcast(m_lstIntEltMsh, m_sizLstIntEltMsh, MPI_INT, 0, MpiInfo::petscComm()); | |
1520 | 22 | MPI_Bcast(m_ptrItfEltMsh, m_numEltMsh+2, MPI_INT, 0, MpiInfo::petscComm()); | |
1521 | 22 | MPI_Bcast(m_lstItfEltMsh, m_sizLstItfEltMsh, MPI_INT, 0, MpiInfo::petscComm()); | |
1522 | // MPI_Bcast(m_verSgn, m_numVerMsh+1, MPI_INT, 0, MpiInfo::petscComm()); | ||
1523 | |||
1524 | #else | ||
1525 | |||
1526 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1527 | |||
1528 | #endif | ||
1529 | 22 | } | |
1530 | |||
1531 | /***********************************************************************************/ | ||
1532 | /***********************************************************************************/ | ||
1533 | |||
1534 | 22 | void XFMInterface::returnAndBcastInterfaceMeshData() | |
1535 | { | ||
1536 | #ifdef FELISCE_WITH_LIBXFM | ||
1537 | |||
1538 | //- Data of the interface mesh | ||
1539 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1540 | 22 | Xfm_LibraryReturnInterfaceMeshData(m_xfm, &m_sizLstIntEltItf, &m_ptrIntEltItf, &m_lstIntEltItf); | |
1541 | |||
1542 | 22 | MPI_Bcast(&m_sizLstIntEltItf, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1543 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1544 | ✗ | m_lstIntEltItf = (int1d*)realloc(m_lstIntEltItf, sizeof(int1d)*m_sizLstIntEltItf); | |
1545 | } | ||
1546 | 22 | MPI_Bcast(m_ptrIntEltItf, m_numEltItf+2, MPI_INT, 0, MpiInfo::petscComm()); | |
1547 | 22 | MPI_Bcast(m_lstIntEltItf, m_sizLstIntEltItf, MPI_INT, 0, MpiInfo::petscComm()); | |
1548 | |||
1549 | #else | ||
1550 | |||
1551 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1552 | |||
1553 | #endif | ||
1554 | 22 | } | |
1555 | |||
1556 | /***********************************************************************************/ | ||
1557 | /***********************************************************************************/ | ||
1558 | |||
1559 | 22 | void XFMInterface::returnAndBcastIntersectedVolumeMeshData() | |
1560 | { | ||
1561 | #ifdef FELISCE_WITH_LIBXFM | ||
1562 | |||
1563 | //- Data of the intersected mesh | ||
1564 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1565 | 22 | Xfm_LibraryReturnIntersectMeshData(m_xfm, &m_nbrIntVerMsh, &m_crdMsh, &m_intVerIdx, &m_intVerSgn, &m_nbrIntEltMsh, &m_eltMsh, &m_elt2MshEltMsh, &m_eltSgn); | |
1566 | |||
1567 | 22 | MPI_Bcast(&m_nbrIntVerMsh, 1, MPI_INT, 0, MpiInfo::petscComm()); // control mpi-type Long Int | |
1568 | 22 | MPI_Bcast(&m_nbrIntEltMsh, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1569 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1570 | ✗ | m_crdMsh = (double3d*)realloc(m_crdMsh, sizeof(double3d)*(m_nbrIntVerMsh+1)); | |
1571 | ✗ | m_intVerIdx = (int1d* )realloc(m_intVerIdx, sizeof(int1d )*(m_nbrIntVerMsh+1)); | |
1572 | ✗ | m_intVerSgn = (int1d* )realloc(m_intVerSgn, sizeof(int1d )*(m_nbrIntVerMsh+1)); | |
1573 | |||
1574 | ✗ | m_eltMsh = (int4d*)realloc(m_eltMsh, sizeof(int4d)*(m_nbrIntEltMsh+1)); | |
1575 | ✗ | m_elt2MshEltMsh = (int1d*)realloc(m_elt2MshEltMsh, sizeof(int1d)*(m_nbrIntEltMsh+1)); | |
1576 | ✗ | m_eltSgn = (int1d*)realloc(m_eltSgn, sizeof(int1d)*(m_nbrIntEltMsh+1)); | |
1577 | } | ||
1578 | 22 | MPI_Bcast(m_crdMsh, 3*(m_nbrIntVerMsh+1), MPI_DOUBLE, 0, MpiInfo::petscComm()); | |
1579 | 22 | MPI_Bcast(m_intVerIdx, m_nbrIntVerMsh+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1580 | 22 | MPI_Bcast(m_intVerSgn, m_nbrIntVerMsh+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1581 | 22 | MPI_Bcast(m_eltMsh, 4*(m_nbrIntEltMsh+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1582 | 22 | MPI_Bcast(m_elt2MshEltMsh, m_nbrIntEltMsh+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1583 | 22 | MPI_Bcast(m_eltSgn, m_nbrIntEltMsh+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1584 | |||
1585 | #else | ||
1586 | |||
1587 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1588 | |||
1589 | #endif | ||
1590 | 22 | } | |
1591 | |||
1592 | /***********************************************************************************/ | ||
1593 | /***********************************************************************************/ | ||
1594 | |||
1595 | 22 | void XFMInterface::returnAndBcastIntersectedInterfaceMeshData() | |
1596 | { | ||
1597 | #ifdef FELISCE_WITH_LIBXFM | ||
1598 | |||
1599 | //- Data of the intersected interface | ||
1600 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1601 | 22 | Xfm_LibraryReturnIntersectInterfaceMeshData(m_xfm, &m_nbrIntVerItf, &m_crdItf, &m_nbrIntEltItf, &m_elt2DItf, &m_elt3DItf, &m_elt2MshEltItf, &m_elt2ItfElt); | |
1602 | |||
1603 | 22 | MPI_Bcast(&m_nbrIntVerItf, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1604 | 22 | MPI_Bcast(&m_nbrIntEltItf, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1605 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1606 | ✗ | m_crdItf = (double3d*)realloc(m_crdItf, sizeof(double3d)*3*(m_nbrIntVerItf+1)); | |
1607 | ✗ | if(m_dim == 2) | |
1608 | ✗ | m_elt2DItf = (int3d*)realloc(m_elt2DItf, sizeof(int3d)*(m_nbrIntEltItf+1)); | |
1609 | else | ||
1610 | ✗ | m_elt3DItf = (int4d*)realloc(m_elt3DItf, sizeof(int4d)*(m_nbrIntEltItf+1)); | |
1611 | ✗ | m_elt2MshEltItf = (int1d*)realloc(m_elt2MshEltItf, sizeof(int1d)*(m_nbrIntEltItf+1)); | |
1612 | ✗ | m_elt2ItfElt = (int1d*)realloc(m_elt2ItfElt, sizeof(int1d)*(m_nbrIntEltItf+1)); | |
1613 | } | ||
1614 | 22 | MPI_Bcast(m_crdItf, 3*(m_nbrIntVerItf+1), MPI_DOUBLE, 0, MpiInfo::petscComm()); | |
1615 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(m_dim == 2) |
1616 | 22 | MPI_Bcast(m_elt2DItf, 3*(m_nbrIntEltItf+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1617 | else | ||
1618 | ✗ | MPI_Bcast(m_elt3DItf, 4*(m_nbrIntEltItf+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1619 | 22 | MPI_Bcast(m_elt2MshEltItf, m_nbrIntEltItf+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1620 | 22 | MPI_Bcast(m_elt2ItfElt, m_nbrIntEltItf+1 , MPI_INT, 0, MpiInfo::petscComm()); | |
1621 | |||
1622 | #else | ||
1623 | |||
1624 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1625 | |||
1626 | #endif | ||
1627 | 22 | } | |
1628 | |||
1629 | /***********************************************************************************/ | ||
1630 | /***********************************************************************************/ | ||
1631 | |||
1632 | 22 | void XFMInterface::returnAndBcastIntersectedBoundaryMeshData() | |
1633 | { | ||
1634 | #ifdef FELISCE_WITH_LIBXFM | ||
1635 | |||
1636 | //- Data of the intersected boundary mesh | ||
1637 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1638 | 22 | Xfm_LibraryReturnBndMeshData(m_xfm, &m_sizLstIntBndMsh, &m_ptrIntBndMsh, &m_lstIntBndMsh, &m_nbrIntEltBnd, &m_elt2DBnd, &m_elt3DBnd); | |
1639 | |||
1640 | 22 | MPI_Bcast(&m_sizLstIntBndMsh, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1641 | 22 | MPI_Bcast(&m_nbrIntEltBnd, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1642 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1643 | ✗ | m_lstIntBndMsh = (int1d*)realloc(m_lstIntBndMsh, sizeof(int1d)*m_sizLstIntBndMsh); | |
1644 | ✗ | if(m_dim == 2) | |
1645 | ✗ | m_elt2DBnd = (int3d*)realloc(m_elt2DBnd, sizeof(int3d)*(m_nbrIntEltBnd+1)); | |
1646 | else | ||
1647 | ✗ | m_elt3DBnd = (int4d*)realloc(m_elt3DBnd, sizeof(int4d)*(m_nbrIntEltBnd+1)); | |
1648 | } | ||
1649 | 22 | MPI_Bcast(m_ptrIntBndMsh, m_numBndMsh+2, MPI_INT, 0, MpiInfo::petscComm()); | |
1650 | 22 | MPI_Bcast(m_lstIntBndMsh, m_sizLstIntBndMsh, MPI_INT, 0, MpiInfo::petscComm()); | |
1651 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(m_dim == 2) |
1652 | 22 | MPI_Bcast(m_elt2DBnd, 3*(m_nbrIntEltBnd+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1653 | else | ||
1654 | ✗ | MPI_Bcast(m_elt3DBnd, 4*(m_nbrIntEltBnd+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1655 | |||
1656 | #else | ||
1657 | |||
1658 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1659 | |||
1660 | #endif | ||
1661 | 22 | } | |
1662 | |||
1663 | /***********************************************************************************/ | ||
1664 | /***********************************************************************************/ | ||
1665 | |||
1666 | ✗ | void XFMInterface::returnAndBcastIntersectedTipMeshData() | |
1667 | { | ||
1668 | #ifdef FELISCE_WITH_LIBXFM | ||
1669 | |||
1670 | //- Data of the elements containing a tip | ||
1671 | ✗ | if ( MpiInfo::rankProc() == 0 ) | |
1672 | ✗ | Xfm_LibraryReturnTipMeshData(m_xfm, &m_sizLstTipSrf, &m_ptrTipSrf, &m_lstTipSrf, &m_nbrIntTipElt, &m_tipElt2MshElt, &m_nbrIntTipSrf, &m_tipSrf3D , &m_tipSrf2D, &m_tipSrfSgn); | |
1673 | |||
1674 | ✗ | MPI_Bcast(&m_sizLstTipSrf, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1675 | ✗ | MPI_Bcast(&m_nbrIntTipElt, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1676 | ✗ | MPI_Bcast(&m_nbrIntTipSrf, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1677 | |||
1678 | ✗ | if( MpiInfo::rankProc() != 0 ){ | |
1679 | ✗ | m_ptrTipSrf = (int4d*)realloc(m_ptrTipSrf, sizeof(int4d)*(m_nbrIntTipElt+2)); | |
1680 | ✗ | m_lstTipSrf = (int1d*)realloc(m_lstTipSrf, sizeof(int1d)*m_sizLstTipSrf); | |
1681 | ✗ | if(m_dim == 2) | |
1682 | ✗ | m_tipSrf2D = (int2d*)realloc(m_tipSrf2D, sizeof(int2d)*(m_nbrIntTipSrf+1)); | |
1683 | else | ||
1684 | ✗ | m_tipSrf3D = (int4d*)realloc(m_tipSrf3D, sizeof(int4d)*(m_nbrIntTipSrf+1)); | |
1685 | ✗ | m_tipElt2MshElt = (int1d*)realloc(m_tipElt2MshElt, sizeof(int1d)*(m_nbrIntTipElt+1)); | |
1686 | ✗ | m_tipSrfSgn = (int2d*)realloc(m_tipSrfSgn, sizeof(int2d)*(m_nbrIntTipSrf+1)); | |
1687 | } | ||
1688 | ✗ | MPI_Bcast(m_ptrTipSrf, 4*(m_nbrIntTipElt+2), MPI_INT, 0, MpiInfo::petscComm()); | |
1689 | ✗ | MPI_Bcast(m_lstTipSrf, m_sizLstTipSrf, MPI_INT, 0, MpiInfo::petscComm()); | |
1690 | ✗ | MPI_Bcast(m_tipElt2MshElt, m_nbrIntTipElt+1, MPI_INT, 0, MpiInfo::petscComm()); | |
1691 | ✗ | if(m_dim == 2) { | |
1692 | ✗ | MPI_Bcast(m_tipSrf2D, 2*(m_nbrIntTipSrf+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1693 | } else { | ||
1694 | ✗ | MPI_Bcast(m_tipSrf3D, 4*(m_nbrIntTipSrf+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1695 | } | ||
1696 | ✗ | MPI_Bcast(m_tipSrfSgn, 2*(m_nbrIntTipSrf+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1697 | |||
1698 | #else | ||
1699 | |||
1700 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1701 | |||
1702 | #endif | ||
1703 | } | ||
1704 | |||
1705 | /***********************************************************************************/ | ||
1706 | /***********************************************************************************/ | ||
1707 | |||
1708 | 22 | void XFMInterface::returnAndBcastIntersectedFrontMeshData() | |
1709 | { | ||
1710 | #ifdef FELISCE_WITH_LIBXFM | ||
1711 | |||
1712 | //- Data of the elements containing a front point | ||
1713 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1714 | 22 | Xfm_LibraryReturnFrontPointsData(m_xfm, &m_nbrIntVerFro, &m_verFro, &m_vecFro); | |
1715 | |||
1716 | 22 | MPI_Bcast(&m_nbrIntVerFro, 1, MPI_INT, 0, MpiInfo::petscComm()); | |
1717 | |||
1718 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
|
22 | if( MpiInfo::rankProc() != 0 ){ |
1719 | ✗ | m_verFro = (int3d*)realloc(m_verFro, sizeof(int3d)*(m_nbrIntVerFro+1)); | |
1720 | // m_vecFro = (double6d*)realloc(m_vecFro, sizeof(double6d)*(???????????+1)); | ||
1721 | } | ||
1722 | 22 | MPI_Bcast(m_verFro, 3*(m_nbrIntVerFro+1), MPI_INT, 0, MpiInfo::petscComm()); | |
1723 | // MPI_Bcast(&m_vecFro, 6*(....), MPI_DOUBLE, 0, MpiInfo::petscComm()); | ||
1724 | |||
1725 | #else | ||
1726 | |||
1727 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1728 | |||
1729 | #endif | ||
1730 | 22 | } | |
1731 | |||
1732 | /***********************************************************************************/ | ||
1733 | /***********************************************************************************/ | ||
1734 | |||
1735 | 22 | void XFMInterface::returnAndBcastMultipleInterfacesData() | |
1736 | { | ||
1737 | #ifdef FELISCE_WITH_LIBXFM | ||
1738 | |||
1739 | //- Data for multiple interfaces | ||
1740 |
1/2✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
|
22 | if ( MpiInfo::rankProc() == 0 ) |
1741 | 22 | Xfm_LibraryReturnIntersectingItfIdx(m_xfm, &m_mshItfIdx, &m_bndItfIdx); | |
1742 | |||
1743 | 22 | MPI_Bcast(m_mshItfIdx, m_numEltMsh+1, MPI_INT, 0, MpiInfo::petscComm()); | |
1744 | 22 | MPI_Bcast(m_bndItfIdx, m_numBndMsh+1, MPI_INT, 0, MpiInfo::petscComm()); | |
1745 | |||
1746 | #else | ||
1747 | |||
1748 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1749 | |||
1750 | #endif | ||
1751 | 22 | } | |
1752 | |||
1753 | /***********************************************************************************/ | ||
1754 | /***********************************************************************************/ | ||
1755 | |||
1756 | ✗ | void XFMInterface::writeInterfaceMesh() const | |
1757 | { | ||
1758 | |||
1759 | #ifdef FELISCE_WITH_LIBXFM | ||
1760 | |||
1761 | ✗ | if ( MpiInfo::rankProc() != 0 ) | |
1762 | ✗ | return; | |
1763 | |||
1764 | ✗ | std::string strucName = FelisceParam::instance().resultDir+m_strucMeshName+std::to_string(m_iteration); | |
1765 | |||
1766 | ✗ | Xfm_LibraryWriteInterfaceMesh(m_xfm, strucName.data()); | |
1767 | |||
1768 | #else | ||
1769 | |||
1770 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1771 | |||
1772 | #endif | ||
1773 | } | ||
1774 | |||
1775 | /***********************************************************************************/ | ||
1776 | /***********************************************************************************/ | ||
1777 | |||
1778 | ✗ | void XFMInterface::writeIntersectedMeshes() const | |
1779 | { | ||
1780 | |||
1781 | #ifdef FELISCE_WITH_LIBXFM | ||
1782 | |||
1783 | ✗ | if ( MpiInfo::rankProc() != 0 ) | |
1784 | ✗ | return; | |
1785 | |||
1786 | ✗ | std::string fluidName = FelisceParam::instance().resultDir+m_fluidMeshName+std::to_string(m_iteration); | |
1787 | ✗ | std::string strucName = FelisceParam::instance().resultDir+m_strucMeshName+std::to_string(m_iteration); | |
1788 | ✗ | std::string flTipName = FelisceParam::instance().resultDir+m_fluidMeshName+"Tip"+std::to_string(m_iteration); | |
1789 | |||
1790 | ✗ | Xfm_LibraryWriteIntersectMesh( 0, m_xfm, fluidName.data()); | |
1791 | ✗ | Xfm_LibraryWriteIntersectInterfaceMesh(m_xfm, strucName.data()); | |
1792 | ✗ | if( m_IntMethod == NonConfCutByItfMesh && getNumTipElt() > 0 ) | |
1793 | ✗ | Xfm_LibraryWriteTipElementMesh(m_xfm, flTipName.data()); | |
1794 | |||
1795 | #else | ||
1796 | |||
1797 | FEL_ERROR("You need to compile felisce with libXfm to use this function"); | ||
1798 | |||
1799 | #endif | ||
1800 | } | ||
1801 | |||
1802 | } | ||
1803 | |||
1804 | |||
1805 |