/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2015-2022,2024 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 "meshRefinement.H" #include "fvMesh.H" #include "syncTools.H" #include "Time.H" #include "refinementSurfaces.H" #include "pointSet.H" #include "faceSet.H" #include "indirectPrimitivePatch.H" #include "cellSet.H" #include "searchableSurfaces.H" #include "polyMeshGeometry.H" #include "IOmanip.H" #include "unitConversion.H" #include "snappySnapDriver.H" #include "snapParameters.H" #include "motionSmoother.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::meshRefinement::markBoundaryFace ( const label facei, boolList& isBoundaryFace, boolList& isBoundaryEdge, boolList& isBoundaryPoint ) const { isBoundaryFace[facei] = true; const labelList& fEdges = mesh_.faceEdges(facei); for (const label edgei : fEdges) { isBoundaryEdge[edgei] = true; } const face& f = mesh_.faces()[facei]; for (const label pointi : f) { isBoundaryPoint[pointi] = true; } } void Foam::meshRefinement::findNearest ( const labelList& meshFaces, List& nearestInfo, labelList& nearestSurface, labelList& nearestRegion, vectorField& nearestNormal ) const { pointField fc(meshFaces.size()); forAll(meshFaces, i) { fc[i] = mesh_.faceCentres()[meshFaces[i]]; } const labelList allSurfaces(identity(surfaces_.surfaces().size())); surfaces_.findNearest ( allSurfaces, fc, scalarField(fc.size(), sqr(GREAT)), // sqr of attraction nearestSurface, nearestInfo ); // Do normal testing per surface. nearestNormal.setSize(nearestInfo.size()); nearestRegion.setSize(nearestInfo.size()); forAll(allSurfaces, surfI) { DynamicList localHits; forAll(nearestSurface, i) { if (nearestSurface[i] == surfI) { localHits.append(nearestInfo[i]); } } label geomI = surfaces_.surfaces()[surfI]; pointField localNormals; surfaces_.geometry()[geomI].getNormal(localHits, localNormals); labelList localRegion; surfaces_.geometry()[geomI].getRegion(localHits, localRegion); label localI = 0; forAll(nearestSurface, i) { if (nearestSurface[i] == surfI) { nearestNormal[i] = localNormals[localI]; nearestRegion[i] = localRegion[localI]; localI++; } } } } Foam::Map Foam::meshRefinement::findEdgeConnectedProblemCells ( const scalarField& perpendicularAngle, const labelList& globalToPatch ) const { // Construct addressing engine from all patches added for meshing. autoPtr ppPtr ( meshRefinement::makePatch ( mesh_, meshedPatches() ) ); const indirectPrimitivePatch& pp = ppPtr(); // 1. Collect faces to test // ~~~~~~~~~~~~~~~~~~~~~~~~ DynamicList