/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright held by original author \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Application reconstructParMesh Description Reconstructs a mesh using geometric information only. Writes point/face/cell procAddressing so afterwards reconstructPar can be used to reconstruct fields. Note: - uses geometric matching tolerance (set with -mergeTol option) If the parallel case does not have correct procBoundaries use the -fullMatch option which will check all boundary faces (bit slower). \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "IOobjectList.H" #include "labelIOList.H" #include "processorPolyPatch.H" #include "mapAddedPolyMesh.H" #include "polyMeshAdder.H" #include "faceCoupleInfo.H" #include "fvMeshAdder.H" #include "directTopoChange.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Tolerance (as fraction of the bounding box). Needs to be fairly lax since // usually meshes get written with limited precision (6 digits) static const scalar defaultMergeTol = 1E-7; static void renumber ( const labelList& map, labelList& elems ) { forAll(elems, i) { if (elems[i] >= 0) { elems[i] = map[elems[i]]; } } } // Determine which faces are coupled. Uses geometric merge distance. // Looks either at all boundaryFaces (fullMatch) or only at the // procBoundaries for procI. Assumes that masterMesh contains already merged // all the processors < procI. autoPtr determineCoupledFaces ( const bool fullMatch, const label procI, const polyMesh& masterMesh, const polyMesh& meshToAdd, const scalar mergeDist ) { if (fullMatch || masterMesh.nCells() == 0) { return autoPtr ( new faceCoupleInfo ( masterMesh, meshToAdd, mergeDist, // absolute merging distance true // matching faces identical ) ); } else { // Pick up all patches on masterMesh ending in "toDDD" where DDD is // the processor number procI. const polyBoundaryMesh& masterPatches = masterMesh.boundaryMesh(); const string toProcString("to" + name(procI)); DynamicList