Loading...
Searching...
No Matches
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 Foam_isoSurfaceParams_H
60#define Foam_isoSurfaceParams_H
61
62#include "boundBox.H"
63#include "Enum.H"
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66
67namespace Foam
68{
69
70// Forward Declarations
71class dictionary;
72
73/*---------------------------------------------------------------------------*\
74 Class isoSurfaceSelector Declaration
75\*---------------------------------------------------------------------------*/
76
78{
79public:
80
81 // Data Types
82
83 //- The algorithm types
84 enum algorithmType : uint8_t
85 {
86 ALGO_DEFAULT = 0,
90 };
91
92 //- The filtering (regularization) to apply
93 enum class filterType : uint8_t
94 {
95 NONE = 0,
96 CELL,
97 DIAGCELL,
100
101 PARTIAL = CELL,
104 };
105
106
107private:
108
109 // Private Data
110
111 //- Algorithm type
112 algorithmType algo_;
114 //- Filtering for iso-surface faces/points
115 filterType filter_;
117 //- Point snapping enabled
118 bool snap_;
119
120 //- Merge tolerance for cell/point (default: 1e-6)
121 scalar mergeTol_;
123 //- Optional bounding box for clipping (default: inverted)
124 boundBox clipBounds_;
127public:
128
129 // Public Data
131 //- Names for the iso-surface algorithms
133
134 //- Names for the filtering types
135 static const Enum<filterType> filterNames;
136
137
138 // Static Member Functions
139
140 //- Get 'isoMethod' or 'isoAlgorithm' as enumeration
142 (
143 const dictionary& dict,
144 const algorithmType deflt
145 );
146
147 //- Get 'regularise' as bool or enumeration
149 (
150 const dictionary& dict,
151 const filterType deflt
152 );
153
154
155 // Constructors
156
157 //- Default construct, or with specified algorithm
158 explicit isoSurfaceParams
159 (
162 ) noexcept;
163
164 //- Default construct, setting parameters from dictionary
165 explicit isoSurfaceParams
166 (
167 const dictionary& dict,
168 const isoSurfaceParams& params = isoSurfaceParams()
169 );
170
171 //- Default construct, setting parameters from dictionary
172 explicit isoSurfaceParams
174 const dictionary& dict,
175 const algorithmType algo,
177 );
179
180 // Member Functions
181
182 //- Get current algorithm
184 {
185 return algo_;
186 }
187
188 //- Set algorithm
189 void algorithm(algorithmType algo) noexcept
190 {
191 algo_ = algo;
192 }
193
194 //- Get current filter type
196 {
197 return filter_;
198 }
199
200 //- Set filter type
201 void filter(filterType fltr) noexcept
202 {
203 filter_ = fltr;
204 }
205
206 //- Get point snapping flag
207 bool snap() const noexcept
208 {
209 return snap_;
210 }
211
212 //- Set point snapping flag
213 void snap(bool on) noexcept
214 {
215 snap_ = on;
216 }
217
218 //- Get current merge tolerance
219 scalar mergeTol() const noexcept
220 {
221 return mergeTol_;
222 }
223
224 //- Set merge tolerance (cell/point algo)
225 void mergeTol(const scalar relTol) noexcept
226 {
227 mergeTol_ = relTol;
228 }
229
230 //- Get optional clipping bounding box
231 const boundBox& getClipBounds() const noexcept
232 {
233 return clipBounds_;
234 }
235
236 //- Access optional clipping bounding box
237 boundBox& getClipBounds() noexcept
239 return clipBounds_;
240 }
241
242 //- Set optional clipping bounding box
243 void setClipBounds(const boundBox& bb);
244
245
246 // Information
247
248 //- Print information about the settings
249 void print(Ostream& os) const;
250};
251
252
253// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255} // End namespace Foam
256
257// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258
259#endif
260
261// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A bounding box defined in terms of min/max extrema points.
Definition boundBox.H:71
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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.
isoSurfaceParams(const algorithmType algo=algorithmType::ALGO_DEFAULT, const filterType filter=filterType::DIAGCELL) noexcept
Default construct, or with specified algorithm.
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 scalarImpl.H:265
dictionary dict