1#ifndef AMREX_EBCELLFLAG_H_
2#define AMREX_EBCELLFLAG_H_
3#include <AMReX_Config.H>
27 explicit constexpr
EBCellFlag (uint32_t i) noexcept : flag(i) {}
39 flag &= zero_lower_mask;
41 flag |= single_vof_bits;
51 flag &= zero_lower_mask;
52 flag |= single_valued_bits;
53 flag |= single_vof_bits;
58 flag &= zero_lower_mask;
59 flag |= multi_valued_bits;
61 flag |=
static_cast<uint32_t
>(n) << pos_numvofs;
67 return (flag == (a_input.flag));
73 return (flag != (a_input.flag));
79 return static_cast<int>((flag & one_numvofs_mask) >> pos_numvofs);
84 return (flag & one_type_mask) == regular_bits;
89 return (flag & one_type_mask) == single_valued_bits;
94 return (flag & one_type_mask) == multi_valued_bits;
99 return (flag & one_type_mask) == covered_bits;
106 const int n = w_lower_mask + 13 + i + 3*j + k*9;
107 return flag & (1 << n);
112 const int n = w_lower_mask + 13 + i + 3*j + k*9;
113 return flag & (1 << n);
120 const int n = w_lower_mask + 13 + i + 3*j + k*9;
121 return !(flag & (1 << n));
126 const int n = w_lower_mask + 13 + i + 3*j + k*9;
127 return !(flag & (1 << n));
132 flag &= one_lower_mask;
139 const int n = w_lower_mask + 13 + i + 3*j + k*9;
145 const int n = w_lower_mask + 13 + i + 3*j + k*9;
151 flag |= zero_lower_mask;
158 const int n = w_lower_mask + 13 + i + 3*j + k*9;
164 const int n = w_lower_mask + 13 + i + 3*j + k*9;
181#if (AMREX_SPACEDIM == 3)
227 static constexpr uint32_t one_lower_mask = 0x1f;
228 static constexpr uint32_t zero_lower_mask = ~0x1f;
231 static constexpr uint32_t one_type_mask = 0x3;
232 static constexpr uint32_t zero_type_mask = ~0x3;
235 static constexpr uint32_t one_numvofs_mask = 0x1c;
236 static constexpr uint32_t zero_numvofs_mask = ~0x1c;
240 static constexpr uint32_t regular_bits = 0x0;
241 static constexpr uint32_t single_valued_bits = 0x1;
242 static constexpr uint32_t multi_valued_bits = 0x2;
243 static constexpr uint32_t covered_bits = 0x3;
246 static constexpr uint32_t single_vof_bits = 0x4;
253 static constexpr int w_lower_mask = 5;
254 static constexpr int w_type = 2;
255 static constexpr int w_numvofs = 3;
256 static constexpr int pos_numvofs = 2;
258 static constexpr std::array<std::array<std::array<int,3>,3>,3> pos_ngbr
259 {{ std::array<std::array<int,3>,3>{{{ w_lower_mask , w_lower_mask+ 1, w_lower_mask+ 2 },
260 { w_lower_mask+ 3, w_lower_mask+ 4, w_lower_mask+ 5 },
261 { w_lower_mask+ 6, w_lower_mask+ 7, w_lower_mask+ 8 }}},
262 std::array<std::array<int,3>,3>{{{ w_lower_mask+ 9, w_lower_mask+10, w_lower_mask+11 },
263 { w_lower_mask+12, w_lower_mask+13, w_lower_mask+14 },
264 { w_lower_mask+15, w_lower_mask+16, w_lower_mask+17 }}},
265 std::array<std::array<int,3>,3>{{{ w_lower_mask+18, w_lower_mask+19, w_lower_mask+20 },
266 { w_lower_mask+21, w_lower_mask+22, w_lower_mask+23 },
267 { w_lower_mask+24, w_lower_mask+25, w_lower_mask+26 }}} }};
271#if AMREX_SPACEDIM == 3
272 static constexpr uint32_t default_value = zero_lower_mask | regular_bits | single_vof_bits;
274 static constexpr uint32_t default_value = 0x7fc004;
277 static constexpr uint32_t covered_value = 0x40003;
279 uint32_t flag = default_value;
298 Arena* ar =
nullptr);
352 mutable std::map<Box,NumCells> m_typemap;
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:124
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:189
Definition AMReX_EBCellFlag.H:287
int getNumRegularCells(const Box &bx) const noexcept
Returns the number of regular cells in the given Box.
Definition AMReX_EBCellFlag.cpp:147
~EBCellFlagFab() override=default
void setType(FabType t) noexcept
Definition AMReX_EBCellFlag.H:340
void resetType(int ng)
Reset FabType.
Definition AMReX_EBCellFlag.cpp:132
EBCellFlagFab & operator=(const EBCellFlagFab &)=delete
EBCellFlagFab(EBCellFlagFab &&rhs)=default
int getNumCutCells(const Box &bx) const noexcept
Returns the number of cut cells in the given Box.
Definition AMReX_EBCellFlag.cpp:188
int getNumCoveredCells(const Box &bx) const noexcept
Returns the number of covered cells in the given Box.
Definition AMReX_EBCellFlag.cpp:226
FabType getType() const noexcept
Returns FabType of the whole EBCellFlagFab.
Definition AMReX_EBCellFlag.H:313
EBCellFlagFab(const EBCellFlagFab &)=delete
Definition AMReX_EBCellFlag.H:17
__host__ __device__ bool isConnected(int i, int j, int k) const noexcept
Definition AMReX_EBCellFlag.H:111
__host__ __device__ void setDisconnected(int i, int j, int k) noexcept
Definition AMReX_EBCellFlag.H:144
__host__ __device__ int getNumVoFs() const noexcept
Definition AMReX_EBCellFlag.H:77
__host__ __device__ void setMultiValued(int n) noexcept
Definition AMReX_EBCellFlag.H:57
__host__ __device__ void setCovered() noexcept
Definition AMReX_EBCellFlag.H:45
__host__ __device__ void setConnected() noexcept
Definition AMReX_EBCellFlag.H:150
__host__ __device__ void setSingleValued() noexcept
Definition AMReX_EBCellFlag.H:50
__host__ __device__ EBCellFlag & operator+=(const EBCellFlag &)
Definition AMReX_EBCellFlag.H:32
__host__ __device__ void setConnected(const IntVect &iv) noexcept
Definition AMReX_EBCellFlag.H:155
__host__ __device__ int numNeighbors() const noexcept
Definition AMReX_EBCellFlag.H:169
__host__ __device__ void setDisconnected(const IntVect &iv) noexcept
Definition AMReX_EBCellFlag.H:136
__host__ __device__ void setDisconnected() noexcept
Definition AMReX_EBCellFlag.H:131
__host__ __device__ void setRegular() noexcept
Definition AMReX_EBCellFlag.H:38
constexpr EBCellFlag() noexcept=default
__host__ __device__ bool isSingleValued() const noexcept
Definition AMReX_EBCellFlag.H:88
__host__ __device__ bool isDisconnected(int i, int j, int k) const noexcept
Definition AMReX_EBCellFlag.H:125
__host__ __device__ bool operator!=(const EBCellFlag &a_input) const noexcept
Definition AMReX_EBCellFlag.H:71
__host__ __device__ bool isCovered() const noexcept
Definition AMReX_EBCellFlag.H:98
__host__ __device__ bool isDisconnected(const IntVect &iv) const noexcept
Definition AMReX_EBCellFlag.H:117
__host__ __device__ bool operator==(const EBCellFlag &a_input) const noexcept
Definition AMReX_EBCellFlag.H:65
__host__ __device__ bool isConnected(const IntVect &iv) const noexcept
Definition AMReX_EBCellFlag.H:103
__host__ static __device__ constexpr EBCellFlag TheDefaultCell()
Definition AMReX_EBCellFlag.H:216
__host__ __device__ bool isMultiValued() const noexcept
Definition AMReX_EBCellFlag.H:93
__host__ __device__ void setConnected(int i, int j, int k) noexcept
Definition AMReX_EBCellFlag.H:163
__host__ static __device__ constexpr EBCellFlag TheCoveredCell()
Definition AMReX_EBCellFlag.H:222
__host__ __device__ bool isRegular() const noexcept
Definition AMReX_EBCellFlag.H:83
constexpr EBCellFlag & operator=(const EBCellFlag &rhs) noexcept=default
__host__ __device__ uint32_t getValue() const noexcept
Definition AMReX_EBCellFlag.H:210
Definition AMReX_Amr.cpp:49
MakeType
Definition AMReX_MakeType.H:7
FabType
Definition AMReX_FabFactory.H:18
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition AMReX_AmrMesh.cpp:1237
void * alloc(std::size_t sz) const noexcept
Definition AMReX_DataAllocator.H:16
Definition AMReX_EBCellFlag.H:342
FabType type
Definition AMReX_EBCellFlag.H:347
int nmulti
Definition AMReX_EBCellFlag.H:345
int nsingle
Definition AMReX_EBCellFlag.H:344
int ncovered
Definition AMReX_EBCellFlag.H:346
int nregular
Definition AMReX_EBCellFlag.H:343
Definition AMReX_TypeTraits.H:297