chombo-discharge
Loading...
Searching...
No Matches
CD_PolyhedralEBGraph.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_POLYHEDRALEBGRAPH_H
14#define CD_POLYHEDRALEBGRAPH_H
15
16// Chombo includes
17#include <BaseFab.H>
18#include <BaseIF.H>
19#include <DisjointBoxLayout.H>
20#include <IVSFAB.H>
21#include <IntVectSet.H>
22#include <LayoutData.H>
23#include <LevelData.H>
24#include <ProblemDomain.H>
25#include <RealVect.H>
26
27// Our includes
28#include <CD_CutCellSurface.H>
29#include <CD_NamespaceHeader.H>
30
49{
50public:
54 static constexpr int s_covered = -1;
55
59 static constexpr int s_cut = 0;
60
64 static constexpr int s_regular = 1;
65
69 static constexpr int s_faceClosed = 0;
70
74 static constexpr int s_faceSameLevel = 1;
75
79 static constexpr int s_faceFiner = 2;
80
84 static constexpr int s_faceCoarser = 3;
85
89 static constexpr int s_faceBoundary = 4;
90
95
99 virtual ~PolyhedralEBGraph();
100
118 virtual void
119 define(const BaseIF& a_function,
120 const Vector<Box>& a_cutTiles,
121 const ProblemDomain& a_domain,
122 const RealVect& a_probLo,
123 const Real a_dx,
124 const int a_numGhost,
125 const Vector<Box>& a_covered);
126
139 virtual void
140 define(const PolyhedralEBGraph& a_source, const DisjointBoxLayout& a_grids, const BaseIF& a_function);
141
149 bool
150 equals(const PolyhedralEBGraph& a_other) const;
151
161 static void
162 link(PolyhedralEBGraph& a_coarse, const PolyhedralEBGraph& a_fine);
163
185 static void
186 findUnresolvedCells(const BaseFab<Real>& a_nodeValues,
187 const Box& a_region,
188 const Vector<Box>& a_covered,
189 BaseFab<bool>& a_unresolved);
190
195 bool
196 isDefined() const noexcept;
197
202 const ProblemDomain&
203 getDomain() const noexcept;
204
209 Real
210 getDx() const noexcept;
211
216 const DisjointBoxLayout&
217 getGrids() const noexcept;
218
223 const LayoutData<IntVectSet>&
224 getCutCells() const noexcept;
225
232 const LevelData<BaseFab<signed char>>&
233 getCellStates() const noexcept;
234
239 const LevelData<BaseFab<signed char>>&
240 getFaceStates() const noexcept;
241
247 const LevelData<BaseFab<signed char>>&
248 getRefinedMask() const noexcept;
249
254 const LevelData<IVSFAB<PolyhedralEB::CutCellSurface>>&
255 getSurfaces() const noexcept;
256
257protected:
262
267
271 Real m_dx;
272
276 RealVect m_probLo;
277
281 ProblemDomain m_domain;
282
286 DisjointBoxLayout m_grids;
287
291 Vector<Box> m_covered;
292
296 LayoutData<IntVectSet> m_cutCells;
297
301 LevelData<BaseFab<signed char>> m_cellStates;
302
306 LevelData<BaseFab<signed char>> m_faceStates;
307
311 LevelData<BaseFab<signed char>> m_refined;
312
316 LevelData<IVSFAB<PolyhedralEB::CutCellSurface>> m_surfaces;
317
322 void
323 defineGrids(const Vector<Box>& a_cutTiles);
324
329 void
330 defineData();
331
339 void
340 defineGhostCells(const BaseIF& a_function, const LevelData<BaseFab<signed char>>& a_carried);
341
347 void
348 markCarried(LevelData<BaseFab<signed char>>& a_carried) const;
349
356 void
357 defineCells(const BaseIF& a_function, const LevelData<BaseFab<signed char>>& a_carried);
358
363 void
364 defineOuterFaces(const LevelData<BaseFab<signed char>>& a_carried);
365};
366
367#include <CD_NamespaceFooter.H>
368
369#endif
Declaration of the data a cut cell's embedded boundary is reconstructed from.
The cut cells of one level of the polyhedral geometry, and what they connect to.
Definition CD_PolyhedralEBGraph.H:49
static constexpr int s_cut
Cell states, in the convention the polyhedral generator hands the index space.
Definition CD_PolyhedralEBGraph.H:59
bool isDefined() const noexcept
Whether define has run.
Definition CD_PolyhedralEBGraph.cpp:732
void defineOuterFaces(const LevelData< BaseFab< signed char > > &a_carried)
Mark the open faces that lie in the domain boundary, and those onto cells no tile of this level carri...
Definition CD_PolyhedralEBGraph.cpp:621
void defineCells(const BaseIF &a_function, const LevelData< BaseFab< signed char > > &a_carried)
Reconstruct and classify every cell of every box and its ghost region, keep the cut cells' surfaces w...
Definition CD_PolyhedralEBGraph.cpp:180
const LevelData< BaseFab< signed char > > & getRefinedMask() const noexcept
Whether the finer level carries a cell, one where it does, with two ghost cells; all zero until link ...
Definition CD_PolyhedralEBGraph.cpp:774
const DisjointBoxLayout & getGrids() const noexcept
The layout over the cut tiles.
Definition CD_PolyhedralEBGraph.cpp:750
virtual ~PolyhedralEBGraph()
Destructor.
Definition CD_PolyhedralEBGraph.cpp:36
const ProblemDomain & getDomain() const noexcept
The level's domain.
Definition CD_PolyhedralEBGraph.cpp:738
bool m_isDefined
Whether define has run.
Definition CD_PolyhedralEBGraph.H:261
static constexpr int s_faceSameLevel
Face states: the face opens onto a cell of this level.
Definition CD_PolyhedralEBGraph.H:74
void defineGhostCells(const BaseIF &a_function, const LevelData< BaseFab< signed char > > &a_carried)
Classify the ghost cells no tile of this level carries from their corners, and take the ghost cut cel...
Definition CD_PolyhedralEBGraph.cpp:366
LayoutData< IntVectSet > m_cutCells
Cut cells of every box.
Definition CD_PolyhedralEBGraph.H:296
void markCarried(LevelData< BaseFab< signed char > > &a_carried) const
Mark the cells some tile of this level carries: one in every valid cell and in every ghost cell anoth...
Definition CD_PolyhedralEBGraph.cpp:604
const LayoutData< IntVectSet > & getCutCells() const noexcept
The cut cells of every box, its own and those of its ghost region that some tile carries.
Definition CD_PolyhedralEBGraph.cpp:756
bool equals(const PolyhedralEBGraph &a_other) const
Whether another graph over the same layout holds the same cells, faces, mask and surfaces,...
Definition CD_PolyhedralEBGraph.cpp:542
ProblemDomain m_domain
Domain of the level.
Definition CD_PolyhedralEBGraph.H:281
Real m_dx
Grid spacing of the level.
Definition CD_PolyhedralEBGraph.H:271
static constexpr int s_regular
Cell states, in the convention the polyhedral generator hands the index space.
Definition CD_PolyhedralEBGraph.H:64
static constexpr int s_faceCoarser
Face states: the face opens onto a cell no tile of this level carries, which the coarser level does.
Definition CD_PolyhedralEBGraph.H:84
static void link(PolyhedralEBGraph &a_coarse, const PolyhedralEBGraph &a_fine)
Mark, on the coarse level, the cells the fine level carries and the faces that open onto them.
Definition CD_PolyhedralEBGraph.cpp:659
LevelData< IVSFAB< PolyhedralEB::CutCellSurface > > m_surfaces
Surface of every cut cell.
Definition CD_PolyhedralEBGraph.H:316
int m_numGhost
Ghost cells the cell states are kept for.
Definition CD_PolyhedralEBGraph.H:266
PolyhedralEBGraph()
Constructor. Leaves the graph undefined.
Definition CD_PolyhedralEBGraph.cpp:30
static void findUnresolvedCells(const BaseFab< Real > &a_nodeValues, const Box &a_region, const Vector< Box > &a_covered, BaseFab< bool > &a_unresolved)
Find the cells of a region that hold more than one sheet of interface.
Definition CD_PolyhedralEBGraph.cpp:121
const LevelData< BaseFab< signed char > > & getFaceStates() const noexcept
The state of every face of every cell, one of the s_face constants; component 2 * dir + side.
Definition CD_PolyhedralEBGraph.cpp:768
void defineGrids(const Vector< Box > &a_cutTiles)
Build the layout over the tiles, load balanced by cell count.
Definition CD_PolyhedralEBGraph.cpp:79
static constexpr int s_faceClosed
Face states: the face is closed, no fluid crosses it.
Definition CD_PolyhedralEBGraph.H:69
RealVect m_probLo
Lower-left corner of the domain.
Definition CD_PolyhedralEBGraph.H:276
static constexpr int s_faceBoundary
Face states: the face lies in the domain boundary and is open.
Definition CD_PolyhedralEBGraph.H:89
static constexpr int s_faceFiner
Face states: the face opens onto cells the finer level carries, and is described by them.
Definition CD_PolyhedralEBGraph.H:79
LevelData< BaseFab< signed char > > m_refined
One where the finer level carries the cell.
Definition CD_PolyhedralEBGraph.H:311
const LevelData< IVSFAB< PolyhedralEB::CutCellSurface > > & getSurfaces() const noexcept
The surface every cut cell is reconstructed from, in the box's own cells and in its ghost cells.
Definition CD_PolyhedralEBGraph.cpp:780
LevelData< BaseFab< signed char > > m_faceStates
State of every face of every cell, component 2 * dir + side.
Definition CD_PolyhedralEBGraph.H:306
static constexpr int s_covered
Cell states, in the convention the polyhedral generator hands the index space.
Definition CD_PolyhedralEBGraph.H:54
void defineData()
Allocate the per-cell containers over m_grids: the cut-cell sets, the cell states,...
Definition CD_PolyhedralEBGraph.cpp:101
virtual void define(const BaseIF &a_function, const Vector< Box > &a_cutTiles, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real a_dx, const int a_numGhost, const Vector< Box > &a_covered)
Build the graph of one level over its cut tiles.
Definition CD_PolyhedralEBGraph.cpp:42
Vector< Box > m_covered
Cells of this level the finer level carries, coarsened onto this level.
Definition CD_PolyhedralEBGraph.H:291
LevelData< BaseFab< signed char > > m_cellStates
State of every cell, with ghost cells.
Definition CD_PolyhedralEBGraph.H:301
Real getDx() const noexcept
The level's grid spacing.
Definition CD_PolyhedralEBGraph.cpp:744
const LevelData< BaseFab< signed char > > & getCellStates() const noexcept
The state of every cell, s_covered, s_cut or s_regular, with ghost cells filled from the geometry....
Definition CD_PolyhedralEBGraph.cpp:762
DisjointBoxLayout m_grids
Layout over the cut tiles.
Definition CD_PolyhedralEBGraph.H:286