boundaryToFace.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) 2011-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 "boundaryToFace.H"
27 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(boundaryToFace, 0);
35  addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
36  addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
37 }
38 
39 
40 Foam::topoSetSource::addToUsageTable Foam::boundaryToFace::usage_
41 (
42  boundaryToFace::typeName,
43  "\n Usage: boundaryToFace\n\n"
44  " Select all boundary faces\n\n"
45 );
46 
47 
48 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 
50 void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
51 {
52  for
53  (
54  label facei = mesh().nInternalFaces();
55  facei < mesh().nFaces();
56  facei++
57  )
58  {
59  addOrDelete(set, facei, add);
60  }
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 :
68  topoSetSource(mesh)
69 {}
70 
71 
73 :
74  topoSetSource(mesh)
75 {}
76 
77 
79 (
80  const polyMesh& mesh,
81  Istream& is
82 )
83 :
84  topoSetSource(mesh)
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 (
98  const topoSetSource::setAction action,
99  topoSet& set
100 ) const
101 {
102  if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
103  {
104  Info<< " Adding all boundary faces ..." << endl;
105 
106  combine(set, true);
107  }
108  else if (action == topoSetSource::DELETE)
109  {
110  Info<< " Removing all boundary faces ..." << endl;
111 
112  combine(set, false);
113  }
114 }
115 
116 
117 // ************************************************************************* //
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
topoSetSource(const polyMesh &mesh)
Construct from components.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
label nFaces() const
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:256
boundaryToFace(const polyMesh &)
Construct from components.
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
dynamicFvMesh & mesh
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:82
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.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
messageStream Info
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.
virtual ~boundaryToFace()
Destructor.