/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation \\/ 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 3 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, see . \*---------------------------------------------------------------------------*/ #include "singleCellFvMesh.H" #include "syncTools.H" #include "uindirectPrimitivePatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::singleCellFvMesh::agglomerateMesh ( const fvMesh& mesh, const labelListList& agglom ) { // Conversion is a two step process: // - from original (fine) patch faces to agglomerations (aggloms might not // be in correct patch order) // - from agglomerations to coarse patch faces const polyBoundaryMesh& oldPatches = mesh.poly().boundary(); // Check agglomeration within patch face range and continuous labelList nAgglom(oldPatches.size(), 0); forAll(oldPatches, patchi) { const polyPatch& pp = oldPatches[patchi]; if (pp.size() > 0) { nAgglom[patchi] = max(agglom[patchi])+1; forAll(pp, i) { if (agglom[patchi][i] < 0 || agglom[patchi][i] >= pp.size()) { FatalErrorInFunction << "agglomeration on patch " << patchi << " is out of range 0.." << pp.size()-1 << exit(FatalError); } } } } // Check agglomeration is sync { // Get neighbouring agglomeration labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces()); forAll(oldPatches, patchi) { const polyPatch& pp = oldPatches[patchi]; if (pp.coupled()) { label offset = pp.start()-mesh.nInternalFaces(); forAll(pp, i) { nbrAgglom[offset+i] = agglom[patchi][i]; } } } syncTools::swapBoundaryFaceList(mesh, nbrAgglom); // Get correspondence between this agglomeration and remote one Map