Adding cfMesh-v1.0 into the repository
[foam-extend-3.2.git] / src / meshLibrary / utilities / smoothers / topology / checkIrregularSurfaceConnections / checkIrregularSurfaceConnections.C
blob4954e16133f157febee8e73a42153fe36e17cefe
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Description
26 \*---------------------------------------------------------------------------*/
28 #include "checkIrregularSurfaceConnections.H"
30 //#define DEBUGCheck
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * * * * * //
38 // Constructors
40 checkIrregularSurfaceConnections::checkIrregularSurfaceConnections
42     polyMeshGen& mesh
45     mesh_(mesh),
46     meshSurfacePtr_(NULL)
50 // * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * * * * * //
52 checkIrregularSurfaceConnections::~checkIrregularSurfaceConnections()
54     clearMeshEngine();
55     
56     mesh_.clearAddressingData();
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 void checkIrregularSurfaceConnections::checkIrregularVertices
63     labelHashSet& badVertices
66     checkAndFixCellGroupsAtBndVertices(badVertices, false);
67     
68     checkEdgeFaceConnections(badVertices, false);
69         
70     checkFaceGroupsAtBndVertices(badVertices, false);
73 bool checkIrregularSurfaceConnections::checkAndFixIrregularConnections()
75     Info << "Checking for irregular surface connections" << endl;
76     
77     bool finished;
78     
79     labelHashSet badVertices;
80     
81     do
82     {
83         finished = true;
84         
85         while( checkAndFixCellGroupsAtBndVertices(badVertices, true) )
86             finished = false;
87         
88         while( checkEdgeFaceConnections(badVertices, true) )
89             finished = false;
90         
91         if( checkFaceGroupsAtBndVertices(badVertices, true) )
92             finished = false;
93     } while( !finished );
94     
95     polyMeshGenModifier(mesh_).removeUnusedVertices();
96     
97     Info << "Finished checking for irregular surface connections" << endl;
98     
99     if( returnReduce(badVertices.size(), sumOp<label>()) != 0 )
100         return true;
101     
102     return false;
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 } // End namespace Foam
109 // ************************************************************************* //