Loading...
Searching...
No Matches
levelSetCommon.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25# ifndef __BITPIT_LEVELSET_COMMON_HPP__
26# define __BITPIT_LEVELSET_COMMON_HPP__
27
28// Standard Template Library
29# include <array>
30# include <limits>
31# include <unordered_map>
32# include <vector>
33
34namespace bitpit{
35
40const double LEVELSET_NARROW_BAND_UNLIMITED = std::numeric_limits<double>::max();
41
46namespace levelSetDefaults{
47 const double VALUE = 1.e18 ;
48 const std::array<double,3> GRADIENT = {{0.,0.,0.}};
49 const std::array<double,3> POINT = {{0.,0.,0.}};
50 const short SIGN = 1;
51 const double SIZE = 1.e18 ;
52 const int OBJECT = -1 ;
53 const int PART = -1 ;
54 const long SUPPORT = -1 ;
55 const std::array<double,3> NORMAL = {{0.,0.,0.}};
56 const double NARROW_BAND_SIZE = -1 ;
57};
58
60 double value ;
61 std::array<double,3> gradient ;
63 LevelSetInfo() ;
64 LevelSetInfo( double , const std::array<double,3> &) ;
65};
66
71enum class LevelSetZone {
73 BULK,
74};
75
91
97 UNION =0,
98 INTERSECTION =1,
99 SUBTRACTION =2
100};
101
108 FALSE=0,
109 TRUE=1,
110 CLOSE=2
111};
112
124
129enum class LevelSetFillIn{
130 SPARSE,
131 DENSE,
132};
133
134typedef LevelSetFillIn LevelSetCacheType;
135
141 BEGIN = 0,
142 NONE = 0,
143 ON_DEMAND,
145 FULL,
146 END,
147 COUNT = END - BEGIN,
148};
149
155 BEGIN = 0,
156 NONE = 0,
158 EXACT,
159 END,
160 COUNT = END - BEGIN,
161};
162
167enum class LevelSetField{
168 BEGIN = 0,
169 VALUE = BEGIN,
170 SIGN,
171 GRADIENT,
172 SUPPORT,
173 PART,
174 NORMAL,
175 END,
176 COUNT = END - BEGIN,
177 UNDEFINED
178};
179
188
193{
194 std::size_t operator()(const LevelSetField &field) const
195 {
196 return static_cast<int>(field);
197 }
198};
199
203typedef std::vector<LevelSetField> LevelSetFieldset;
204
208template<typename value_t>
209using LevelSetFieldMap = std::unordered_map<LevelSetField, value_t, LevelSetFieldHasher>;
210
216 VALUE = static_cast<int>(LevelSetField::VALUE),
217 SIGN = static_cast<int>(LevelSetField::SIGN),
218 GRADIENT = static_cast<int>(LevelSetField::GRADIENT),
219 SUPPORT = static_cast<int>(LevelSetField::SUPPORT),
220 PART = static_cast<int>(LevelSetField::PART),
221 NORMAL = static_cast<int>(LevelSetField::NORMAL),
222 ALL,
223 DEFAULT
224};
225
226}
227
228#endif
@ NARROW_BAND
Narrow band zone.
@ NONE
No caching will be performed.
@ FULL
Data are cached in the whole domain.
@ ON_DEMAND
Data are cached only where explicitly evaluated.
@ UNKNOWN
Unknown location.
@ NARROW_BAND_INTERSECTED
Narrow band zone, the cell intersects the surface.
@ SIGN_PROPAGATION
Sign is propagated from the narrow band, no other data will be evaluated.
@ EXACT
Exact data is evaluated.
const std::array< double, 3 > GRADIENT
const std::array< double, 3 > POINT
const std::array< double, 3 > NORMAL
A public container which includes all information provided by LevelSet.
std::array< double, 3 > gradient
--- layout: doxygen_footer ---