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 -------------------------------------------------------------------------------
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  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 
45 Filtering 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 
54 SourceFiles
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 
67 namespace Foam
68 {
69 
70 // Forward Declarations
71 class dictionary;
72 class Ostream;
73 
74 /*---------------------------------------------------------------------------*\
75  Class isoSurfaceSelector Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class isoSurfaceParams
79 {
80 public:
81 
82  // Data Types
83 
84  //- The algorithm types
85  enum algorithmType : uint8_t
86  {
87  ALGO_DEFAULT = 0,
88  ALGO_TOPO,
89  ALGO_CELL,
91  };
92 
93  //- The filtering (regularization) to apply
94  enum class filterType : uint8_t
95  {
96  NONE = 0,
97  CELL,
98  DIAGCELL,
99  NONMANIFOLD,
100 
102  PARTIAL = CELL,
104  CLEAN = NONMANIFOLD
105  };
106 
107 
108 private:
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_;
120 
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 
128 public:
129 
130  // Public Data
131 
132  //- Names for the iso-surface algorithms
133  static const Enum<algorithmType> algorithmNames;
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  (
161  const algorithmType algo = algorithmType::ALGO_DEFAULT,
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  );
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
196  filterType filter() const noexcept
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
238  boundBox& getClipBounds() noexcept
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
261 
262 // ************************************************************************* //
Remove pyramid edge points, face-diagonals.
dictionary dict
Remove pyramid edge points.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
Preferences for controlling iso-surface algorithms.
static filterType getFilterType(const dictionary &dict, const filterType deflt)
Get &#39;regularise&#39; as bool or enumeration.
void print(Ostream &os) const
Print information about the settings.
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
algorithmType
The algorithm types.
void setClipBounds(const boundBox &bb)
Set optional clipping bounding box.
isoSurfaceParams(const algorithmType algo=algorithmType::ALGO_DEFAULT, const filterType filter=filterType::DIAGCELL) noexcept
Default construct, or with specified algorithm.
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
Use current &#39;standard&#39; algorithm.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
const direction noexcept
Definition: Scalar.H:258
OBJstream os(runTime.globalPath()/outputName)
algorithmType algorithm() const noexcept
Get current algorithm.
filterType
The filtering (regularization) to apply.
static const Enum< algorithmType > algorithmNames
Names for the iso-surface algorithms.
static const Enum< filterType > filterNames
Names for the filtering types.
static algorithmType getAlgorithmType(const dictionary &dict, const algorithmType deflt)
Get &#39;isoMethod&#39; or &#39;isoAlgorithm&#39; as enumeration.
bool snap() const noexcept
Get point snapping flag.
filterType filter() const noexcept
Get current filter type.
scalar mergeTol() const noexcept
Get current merge tolerance.
Namespace for OpenFOAM.