MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / trimPatches

Function trimPatches

src/dynamicMesh/fvMeshTools/fvMeshTools.C:274–320  ·  view source on GitHub ↗

Deletes last patch

Source from the content-addressed store, hash-verified

272
273// Deletes last patch
274void Foam::fvMeshTools::trimPatches(fvMesh& mesh, const label nPatches)
275{
276 // Clear local fields and e.g. polyMesh globalMeshData.
277 mesh.clearOut();
278
279 polyBoundaryMesh& polyPatches =
280 const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
281 fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
282
283 if (polyPatches.empty())
284 {
285 FatalErrorInFunction
286 << "No patches in mesh"
287 << abort(FatalError);
288 }
289
290 label nFaces = 0;
291 for (label patchi = nPatches; patchi < polyPatches.size(); patchi++)
292 {
293 nFaces += polyPatches[patchi].size();
294 }
295 reduce(nFaces, sumOp<label>());
296
297 if (nFaces)
298 {
299 FatalErrorInFunction
300 << "There are still " << nFaces
301 << " faces in " << polyPatches.size()-nPatches
302 << " patches to be deleted" << abort(FatalError);
303 }
304
305 // Remove actual patches
306 polyPatches.setSize(nPatches);
307 fvPatches.setSize(nPatches);
308
309 trimPatchFields<volScalarField>(mesh, nPatches);
310 trimPatchFields<volVectorField>(mesh, nPatches);
311 trimPatchFields<volSphericalTensorField>(mesh, nPatches);
312 trimPatchFields<volSymmTensorField>(mesh, nPatches);
313 trimPatchFields<volTensorField>(mesh, nPatches);
314
315 trimPatchFields<surfaceScalarField>(mesh, nPatches);
316 trimPatchFields<surfaceVectorField>(mesh, nPatches);
317 trimPatchFields<surfaceSphericalTensorField>(mesh, nPatches);
318 trimPatchFields<surfaceSymmTensorField>(mesh, nPatches);
319 trimPatchFields<surfaceTensorField>(mesh, nPatches);
320}
321
322
323void Foam::fvMeshTools::reorderPatches

Callers 1

reorderPatchesFunction · 0.85

Calls 5

abortFunction · 0.50
reduceFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected