Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
AMReX_EB2_MultiGFab.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_MULTIGFAB_H_
2#define AMREX_EB2_MULTIGFAB_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_EB2_Graph.H>
6#include <AMReX_EBCellFlag.H>
7#include <AMReX_Array.H>
8#include <AMReX_LayoutData.H>
9#include <AMReX_MultiFab.H>
10
11namespace amrex::EB2 {
12
13class GFab
14{
15public:
16
17 GFab () = default;
18
19 static constexpr int ng = 2;
20
21 void define(const Box& vbx) {
22 m_validbox = vbx;
23 const Box& bxg2 = amrex::grow(vbx,ng);
24 m_levelset.resize(amrex::surroundingNodes(bxg2));
25 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
26 m_facetype[idim].resize(amrex::convert(bxg2,IntVect::TheDimensionVector(idim)));
27#if (AMREX_SPACEDIM == 3)
28 m_edgetype[idim].resize(amrex::convert(bxg2,IntVect::TheNodeVector()
30#endif
31 }
32 }
33
34 Box validbox () const { return m_validbox; }
35
36 const BaseFab<Real>& getLevelSet () const { return m_levelset; }
37 BaseFab<Real>& getLevelSet () { return m_levelset; }
38
39 const Array<BaseFab<Type_t>,AMREX_SPACEDIM>& getFaceType () const { return m_facetype; }
40 Array<BaseFab<Type_t>,AMREX_SPACEDIM>& getFaceType () { return m_facetype; }
41
42#if (AMREX_SPACEDIM == 3)
43 const Array<BaseFab<Type_t>,AMREX_SPACEDIM>& getEdgeType () const { return m_edgetype; }
44 Array<BaseFab<Type_t>,AMREX_SPACEDIM>& getEdgeType () { return m_edgetype; }
45#endif
46
47 const Graph& getGraph () const { return m_graph; }
48 Graph& getGraph () { return m_graph; }
49
50 void buildTypes (EBCellFlagFab& celltype);
51
52private:
53
54 Box m_validbox;
55 BaseFab<Real> m_levelset;
56 Array<BaseFab<Type_t>, AMREX_SPACEDIM> m_facetype;
57#if (AMREX_SPACEDIM == 3)
58 Array<BaseFab<Type_t>, AMREX_SPACEDIM> m_edgetype;
59#endif
60 Graph m_graph;
61};
62
64 : public LayoutData<GFab>
65{
66public:
67
68 MultiGFab () = default;
69
70 MultiGFab (const BoxArray& ba, const DistributionMapping& dm) {
71 define(ba,dm);
72 }
73
74 void define (const BoxArray& ba, const DistributionMapping& dm) {
76 for (MFIter mfi(*this); mfi.isValid(); ++mfi) {
77 const Box& bx = mfi.validbox();
78 auto& gfab = (*this)[mfi];
79 gfab.define(bx);
80 }
81 }
82
84};
85
86}
87
88#endif
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:189
void resize(const Box &b, int N=1, Arena *ar=nullptr)
This function resizes a BaseFab so it covers the Box b with N components.
Definition AMReX_BaseFab.H:1628
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:567
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
Definition AMReX_EB2_MultiGFab.H:14
Box validbox() const
Definition AMReX_EB2_MultiGFab.H:34
Graph & getGraph()
Definition AMReX_EB2_MultiGFab.H:48
const Graph & getGraph() const
Definition AMReX_EB2_MultiGFab.H:47
const BaseFab< Real > & getLevelSet() const
Definition AMReX_EB2_MultiGFab.H:36
const Array< BaseFab< Type_t >, 3 > & getFaceType() const
Definition AMReX_EB2_MultiGFab.H:39
const Array< BaseFab< Type_t >, 3 > & getEdgeType() const
Definition AMReX_EB2_MultiGFab.H:43
BaseFab< Real > & getLevelSet()
Definition AMReX_EB2_MultiGFab.H:37
Array< BaseFab< Type_t >, 3 > & getEdgeType()
Definition AMReX_EB2_MultiGFab.H:44
void buildTypes(EBCellFlagFab &celltype)
Definition AMReX_EB2_MultiGFab.cpp:8
Array< BaseFab< Type_t >, 3 > & getFaceType()
Definition AMReX_EB2_MultiGFab.H:40
void define(const Box &vbx)
Definition AMReX_EB2_MultiGFab.H:21
static constexpr int ng
Definition AMReX_EB2_MultiGFab.H:19
Definition AMReX_EB2_MultiGFab.H:65
void define(const BoxArray &ba, const DistributionMapping &dm)
Definition AMReX_EB2_MultiGFab.H:74
MultiGFab(const BoxArray &ba, const DistributionMapping &dm)
Definition AMReX_EB2_MultiGFab.H:70
MultiFab getLevelSet()
Definition AMReX_EB2_MultiGFab.cpp:41
Definition AMReX_EBCellFlag.H:287
__host__ static __device__ constexpr IntVectND< dim > TheNodeVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:710
__host__ static __device__ constexpr IntVectND< dim > TheDimensionVector(int d) noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:699
a one-thingy-per-box distributed object
Definition AMReX_LayoutData.H:13
void define(const BoxArray &a_grids, const DistributionMapping &a_dm)
Definition AMReX_LayoutData.H:25
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:63
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:147
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:40
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1280
std::array< T, N > Array
Definition AMReX_Array.H:25
Definition AMReX_FabArrayBase.H:33
std::unordered_map< IntVect, Vector< Vertex >, IntVect::hasher > Graph
Definition AMReX_EB2_Graph.H:85
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a BoxND with different type.
Definition AMReX_Box.H:1558
__host__ __device__ BoxND< dim > surroundingNodes(const BoxND< dim > &b, int dir) noexcept
Return a BoxND with NODE based coordinates in direction dir that encloses BoxND b....
Definition AMReX_Box.H:1522