cellToCell.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 "cellToCell.H"
27 #include "cellSet.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(cellToCell, 0);
35  addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
43  const polyMesh& mesh,
44  const word& setName
45 )
46 :
47  topoSetSource(mesh),
48  setName_(setName)
49 {}
50 
51 
53 (
54  const polyMesh& mesh,
55  const dictionary& dict
56 )
57 :
58  topoSetSource(mesh),
59  setName_(dict.lookup("set"))
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
64 
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
70 
72 (
73  const topoSetSource::setAction action,
74  topoSet& set
75 ) const
76 {
77  if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW))
78  {
79  Info<< " Adding all elements of cellSet " << setName_ << " ..."
80  << endl;
81 
82  // Load the set
83  cellSet loadedSet(mesh_, setName_);
84 
85  set.addSet(loadedSet);
86  }
87  else if (action == topoSetSource::DELETE)
88  {
89  Info<< " Removing all elements of cellSet " << setName_ << " ..."
90  << endl;
91 
92  // Load the set
93  cellSet loadedSet(mesh_, setName_);
94 
95  set.deleteSet(loadedSet);
96  }
97 }
98 
99 
100 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
cellToCell(const polyMesh &mesh, const word &setName)
Construct from components.
Definition: cellToCell.C:42
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Macros for easy insertion into run-time selection tables.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Definition: cellToCell.C:72
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
virtual ~cellToCell()
Destructor.
Definition: cellToCell.C:65
A class for handling words, derived from string.
Definition: word.H:59
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
A collection of cell labels.
Definition: cellSet.H:48
messageStream Info
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864