Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_EB2_Graph.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_GRAPH_H_
2#define AMREX_EB2_GRAPH_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_Array.H>
6#include <AMReX_Vector.H>
7#include <AMReX_IntVect.H>
8
9#include <unordered_map>
10#include <utility>
11#include <cstdint>
12
20namespace amrex::EB2 {
21
23struct Cell
24{
26 // and more such as boundary centroid and normal
27};
28
35
36using VertexID = std::pair<IntVect,int>;
37
44
45using Type_t = uint32_t;
46
48namespace Type {
49 static constexpr Type_t regular=0x0;
50 static constexpr Type_t covered=0x1;
51 static constexpr Type_t irregular=0x2;
52 static constexpr Type_t unknown=0x3;
53}
54
57{
59 void setXLo (Type_t t) { flag &= zero_xlo_mask; flag |= t; }
61 void setXHi (Type_t t) { flag &= zero_xhi_mask; flag |= (t << 2); }
63 void setYLo (Type_t t) { flag &= zero_ylo_mask; flag |= (t << 4); }
65 void setYHi (Type_t t) { flag &= zero_yhi_mask; flag |= (t << 6); }
67 void setZLo (Type_t t) { flag &= zero_zlo_mask; flag |= (t << 8); }
69 void setZHi (Type_t t) { flag &= zero_zhi_mask; flag |= (t << 10); }
70
71 [[nodiscard]] Type_t getXLo () const { return (flag & one_xlo_mask); }
72 [[nodiscard]] Type_t getXHi () const { return (flag & one_xhi_mask) >> 2; }
73 [[nodiscard]] Type_t getYLo () const { return (flag & one_ylo_mask) >> 4; }
74 [[nodiscard]] Type_t getYHi () const { return (flag & one_yhi_mask) >> 6; }
75 [[nodiscard]] Type_t getZLo () const { return (flag & one_zlo_mask) >> 8; }
76 [[nodiscard]] Type_t getZHi () const { return (flag & one_zhi_mask) >> 10; }
77
78private:
79
80 Type_t flag = 0;
81
82 static constexpr Type_t one_xlo_mask = 0x3;
83 static constexpr Type_t zero_xlo_mask = ~0x3;
84 static constexpr Type_t one_xhi_mask = 0xC;
85 static constexpr Type_t zero_xhi_mask = ~0xC;
86 static constexpr Type_t one_ylo_mask = 0x30;
87 static constexpr Type_t zero_ylo_mask = ~0x30;
88 static constexpr Type_t one_yhi_mask = 0xC0;
89 static constexpr Type_t zero_yhi_mask = ~0xC0;
90 static constexpr Type_t one_zlo_mask = 0x300;
91 static constexpr Type_t zero_zlo_mask = ~0x300;
92 static constexpr Type_t one_zhi_mask = 0xC00;
93 static constexpr Type_t zero_zhi_mask = ~0xC00;
94};
95
103
105using Graph = std::unordered_map<IntVect, Vector<Vertex>, IntVect::hasher>;
106
107}
108
109#endif
shift_hasher hasher
Definition AMReX_IntVect.H:187
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
static constexpr Type_t regular
Definition AMReX_EB2_Graph.H:49
static constexpr Type_t unknown
Definition AMReX_EB2_Graph.H:52
static constexpr Type_t covered
Definition AMReX_EB2_Graph.H:50
static constexpr Type_t irregular
Definition AMReX_EB2_Graph.H:51
Definition AMReX_FabArrayBase.H:33
std::unordered_map< IntVect, Vector< Vertex >, IntVect::hasher > Graph
EB graph type: map from cell index to all EB vertices stored there.
Definition AMReX_EB2_Graph.H:105
std::pair< IntVect, int > VertexID
Definition AMReX_EB2_Graph.H:36
uint32_t Type_t
Definition AMReX_EB2_Graph.H:45
Array< Real, 3 > RealArray
Definition AMReX_Array.H:28
Per-cell geometric information stored in EB graphs.
Definition AMReX_EB2_Graph.H:24
RealArray m_volfrac
Definition AMReX_EB2_Graph.H:25
Edge connecting a graph vertex to a face and downstream vertex id.
Definition AMReX_EB2_Graph.H:40
VertexID m_vid
Definition AMReX_EB2_Graph.H:42
Face m_face
Definition AMReX_EB2_Graph.H:41
Metadata associated with an EB face.
Definition AMReX_EB2_Graph.H:31
RealArray m_facecent
Definition AMReX_EB2_Graph.H:32
Real m_areafrac
Definition AMReX_EB2_Graph.H:33
Packed neighbor structure that tracks the neighbor type in every direction.
Definition AMReX_EB2_Graph.H:57
Type_t getYHi() const
Definition AMReX_EB2_Graph.H:74
Type_t getYLo() const
Definition AMReX_EB2_Graph.H:73
Type_t getXLo() const
Definition AMReX_EB2_Graph.H:71
void setYHi(Type_t t)
Mark the high-y neighbor type.
Definition AMReX_EB2_Graph.H:65
void setXHi(Type_t t)
Mark the high-x neighbor type.
Definition AMReX_EB2_Graph.H:61
Type_t getXHi() const
Definition AMReX_EB2_Graph.H:72
Type_t getZLo() const
Definition AMReX_EB2_Graph.H:75
void setZHi(Type_t t)
Mark the high-z neighbor type.
Definition AMReX_EB2_Graph.H:69
Type_t getZHi() const
Definition AMReX_EB2_Graph.H:76
void setXLo(Type_t t)
Mark the low-x neighbor type.
Definition AMReX_EB2_Graph.H:59
void setZLo(Type_t t)
Mark the low-z neighbor type.
Definition AMReX_EB2_Graph.H:67
void setYLo(Type_t t)
Mark the low-y neighbor type.
Definition AMReX_EB2_Graph.H:63
Vertex capturing one irregular cell plus its neighbor connectivity.
Definition AMReX_EB2_Graph.H:98
Cell m_cell
Definition AMReX_EB2_Graph.H:99
Neighbor m_nghb
Definition AMReX_EB2_Graph.H:100
Vector< Edge > m_edges
Definition AMReX_EB2_Graph.H:101