boundaryToFace.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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"
28 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 defineTypeNameAndDebug(boundaryToFace, 0);
37 
38 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
39 
40 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
41 
42 }
43 
44 
45 Foam::topoSetSource::addToUsageTable Foam::boundaryToFace::usage_
46 (
47  boundaryToFace::typeName,
48  "\n Usage: boundaryToFace\n\n"
49  " Select all boundary faces\n\n"
50 );
51 
52 
53 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
54 
55 void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
56 {
57  for
58  (
59  label facei = mesh().nInternalFaces();
60  facei < mesh().nFaces();
61  facei++
62  )
63  {
64  addOrDelete(set, facei, add);
65  }
66 }
67 
68 
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
70 
71 // Construct from components
73 :
74  topoSetSource(mesh)
75 {}
76 
77 
78 // Construct from dictionary
80 :
81  topoSetSource(mesh)
82 {}
83 
84 
85 // Construct from Istream
87 (
88  const polyMesh& mesh,
89  Istream& is
90 )
91 :
92  topoSetSource(mesh)
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 all boundary faces ..." << endl;
113 
114  combine(set, true);
115  }
116  else if (action == topoSetSource::DELETE)
117  {
118  Info<< " Removing all boundary faces ..." << endl;
119 
120  combine(set, false);
121  }
122 }
123 
124 
125 // ************************************************************************* //
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:137
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:253
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.