rotatedBoxToCell.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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::rotatedBoxToCell
29
30Description
31 A \c topoSetCellSource to select cells based on cell centres
32 inside a given parallopiped (i.e. rotated/skewed box).
33
34 Operands:
35 \table
36 Operand | Type | Location
37 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38 \endtable
39
40Usage
41 Minimal example by using \c system/topoSetDict.actions:
42 \verbatim
43 {
44 // Mandatory (inherited) entries
45 name <name>;
46 type cellSet;
47 action <action>;
48
49 // Mandatory entries
50 source rotatedBoxToCell;
51 origin (<o1> <o2> <o3>);
52 i (<i1> <i2> <i3>);
53 j (<j1> <j2> <j3>);
54 k (<k1> <k2> <k3>);
55 }
56 \endverbatim
57
58 where the entries mean:
59 \table
60 Property | Description | Type | Req'd | Dflt
61 name | Name of cellSet | word | yes | -
62 type | Type name: cellSet | word | yes | -
63 action | Action applied on cells - see below | word | yes | -
64 source | Source name: rotateTedBoxToCell | word | yes | -
65 origin | Origin of the box | vector | yes | -
66 i | x1-axis | vector | yes | -
67 j | x2-axis | vector | yes | -
68 k | x3-axis | vector | yes | -
69 \endtable
70
71 Options for the \c action entry:
72 \verbatim
73 new | Create a new cellSet from selected cells
74 add | Add selected cells into this cellSet
75 subtract | Remove selected cells from this cellSet
76 \endverbatim
77
78 Box defined as origin and i,j,k vectors.
79 For example, box rotated 45 degrees around z-axis with
80 sizes sqrt(0.2^2+0.2^2) (and extra large, 200 in z direction):
81 \verbatim
82 origin ( 0.4 0.4 -100);
83 i ( 0.2 0.2 0);
84 j (-0.2 0.2 0);
85 k ( 0.0 0.0 200);
86 \endverbatim
87
88See also
89 - Foam::topoSetSource
90 - Foam::topoSetCellSource
91
92SourceFiles
93 rotatedBoxToCell.C
94
95\*---------------------------------------------------------------------------*/
96
97#ifndef rotatedBoxToCell_H
98#define rotatedBoxToCell_H
99
100#include "topoSetCellSource.H"
101#include "treeBoundBox.H"
102
103// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104
105namespace Foam
106{
107
108/*---------------------------------------------------------------------------*\
109 Class rotatedBoxToCell Declaration
110\*---------------------------------------------------------------------------*/
111
112class rotatedBoxToCell
113:
114 public topoSetCellSource
115{
116 // Private Data
117
118 //- Add usage string
119 static addToUsageTable usage_;
120
121 //- Definition of the parallelopiped (i.e. rotated/skewed box)
122 const point origin_;
123 const vector i_;
124 const vector j_;
125 const vector k_;
126
127
128 // Private Member Functions
129
130 void combine(topoSet& set, const bool add) const;
131
132
133public:
134
135 //- Runtime type information
136 TypeName("rotatedBoxToCell");
137
138
139 // Constructors
140
141 //- Construct from components
143 (
144 const polyMesh& mesh,
145 const vector& origin,
146 const vector& i,
147 const vector& j,
148 const vector& k
149 );
150
151 //- Construct from dictionary
152 rotatedBoxToCell(const polyMesh& mesh, const dictionary& dict);
153
154 //- Construct from Istream
155 rotatedBoxToCell(const polyMesh& mesh, Istream& is);
156
157
158 //- Destructor
159 virtual ~rotatedBoxToCell() = default;
160
161
162 // Member Functions
163
164 virtual void applyToSet
165 (
166 const topoSetSource::setAction action,
167 topoSet& set
168 ) const;
169};
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174} // End namespace Foam
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#endif
179
180// ************************************************************************* //
label k
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A topoSetCellSource to select cells based on cell centres inside a given parallopiped (i....
rotatedBoxToCell(const polyMesh &mesh, const vector &origin, const vector &i, const vector &j, const vector &k)
Construct from components.
virtual ~rotatedBoxToCell()=default
Destructor.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
TypeName("rotatedBoxToCell")
Runtime type information.
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73