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 "demandDrivenData.H"
29 #include "polyMeshGenAddressing.H"
30 #include "meshSurfaceEdgeExtractor.H"
31 #include "meshOctree.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 void meshSurfaceEdgeExtractor::createEdgeVertices()
45 pointFieldPMG& points = mesh_.points();
46 const faceListPMG& faces = mesh_.faces();
48 const edgeList& edges = mesh_.addressingData().edges();
49 const VRWGraph& faceEdges = mesh_.addressingData().faceEdges();
51 Map<label> newEdgePoint;
53 const label nIntFaces = mesh_.nInternalFaces();
54 const label nFaces = faces.size();
56 nPoints_ = points.size();
58 for(label faceI=nIntFaces;faceI<nFaces;++faceI)
60 const face& f = faces[faceI];
64 const label edgeI = faceEdges(faceI, pI);
66 if( newEdgePoint.found(edgeI) ) continue;
68 const label s = f[pI];
69 const label e = f.nextLabel(pI);
71 if( !pointRegions_.sizeOfRow(s) || !pointRegions_.sizeOfRow(e) )
73 Warning << "Boundary vertices " << s << " and " << e
74 << " are not mapped to the boundary!" << endl;
79 if( pointRegions_(s, 0) != pointRegions_(e, 0) )
85 FixedList<point, 2> edgePoints;
86 FixedList<label, 2> patches;
88 edgePoints[0] = points[s];
89 edgePoints[1] = points[e];
90 patches[0] = pointRegions_(s, 0);
91 patches[1] = pointRegions_(e, 0);
94 meshOctree_.findNearestPointToEdge
111 edges[faceEdges(faceI, pI)].centre(points)
115 pointRegions_.appendList(patches);
117 newEdgePoint.insert(edgeI, nPoints_);
123 points.setSize(nPoints_);
129 const face& f = faces[faceI];
136 if( newEdgePoint.found(faceEdges(faceI, eI)) )
137 newF.append(newEdgePoint[faceEdges(faceI, eI)]);
140 if( newF.size() > f.size() )
142 //- face must be changed
143 face& mf = const_cast<face&>(f);
144 mf.setSize(newF.size());
150 mesh_.clearAddressingData();
152 Info << "Finished creating mesh edges" << endl;
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 } // End namespace Foam
159 // ************************************************************************* //