1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "meshSurfaceEdgeExtractor.H"
29 #include "demandDrivenData.H"
31 // #define DEBUGSearch
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 // Construct from mesh, octree, regions for boundary vertices
41 meshSurfaceEdgeExtractor::meshSurfaceEdgeExtractor
44 const meshOctree& octree,
45 const labelList& pointRegion
49 nPoints_(mesh.points().size()),
50 boundaryCell_(mesh.cells().size(), false),
51 nFacesInCell_(mesh.cells().size(), direction(0)),
53 pointRegions_(pointRegion.size())
55 forAll(pointRegion, pointI)
56 if( pointRegion[pointI] != -1 )
57 pointRegions_.append(pointI, pointRegion[pointI]);
61 removeOldBoundaryFaces();
63 createBoundaryFaces();
66 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 meshSurfaceEdgeExtractor::~meshSurfaceEdgeExtractor()
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 void meshSurfaceEdgeExtractor::removeOldBoundaryFaces()
76 const labelList neighbour_ = mesh_.neighbour();
77 polyMeshGenModifier meshModifier_(mesh_);
78 cellListPMG& cells_ = meshModifier_.cellsAccess();
82 const cell& c = cells_[cellI];
87 if( neighbour_[c[fI]] != -1 )
89 boundaryCell_[cellI] = true;
90 newC[nFacesInCell_[cellI]++] = c[fI];
93 if( nFacesInCell_[cellI] < direction(c.size()) )
95 newC.setSize(nFacesInCell_[cellI]);
101 PtrList<boundaryPatch>& boundaries = meshModifier_.boundariesAccess();
102 boundaries.setSize(1);
103 boundaries[0].patchSize() = 0;
104 meshModifier_.facesAccess().setSize(boundaries[0].patchStart());
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 } // End namespace Foam
111 // ************************************************************************* //