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 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::isoSurfaceParams
28 
29 Description
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  bounds | Optional clip bounds | no | inverted
39  \endtable
40 
41  The default algorithm denotes the use of the current \em standard
42  algorithm.
43 
44 SourceFiles
45  isoSurfaceParams.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef isoSurfaceParams_H
50 #define isoSurfaceParams_H
51 
52 #include "boundBox.H"
53 #include "Enum.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward Declarations
61 class dictionary;
62 
63 /*---------------------------------------------------------------------------*\
64  Class isoSurfaceSelector Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class isoSurfaceParams
68 {
69 public:
70 
71  // Data Types
72 
73  //- The algorithm types
74  enum algorithmType : uint8_t
75  {
76  ALGO_DEFAULT = 0,
77  ALGO_TOPO,
78  ALGO_CELL,
80  };
81 
82  //- The filtering (regularization) to apply
83  enum class filterType : uint8_t
84  {
85  NONE = 0,
86  CELL,
87  DIAGCELL,
88  PARTIAL = CELL,
89  FULL = DIAGCELL,
90  };
91 
92 
93 private:
94 
95  // Private Data
96 
97  //- Algorithm type
99 
100  //- Filtering for iso-surface faces/points
101  filterType filter_;
102 
103  //- Merge tolerance for cell/point (default: 1e-6)
104  scalar mergeTol_;
105 
106  //- Optional bounding box for clipping (default: inverted)
107  boundBox clipBounds_;
108 
109 
110 public:
111 
112  // Public Data
113 
114  //- Names for the iso-surface algorithms
115  static const Enum<algorithmType> algorithmNames;
116 
117  //- Names for the filtering types
118  static const Enum<filterType> filterNames;
119 
120 
121  // Static Member Functions
122 
123  //- Get 'isoMethod' or 'isoAlgorithm' as enumeration
125  (
126  const dictionary& dict,
127  const algorithmType deflt
128  );
129 
130  //- Get 'regularise' as bool or enumeration
132  (
133  const dictionary& dict,
134  const filterType deflt
135  );
136 
137 
138  // Constructors
139 
140  //- Default construct, or with specified algorithm
141  explicit isoSurfaceParams
142  (
143  const algorithmType algo = algorithmType::ALGO_DEFAULT,
145  ) noexcept;
146 
147  //- Default construct, setting parameters from dictionary
148  explicit isoSurfaceParams
149  (
150  const dictionary& dict,
151  const isoSurfaceParams& params = isoSurfaceParams()
152  );
153 
154  //- Default construct, setting parameters from dictionary
155  explicit isoSurfaceParams
156  (
157  const dictionary& dict,
158  const algorithmType algo,
160  );
161 
162 
163  // Member Functions
164 
165  //- Get current algorithm
166  algorithmType algorithm() const noexcept
167  {
168  return algo_;
169  }
170 
171  //- Set algorithm
172  void algorithm(algorithmType algo) noexcept
173  {
174  algo_ = algo;
175  }
176 
177  //- Get current filter type
178  filterType filter() const noexcept
179  {
180  return filter_;
181  }
182 
183  //- Set filter type
184  void filter(filterType fltr) noexcept
185  {
186  filter_ = fltr;
187  }
188 
189  //- Get current merge tolerance
190  scalar mergeTol() const noexcept
191  {
192  return mergeTol_;
193  }
194 
195  //- Set merge tolerance (cell/point algo)
196  void mergeTol(const scalar relTol) noexcept
197  {
198  mergeTol_ = relTol;
199  }
200 
201  //- Get optional clipping bounding box
202  const boundBox& getClipBounds() const noexcept
203  {
204  return clipBounds_;
205  }
206 
207  //- Access optional clipping bounding box
209  {
210  return clipBounds_;
211  }
212 
213  //- Set optional clipping bounding box
214  void setClipBounds(const boundBox& bb);
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
Foam::isoSurfaceParams::mergeTol
void mergeTol(const scalar relTol) noexcept
Set merge tolerance (cell/point algo)
Definition: isoSurfaceParams.H:220
Foam::isoSurfaceParams::filterType::DIAGCELL
Remove pyramid edge points, face-diagonals.
Foam::Enum< algorithmType >
Foam::isoSurfaceParams::getFilterType
static filterType getFilterType(const dictionary &dict, const filterType deflt)
Get 'regularise' as bool or enumeration.
Definition: isoSurfaceParams.C:98
Foam::isoSurfaceParams::algorithm
algorithmType algorithm() const noexcept
Get current algorithm.
Definition: isoSurfaceParams.H:190
Foam::isoSurfaceParams::algorithmType
algorithmType
The algorithm types.
Definition: isoSurfaceParams.H:98
Foam::isoSurfaceParams::getClipBounds
boundBox & getClipBounds() noexcept
Access optional clipping bounding box.
Definition: isoSurfaceParams.H:232
Foam::isoSurfaceParams::filterType::FULL
Same as DIAGCELL.
Foam::isoSurfaceParams::filter
void filter(filterType fltr) noexcept
Set filter type.
Definition: isoSurfaceParams.H:208
Foam::isoSurfaceParams::algorithmNames
static const Enum< algorithmType > algorithmNames
Names for the iso-surface algorithms.
Definition: isoSurfaceParams.H:139
Foam::isoSurfaceParams::filterType::NONE
No filtering.
Foam::isoSurfaceParams::filter
filterType filter() const noexcept
Get current filter type.
Definition: isoSurfaceParams.H:202
Foam::isoSurfaceParams::filterType::PARTIAL
Same as CELL.
Foam::isoSurfaceParams::isoSurfaceParams
isoSurfaceParams(const algorithmType algo=algorithmType::ALGO_DEFAULT, const filterType filter=filterType::DIAGCELL) noexcept
Default construct, or with specified algorithm.
Definition: isoSurfaceParams.C:133
Foam::isoSurfaceParams::getClipBounds
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
Definition: isoSurfaceParams.H:226
Foam::isoSurfaceParams::ALGO_DEFAULT
Use current 'standard' algorithm.
Definition: isoSurfaceParams.H:100
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::isoSurfaceParams::algorithm
void algorithm(algorithmType algo) noexcept
Set algorithm.
Definition: isoSurfaceParams.H:196
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::isoSurfaceParams
Preferences for controlling iso-surface algorithms.
Definition: isoSurfaceParams.H:91
Foam::isoSurfaceParams::ALGO_POINT
Definition: isoSurfaceParams.H:103
Foam::isoSurfaceParams::setClipBounds
void setClipBounds(const boundBox &bb)
Set optional clipping bounding box.
Definition: isoSurfaceParams.C:173
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::isoSurfaceParams::getAlgorithmType
static algorithmType getAlgorithmType(const dictionary &dict, const algorithmType deflt)
Get 'isoMethod' or 'isoAlgorithm' as enumeration.
Definition: isoSurfaceParams.C:66
Foam::isoSurfaceParams::ALGO_TOPO
Definition: isoSurfaceParams.H:101
boundBox.H
Foam::isoSurfaceParams::ALGO_CELL
Definition: isoSurfaceParams.H:102
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::isoSurfaceParams::filterNames
static const Enum< filterType > filterNames
Names for the filtering types.
Definition: isoSurfaceParams.H:142
Foam::isoSurfaceParams::mergeTol
scalar mergeTol() const noexcept
Get current merge tolerance.
Definition: isoSurfaceParams.H:214
Foam::isoSurfaceParams::filterType::CELL
Remove pyramid edge points.
Foam::isoSurfaceParams::filterType
filterType
The filtering (regularization) to apply.
Definition: isoSurfaceParams.H:107
Enum.H