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 "surfaceMorpherCells.H"
29 #include "demandDrivenData.H"
35 #include "polyMeshGenAddressing.H"
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 void surfaceMorpherCells::replaceMeshBoundary()
47 wordList patchNames(1);
48 patchNames[0] = "defaultFaces";
50 polyMeshGenModifier(mesh_).replaceBoundary
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 surfaceMorpherCells::surfaceMorpherCells
68 boundaryVertex_(mesh.points().size()),
69 cellFlags_(mesh.cells().size()),
76 surfaceMorpherCells::~surfaceMorpherCells()
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 void surfaceMorpherCells::morphMesh()
83 //- perform surface morphing
94 Info << "Iteration " << ++iter << endl;
97 findBoundaryVertices();
101 if( removeCellsWithAllVerticesAtTheBoundary() )
107 if( morphInternalFaces() )
113 if( morphBoundaryFaces() )
121 mesh_.addressingData().checkMesh(true);
122 fileName name("morphedMesh");
123 std::ostringstream ss;
126 Info << "name " << name << endl;
129 const cellListPMG& cells = mesh_.cells();
130 const faceListPMG& faces = mesh_.faces();
133 const cell& c = cells[cellI];
135 const edgeList edges = c.edges(faces);
136 List<direction> nAppearances(edges.size(), direction(0));
140 const edgeList fEdges = faces[c[fI]].edges();
144 if( fEdges[eI] == edges[eJ] )
152 forAll(nAppearances, eI)
153 if( nAppearances[eI] != 2 )
156 Info << "Edge " << edges[eI] << " appears "
157 << label(nAppearances[eI]) << " times in cell "
163 Info << "Cell " << cellI << " consists of faces " << c << endl;
165 Info << "Face " << c[fI] << " is " << faces[c[fI]] << endl;
168 "void surfaceMorpherCells::morphMesh()"
169 ) << "Cell " << cellI << " is not topologically closed"
170 << abort(FatalError);
177 polyMeshGenModifier(mesh_).removeUnusedVertices();
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 } // End namespace Foam
184 // ************************************************************************* //