All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
badQualityToFace.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "badQualityToFace.H"
27 #include "polyMesh.H"
28 #include "motionSmoother.H"
30 #include "faceSet.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 defineTypeNameAndDebug(badQualityToFace, 0);
38 
39 addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word);
40 
41 addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream);
42 
43 }
44 
45 
46 Foam::topoSetSource::addToUsageTable Foam::badQualityToFace::usage_
47 (
48  badQualityToFace::typeName,
49  "\n Usage: badQualityToFace mesh-quality-dictionary\n\n"
50  " Select all faces that do not satisfy the selection criterion\n\n"
51 );
52 
53 
54 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
55 
56 void Foam::badQualityToFace::combine(topoSet& set, const bool add) const
57 {
58  faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1);
59  motionSmoother::checkMesh(false, mesh_, dict_, faces);
60  faces.sync(mesh_);
61 
62  forAllConstIter(faceSet, faces, iter)
63  {
64  label facei = iter.key();
65  addOrDelete(set, facei, add);
66  }
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
72 // Construct from dictionary
74 (
75  const polyMesh& mesh,
76  const dictionary& dict
77 )
78 :
79  topoSetSource(mesh),
80  dict_(dict)
81 {}
82 
83 
84 // Construct from Istream
86 (
87  const polyMesh& mesh,
88  Istream& is
89 )
90 :
91  topoSetSource(mesh),
92  dict_(is)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97 
99 {}
100 
101 
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 
105 (
106  const topoSetSource::setAction action,
107  topoSet& set
108 ) const
109 {
110  if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
111  {
112  Info<< " Adding bad-quality faces" << endl;
113  combine(set, true);
114  }
115  else if (action == topoSetSource::DELETE)
116  {
117  Info<< " Removing bad-quality faces" << endl;
118  combine(set, false);
119  }
120 }
121 
122 
123 // ************************************************************************* //
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
badQualityToFace(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual ~badQualityToFace()
Destructor.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
Definition: ListListOps.C:34
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:82
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
Class with constructor to add usage string to table.
messageStream Info
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.