labelToFace.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-2021 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 "labelToFace.H"
27 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(labelToFace, 0);
35  addToRunTimeSelectionTable(topoSetSource, labelToFace, word);
36 }
37 
38 
39 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40 
41 void Foam::labelToFace::combine(topoSet& set, const bool add) const
42 {
43  forAll(labels_, labelI)
44  {
45  addOrDelete(set, labels_[labelI], add);
46  }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const polyMesh& mesh,
55  const labelList& labels
56 )
57 :
58  topoSetSource(mesh),
59  labels_(labels)
60 {}
61 
62 
64 (
65  const polyMesh& mesh,
66  const dictionary& dict
67 )
68 :
69  topoSetSource(mesh),
70  labels_(dict.lookup("value"))
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
75 
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 (
84  const topoSetSource::setAction action,
85  topoSet& set
86 ) const
87 {
88  if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
89  {
90  Info<< " Adding faces mentioned in dictionary" << " ..." << endl;
91 
92  combine(set, true);
93  }
94  else if (action == topoSetSource::DELETE)
95  {
96  Info<< " Removing faces mentioned dictionary" << " ..." << endl;
97 
98  combine(set, false);
99  }
100 }
101 
102 
103 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
static const labelSphericalTensor labelI(1)
Identity labelTensor.
labelToFace(const polyMesh &mesh, const labelList &labels)
Construct from components.
Definition: labelToFace.C:53
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:82
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
virtual ~labelToFace()
Destructor.
Definition: labelToFace.C:76
messageStream Info
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Definition: labelToFace.C:83
Namespace for OpenFOAM.
treeBoundBox combine(const treeBoundBox &a, const treeBoundBox &b)
Definition: patchToPatch.C:77
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864