checkIrregularSurfaceConnections.C
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 //#define DEBUGCheck
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
38 // Constructors
39 
41 (
43 )
44 :
45  mesh_(mesh),
46  meshSurfacePtr_(NULL)
47 {
48 }
49 
50 // * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * * * //
51 
53 {
55 
57 }
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
62 (
63  labelHashSet& badVertices
64 )
65 {
66  checkAndFixCellGroupsAtBndVertices(badVertices, false);
67 
68  checkEdgeFaceConnections(badVertices, false);
69 
70  checkFaceGroupsAtBndVertices(badVertices, false);
71 }
72 
74 {
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 
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;
103 }
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace Foam
108 
109 // ************************************************************************* //
Foam::checkIrregularSurfaceConnections::~checkIrregularSurfaceConnections
~checkIrregularSurfaceConnections()
Definition: checkIrregularSurfaceConnections.C:52
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
checkIrregularSurfaceConnections.H
Foam::checkIrregularSurfaceConnections::checkAndFixIrregularConnections
bool checkAndFixIrregularConnections()
find invalid connections and fix them on the fly
Definition: checkIrregularSurfaceConnections.C:73
Foam::checkIrregularSurfaceConnections::checkEdgeFaceConnections
bool checkEdgeFaceConnections(labelHashSet &badVertices, const bool removeCells=false)
Definition: checkIrregularSurfaceConnectionsFunctions.C:464
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::checkIrregularSurfaceConnections::mesh_
polyMeshGen & mesh_
Reference to polyMeshGen.
Definition: checkIrregularSurfaceConnections.H:55
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::HashSet< label, Hash< label > >
Foam::checkIrregularSurfaceConnections::clearMeshEngine
void clearMeshEngine()
clear meshSurfaceEngine. Used in case if the mesh is modified
Definition: checkIrregularSurfaceConnections.H:71
Foam::Info
messageStream Info
Foam::polyMeshGenCells::clearAddressingData
void clearAddressingData() const
clear addressing data
Definition: polyMeshGenCells.C:346
Foam::checkIrregularSurfaceConnections::checkAndFixCellGroupsAtBndVertices
bool checkAndFixCellGroupsAtBndVertices(labelHashSet &badVertices, const bool removeConnections=false)
Definition: checkIrregularSurfaceConnectionsFunctions.C:47
Foam::polyMeshGenModifier::removeUnusedVertices
void removeUnusedVertices()
remove unused vertices
Definition: polyMeshGenModifierRemoveUnusedVertices.C:37
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::checkIrregularSurfaceConnections::checkIrregularVertices
void checkIrregularVertices(labelHashSet &badVertices)
find vertices where the surface is not valid
Definition: checkIrregularSurfaceConnections.C:62
Foam::polyMeshGenModifier
Definition: polyMeshGenModifier.H:52
Foam::sumOp
Definition: ops.H:162
Foam::checkIrregularSurfaceConnections::checkFaceGroupsAtBndVertices
bool checkFaceGroupsAtBndVertices(labelHashSet &badVertices, const bool removeCells=false)
Definition: checkIrregularSurfaceConnectionsFunctions.C:603
Foam::checkIrregularSurfaceConnections::checkIrregularSurfaceConnections
checkIrregularSurfaceConnections(const checkIrregularSurfaceConnections &)
Disallow default bitwise copy construct.