isoSurfaceParams.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) 2020-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::isoSurfaceParams
28
29Description
30 Preferences for controlling iso-surface algorithms.
31
32 Some common dictionary properties:
33 \table
34 Property | Description | Required | Default
35 isoMethod | Algorithm (cell/topo/point/default) | no | default
36 regularise | Face simplification (enum or bool) | no | true
37 mergeTol | Point merge tolerance (cell/point) | no | 1e-6
38 snap | Point snapping (topo) | no | true
39 bounds | Optional clip bounds | no | inverted
40 \endtable
41
42 The default algorithm denotes the use of the current \em standard
43 algorithm.
44
45Filtering types (for topological iso-surface)
46 - \c none : leave tet cuts untouched
47 - \c partial , \c cell : Combine intra-cell faces
48 - \c full , \c diagcell : Perform \c partial and remove face-diagonal
49 points
50 - \c clean : Perform \c full and eliminate open edges as well.
51 (<b>May cause excessive erosion!</b>)
52 .
53
54SourceFiles
55 isoSurfaceParams.C
56
57\*---------------------------------------------------------------------------*/
58
59#ifndef isoSurfaceParams_H
60#define isoSurfaceParams_H
61
62#include "boundBox.H"
63#include "Enum.H"
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66
67namespace Foam
68{
69
70// Forward Declarations
71class dictionary;
72class Ostream;
73
74/*---------------------------------------------------------------------------*\
75 Class isoSurfaceSelector Declaration
76\*---------------------------------------------------------------------------*/
77
78class isoSurfaceParams
79{
80public:
81
82 // Data Types
83
84 //- The algorithm types
85 enum algorithmType : uint8_t
86 {
87 ALGO_DEFAULT = 0,
91 };
92
93 //- The filtering (regularization) to apply
94 enum class filterType : uint8_t
95 {
96 NONE = 0,
97 CELL,
98 DIAGCELL,
101
102 PARTIAL = CELL,
103 FULL = DIAGCELL,
105 };
106
108private:
109
110 // Private Data
111
112 //- Algorithm type
113 algorithmType algo_;
115 //- Filtering for iso-surface faces/points
116 filterType filter_;
118 //- Point snapping enabled
119 bool snap_;
121 //- Merge tolerance for cell/point (default: 1e-6)
122 scalar mergeTol_;
124 //- Optional bounding box for clipping (default: inverted)
125 boundBox clipBounds_;
126
127
128public:
129
130 // Public Data
131
132 //- Names for the iso-surface algorithms
134
135 //- Names for the filtering types
136 static const Enum<filterType> filterNames;
137
138
139 // Static Member Functions
140
141 //- Get 'isoMethod' or 'isoAlgorithm' as enumeration
143 (
144 const dictionary& dict,
145 const algorithmType deflt
146 );
147
148 //- Get 'regularise' as bool or enumeration
150 (
151 const dictionary& dict,
152 const filterType deflt
153 );
154
155
156 // Constructors
157
158 //- Default construct, or with specified algorithm
159 explicit isoSurfaceParams
160 (
163 ) noexcept;
164
165 //- Default construct, setting parameters from dictionary
166 explicit isoSurfaceParams
167 (
168 const dictionary& dict,
169 const isoSurfaceParams& params = isoSurfaceParams()
170 );
171
172 //- Default construct, setting parameters from dictionary
173 explicit isoSurfaceParams
174 (
175 const dictionary& dict,
176 const algorithmType algo,
178 );
179
180
181 // Member Functions
182
183 //- Get current algorithm
185 {
186 return algo_;
187 }
188
189 //- Set algorithm
190 void algorithm(algorithmType algo) noexcept
191 {
192 algo_ = algo;
193 }
194
195 //- Get current filter type
197 {
198 return filter_;
199 }
200
201 //- Set filter type
202 void filter(filterType fltr) noexcept
203 {
204 filter_ = fltr;
205 }
206
207 //- Get point snapping flag
208 bool snap() const noexcept
209 {
210 return snap_;
211 }
212
213 //- Set point snapping flag
214 void snap(bool on) noexcept
215 {
216 snap_ = on;
217 }
218
219 //- Get current merge tolerance
220 scalar mergeTol() const noexcept
221 {
222 return mergeTol_;
223 }
224
225 //- Set merge tolerance (cell/point algo)
226 void mergeTol(const scalar relTol) noexcept
227 {
228 mergeTol_ = relTol;
229 }
230
231 //- Get optional clipping bounding box
232 const boundBox& getClipBounds() const noexcept
233 {
234 return clipBounds_;
235 }
236
237 //- Access optional clipping bounding box
239 {
240 return clipBounds_;
241 }
242
243 //- Set optional clipping bounding box
244 void setClipBounds(const boundBox& bb);
245
246
247 // Information
248
249 //- Print information about the settings
250 void print(Ostream& os) const;
251};
252
253
254// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256} // End namespace Foam
257
258// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259
260#endif
262// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Preferences for controlling iso-surface algorithms.
filterType filter() const noexcept
Get current filter type.
void filter(filterType fltr) noexcept
Set filter type.
static const Enum< filterType > filterNames
Names for the filtering types.
algorithmType
The algorithm types.
@ ALGO_DEFAULT
Use current 'standard' algorithm.
boundBox & getClipBounds() noexcept
Access optional clipping bounding box.
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
void print(Ostream &os) const
Print information about the settings.
algorithmType algorithm() const noexcept
Get current algorithm.
void algorithm(algorithmType algo) noexcept
Set algorithm.
void setClipBounds(const boundBox &bb)
Set optional clipping bounding box.
static algorithmType getAlgorithmType(const dictionary &dict, const algorithmType deflt)
Get 'isoMethod' or 'isoAlgorithm' as enumeration.
void snap(bool on) noexcept
Set point snapping flag.
static filterType getFilterType(const dictionary &dict, const filterType deflt)
Get 'regularise' as bool or enumeration.
void mergeTol(const scalar relTol) noexcept
Set merge tolerance (cell/point algo)
static const Enum< algorithmType > algorithmNames
Names for the iso-surface algorithms.
filterType
The filtering (regularization) to apply.
@ DIAGCELL
Remove pyramid edge points, face-diagonals.
@ CELL
Remove pyramid edge points.
bool snap() const noexcept
Get point snapping flag.
scalar mergeTol() const noexcept
Get current merge tolerance.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
dictionary dict