All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
targetVolumeToCell.H
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) 2012-2020 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 Class
25  Foam::targetVolumeToCell
26 
27 Description
28  A topoSetSource to select cells based on the wanted volume of selected
29  cells. Adapts a plane until it has enough.
30 
31 SourceFiles
32  targetVolumeToCell.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef targetVolumeToCell_H
37 #define targetVolumeToCell_H
38 
39 #include "topoSetSource.H"
40 #include "PackedBoolList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class targetVolumeToCell Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public topoSetSource
54 {
55 
56  // Private Data
57 
58  //- Add usage string
59  static addToUsageTable usage_;
60 
61  //- Wanted volume
62  const scalar vol_;
63 
64  //- Normal of plane to sweep
65  const vector n_;
66 
67  //- Optional name of cellSet to calculate volume in
68  const word maskSetName_;
69 
70 
71  // Private Member Functions
72 
73  scalar volumeOfSet(const PackedBoolList&) const;
74 
75  label selectCells
76  (
77  const scalar normalComp,
78  const PackedBoolList&,
79  PackedBoolList& selected
80  ) const;
81 
82  void combine(topoSet& set, const bool add) const;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("targetVolumeToCell");
89 
90  // Constructors
91 
92  //- Construct from components
94  (
95  const polyMesh& mesh,
96  const scalar vol,
97  const vector&
98  );
99 
100  //- Construct from dictionary
102  (
103  const polyMesh& mesh,
104  const dictionary& dict
105  );
106 
107  //- Construct from Istream
109  (
110  const polyMesh& mesh,
111  Istream&
112  );
113 
114 
115  //- Destructor
116  virtual ~targetVolumeToCell();
117 
118 
119  // Member Functions
121  virtual sourceType setType() const
122  {
123  return CELLSETSOURCE;
124  }
125 
126  virtual void applyToSet
127  (
128  const topoSetSource::setAction action,
129  topoSet&
130  ) const;
131 
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
dictionary dict
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
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
TypeName("targetVolumeToCell")
Runtime type information.
virtual ~targetVolumeToCell()
Destructor.
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
const polyMesh & mesh() const
A class for handling words, derived from string.
Definition: word.H:59
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)
virtual sourceType setType() const
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
A bit-packed bool list.
targetVolumeToCell(const polyMesh &mesh, const scalar vol, const vector &)
Construct from components.
sourceType
Enumeration defining the types of sources.
Definition: topoSetSource.H:70
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A topoSetSource to select cells based on the wanted volume of selected cells. Adapts a plane until it...
Namespace for OpenFOAM.