chombo-discharge
Loading...
Searching...
No Matches
CD_ScanShop.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_SCANSHOP_H
14#define CD_SCANSHOP_H
15
16// Chombo includes
17#include <GeometryShop.H>
18#include <GeometryService.H>
19
20// Our includes
21#include <CD_Timer.H>
22#include <CD_BoxSorting.H>
23#include <CD_NamespaceHeader.H>
24
31class ScanShop : public GeometryShop
32{
33public:
37 ScanShop() = delete;
38
50 ScanShop(const BaseIF& a_localGeom,
51 int a_verbosity,
52 Real a_dx,
53 const RealVect& a_probLo,
54 const ProblemDomain& a_finestDomain,
55 const ProblemDomain& a_scanLevel,
56 int a_ebGhost = 4,
57 Real a_thrshdVoF = 1.0e-16);
58
62 ~ScanShop() override;
63
67 ScanShop(const ScanShop&) = delete;
68
73 operator=(const ScanShop&) = delete;
74
78 ScanShop(ScanShop&&) = delete;
79
84 operator=(ScanShop&&) = delete;
85
86 using GeometryShop::InsideOutside;
87 using GeometryShop::isCovered;
88 using GeometryShop::isRegular;
89
94 void
95 setProfileFileName(std::string a_fileName);
96
106 void
107 makeGrids(const ProblemDomain& a_domain,
108 DisjointBoxLayout& a_grids,
109 const int& a_maxGridSize,
110 const int& a_maxIrregGridSize) override;
111
124 GeometryService::InOut
125 InsideOutside(const Box& a_region,
126 const ProblemDomain& a_domain,
127 const RealVect& a_probLo,
128 const Real& a_dx,
129 const DataIndex& a_dit) const override;
130
143 void
144 fillGraph(BaseFab<int>& a_regIrregCovered,
145 Vector<IrregNode>& a_nodes,
146 const Box& a_validRegion,
147 const Box& a_ghostRegion,
148 const ProblemDomain& a_domain,
149 const RealVect& a_probLo,
150 const Real& a_dx,
151 const DataIndex& a_di) const override;
152
153protected:
157 std::string m_fileName;
158
163
167 mutable Timer m_timer;
168
173
178
183
187 RealVect m_probLo;
188
192 const BaseIF* m_baseIF;
193
198
202 Vector<Real> m_dx;
203
207 Vector<ProblemDomain> m_domains;
208
212 Vector<DisjointBoxLayout> m_grids;
213
219 Vector<RefCountedPtr<LayoutData<GeometryService::InOut>>> m_boxMap;
220
224 std::vector<bool> m_hasThisLevel;
225
233 void
234 makeDomains(Real a_dx,
235 const RealVect& a_probLo,
236 const ProblemDomain& a_finestDomain,
237 const ProblemDomain& a_scanLevel);
238
244 void
245 buildFinerLevels(int a_coarserLevel, int a_maxGridSize);
246
254 void
255 buildCoarseLevel(int a_level, int a_maxGridSize);
256
263 inline bool
264 isRegular(Box a_box, const RealVect& a_probLo, Real a_dx) const;
265
273 inline bool
274 isCovered(Box a_box, const RealVect& a_probLo, Real a_dx) const;
275
283 inline std::vector<std::pair<Box, int>>
284 getSortedBoxesAndTypes(const Vector<Box>& a_boxes, const Vector<int>& a_types) const;
285
293 void
294 defineLevel(Vector<Box>& coveredBoxes, Vector<Box>& regularBoxes, Vector<Box>& cutCellBoxes, int a_level);
295};
296
297#include <CD_NamespaceFooter.H>
298
299#include <CD_ScanShopImplem.H>
300
301#endif
Declaration of an enum for identifying various ways of sorting grid patches.
BoxSorting
Enum for sorting boxes.
Definition CD_BoxSorting.H:22
Implementation of CD_Timer.H.
Derived version of GeometryShop that load balances based on the cut cells themselves.
Definition CD_ScanShop.H:32
void setProfileFileName(std::string a_fileName)
If doing profiling, set the output name.
Definition CD_ScanShop.cpp:85
Vector< RefCountedPtr< LayoutData< GeometryService::InOut > > > m_boxMap
Box maps.
Definition CD_ScanShop.H:219
Vector< Real > m_dx
Level resolutions. Note that index 0 is the finest level.
Definition CD_ScanShop.H:202
ScanShop(const ScanShop &)=delete
Disallow copy construction.
std::string m_fileName
Set output file name (if doing profiling)
Definition CD_ScanShop.H:157
void buildFinerLevels(int a_coarserLevel, int a_maxGridSize)
Refine levels recursively down to the finest level.
Definition CD_ScanShop.cpp:273
void makeDomains(Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel)
Create the problem domain and resolutions.
Definition CD_ScanShop.cpp:93
int m_scanLevel
Scan level where we first begin to break up boxes. This is relative the EBIS level.
Definition CD_ScanShop.H:177
int m_ebGhost
Maximum number of ghost cells near the EB.
Definition CD_ScanShop.H:182
BoxSorting m_boxSorting
For arranging boxes in space when we load balance.
Definition CD_ScanShop.H:162
void makeGrids(const ProblemDomain &a_domain, DisjointBoxLayout &a_grids, const int &a_maxGridSize, const int &a_maxIrregGridSize) override
This grid generation method is called by EBISLevel when using distributed data.
Definition CD_ScanShop.cpp:136
void defineLevel(Vector< Box > &coveredBoxes, Vector< Box > &regularBoxes, Vector< Box > &cutCellBoxes, int a_level)
Define the "box map" on a specified level.
Definition CD_ScanShop.cpp:362
bool isRegular(Box a_box, const RealVect &a_probLo, Real a_dx) const
Check if every point in input box is regular.
Definition CD_ScanShopImplem.H:23
void buildCoarseLevel(int a_level, int a_maxGridSize)
Build the "coarse level" where we initiate the recursion process.
Definition CD_ScanShop.cpp:198
Vector< DisjointBoxLayout > m_grids
Grids on each level, used for generating the EBIS information.
Definition CD_ScanShop.H:212
~ScanShop() override
Destructor (does nothing)
Definition CD_ScanShop.cpp:74
bool m_profile
Bool for run-time profiling of ScanShop.
Definition CD_ScanShop.H:172
std::vector< std::pair< Box, int > > getSortedBoxesAndTypes(const Vector< Box > &a_boxes, const Vector< int > &a_types) const
Sort boxes lexicographically.
Definition CD_ScanShopImplem.H:73
RealVect m_probLo
Lower-left corner of simulation domain.
Definition CD_ScanShop.H:187
ScanShop & operator=(ScanShop &&)=delete
Disallow move assignment.
ScanShop(ScanShop &&)=delete
Disallow move construction.
const BaseIF * m_baseIF
Implicit function used to generate geometries.
Definition CD_ScanShop.H:192
Timer m_timer
Timer for when we use run-time profiling.
Definition CD_ScanShop.H:167
bool isCovered(Box a_box, const RealVect &a_probLo, Real a_dx) const
Check if every point in box is covered.
Definition CD_ScanShopImplem.H:48
GeometryService::InOut InsideOutside(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real &a_dx, const DataIndex &a_dit) const override
This method is called by EBSILevel when using distributed data.
Definition CD_ScanShop.cpp:493
ScanShop()=delete
Disallowed default constructor.
std::vector< bool > m_hasThisLevel
Check if level has been scanned. 0 = false, != 0 implies true.
Definition CD_ScanShop.H:224
bool m_hasScanLevel
Check if scan level has been built.
Definition CD_ScanShop.H:197
ScanShop & operator=(const ScanShop &)=delete
Disallow copy assignment.
Vector< ProblemDomain > m_domains
Level domains. Note that index 0 is the finest level.
Definition CD_ScanShop.H:207
void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real &a_dx, const DataIndex &a_di) const override
Override of GeometryShop's fillGraph.
Definition CD_ScanShop.cpp:536
Class which is used for run-time monitoring of events.
Definition CD_Timer.H:32