shapeToCell.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2018-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::shapeToCell
29 
30 Description
31  A \c topoSetCellSource to select cells
32  based on the type of their cell shapes.
33 
34  Handles all types of cell shapes known from static collection
35  in the \c cellModel (as shown below) and \c splitHex with
36  10 degrees feature angle.
37 
38  Operands:
39  \table
40  Operand | Type | Location
41  output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
42  \endtable
43 
44 Usage
45  Minimal example by using \c system/topoSetDict.actions:
46  \verbatim
47  {
48  // Mandatory (inherited) entries
49  name <name>;
50  type cellSet;
51  action <action>;
52 
53  // Mandatory entries
54  source shapeToCell;
55  shape <shapeTypeName>;
56  }
57  \endverbatim
58 
59  where the entries mean:
60  \table
61  Property | Description | Type | Req'd | Dflt
62  name | Name of cellSet | word | yes | -
63  type | Type name: cellSet | word | yes | -
64  action | Action applied on cells - see below | word | yes | -
65  source | Source name: shapeToCell | word | yes | -
66  shape | Type of cell shape - see below | word | yes | -
67  \endtable
68 
69  Options for the \c action entry:
70  \verbatim
71  new | Create a new cellSet from selected cells
72  add | Add selected cells into this cellSet
73  subtract | Remove selected cells from this cellSet
74  \endverbatim
75 
76  Options for the \c shape entry:
77  \verbatim
78  splitHex | Split-hexahedra cells
79  hex | Hexahedra cells
80  wedge | Wedge cells
81  tetWedge | Tetrahedra-wedge cells
82  prism | Prism cells
83  pyr | Pyramid cells
84  tet | Tetrahedra cells
85  \endverbatim
86 
87 Note
88  \c splitHex hardcoded with internal angle < 10 degrees.
89 
90 See also
91  - Foam::topoSetSource
92  - Foam::topoSetCellSource
93 
94 SourceFiles
95  shapeToCell.C
96 
97 \*---------------------------------------------------------------------------*/
98 
99 #ifndef shapeToCell_H
100 #define shapeToCell_H
101 
102 #include "topoSetCellSource.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 
109 /*---------------------------------------------------------------------------*\
110  Class shapeToCell Declaration
111 \*---------------------------------------------------------------------------*/
112 
113 class shapeToCell
114 :
115  public topoSetCellSource
116 {
117  // Private Data
118 
119  //- Add usage string
120  static addToUsageTable usage_;
121 
122  //- Name of cell shape/type
123  word shape_;
124 
125 
126  // Private Member Functions
127 
128  void combine(topoSet& set, const bool add) const;
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("shapeToCell");
135 
136 
137  // Static Data
138 
139  //- Cos of feature angle for polyHedral to be splitHex
140  static scalar featureCos;
141 
142 
143  // Constructors
144 
145  //- Construct from components
146  shapeToCell(const polyMesh& mesh, const word& shapeName);
147 
148  //- Construct from dictionary
149  shapeToCell(const polyMesh& mesh, const dictionary& dict);
150 
151  //- Construct from Istream
152  shapeToCell(const polyMesh& mesh, Istream& is);
153 
154 
155  //- Destructor
156  virtual ~shapeToCell() = default;
157 
158 
159  // Member Functions
160 
161  virtual void applyToSet
162  (
163  const topoSetSource::setAction action,
164  topoSet& set
165  ) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::combine
Definition: FaceCellWave.C:57
Foam::shapeToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: shapeToCell.C:143
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::shapeToCell
A topoSetCellSource to select cells based on the type of their cell shapes.
Definition: shapeToCell.H:156
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::shapeToCell::TypeName
TypeName("shapeToCell")
Runtime type information.
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
topoSetCellSource.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::topoSetCellSource
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Definition: topoSetCellSource.H:54
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::shapeToCell::~shapeToCell
virtual ~shapeToCell()=default
Destructor.
Foam::shapeToCell::featureCos
static scalar featureCos
Cos of feature angle for polyHedral to be splitHex.
Definition: shapeToCell.H:183
Foam::shapeToCell::shapeToCell
shapeToCell(const polyMesh &mesh, const word &shapeName)
Construct from components.
Definition: shapeToCell.C:97