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 {
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 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A collection of cell labels.
Definition: cellSet.H:51
A topoSetSource to select the cells from another cellSet.
Definition: cellToCell.H:51
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Definition: cellToCell.C:72
virtual ~cellToCell()
Destructor.
Definition: cellToCell.C:65
cellToCell(const polyMesh &mesh, const word &setName)
Construct from components.
Definition: cellToCell.C:42
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Base class of a source for a topoSet.
Definition: topoSetSource.H:64
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:83
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:65
virtual void deleteSet(const topoSet &set)
Delete elements present in set.
virtual void addSet(const topoSet &set)
Add elements present in set.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
messageStream Info
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dictionary dict