/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. \\/ 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 \*----------------------------------------------------------------------------*/ #include "meshRefinement.H" #include "volMesh.H" #include "volFields.H" #include "surfaceMesh.H" #include "syncTools.H" #include "Time.H" #include "refinementHistory.H" #include "refinementSurfaces.H" #include "decompositionMethod.H" #include "regionSplit.H" #include "fvMeshDistribute.H" #include "indirectPrimitivePatch.H" #include "polyTopoChange.H" #include "removeCells.H" #include "mapDistributePolyMesh.H" #include "localPointRegion.H" #include "pointMesh.H" #include "pointFields.H" #include "slipPointPatchFields.H" #include "fixedValuePointPatchFields.H" #include "globalPointPatchFields.H" #include "calculatedPointPatchFields.H" #include "processorPointPatch.H" #include "globalIndex.H" #include "meshTools.H" #include "OFstream.H" #include "geomDecomp.H" #include "Random.H" #include "searchableSurfaces.H" #include "treeBoundBox.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(meshRefinement, 0); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::meshRefinement::calcNeighbourData ( labelList& neiLevel, pointField& neiCc ) const { const labelList& cellLevel = meshCutter_.cellLevel(); const pointField& cellCentres = mesh_.cellCentres(); label nBoundaryFaces = mesh_.nFaces() - mesh_.nInternalFaces(); if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces) { FatalErrorIn("meshRefinement::calcNeighbour(..)") << "nBoundaries:" << nBoundaryFaces << " neiLevel:" << neiLevel.size() << abort(FatalError); } const polyBoundaryMesh& patches = mesh_.boundaryMesh(); forAll(patches, patchI) { const polyPatch& pp = patches[patchI]; const unallocLabelList& faceCells = pp.faceCells(); const vectorField::subField faceCentres = pp.faceCentres(); label bFaceI = pp.start()-mesh_.nInternalFaces(); if (pp.coupled()) { forAll(faceCells, i) { neiLevel[bFaceI] = cellLevel[faceCells[i]]; neiCc[bFaceI] = cellCentres[faceCells[i]]; bFaceI++; } } else { forAll(faceCells, i) { neiLevel[bFaceI] = cellLevel[faceCells[i]]; neiCc[bFaceI] = faceCentres[i]; bFaceI++; } } } // Swap coupled boundaries. Apply separation to cc since is coordinate. syncTools::swapBoundaryFaceList(mesh_, neiCc, true); syncTools::swapBoundaryFaceList(mesh_, neiLevel, false); } // Find intersections of edges (given by their two endpoints) with surfaces. // Returns first intersection if there are more than one. void Foam::meshRefinement::updateIntersections(const labelList& changedFaces) { const pointField& cellCentres = mesh_.cellCentres(); // Stats on edges to test. Count proc faces only once. PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh_)); { label nMasterFaces = 0; forAll(isMasterFace, faceI) { if (isMasterFace.get(faceI) == 1) { nMasterFaces++; } } reduce(nMasterFaces, sumOp