chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ScanShop Class Reference

Derived version of GeometryShop that load balances based on the cut cells themselves. More...

#include <CD_ScanShop.H>

Inheritance diagram for ScanShop:
Inheritance graph
[legend]
Collaboration diagram for ScanShop:
Collaboration graph
[legend]

Public Member Functions

 ScanShop ()=delete
 Disallowed default constructor.
 
 ScanShop (const BaseIF &a_geometry, const int a_verbosity, const Real a_finestDx, const RealVect a_probLo, const ProblemDomain a_finestDomain, const ProblemDomain a_scanLevel, const int a_ebGhost=4, const Real a_thrshdVoF=1.0e-16)
 Constructor. More...
 
 ~ScanShop ()
 Destructor (does nothing)
 
void setProfileFileName (const std::string a_fileName)
 If doing profiling, set the output name.
 
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. More...
 
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. More...
 
virtual 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. More...
 

Protected Member Functions

void makeDomains (const Real a_dx, const RealVect a_probLo, const ProblemDomain a_finestDomain, const ProblemDomain a_scanLevel)
 Create the problem domain and resolutions. More...
 
void buildFinerLevels (const int a_coarserLevel, const int a_maxGridSize)
 Refine levels recursively down to the finest level. More...
 
void buildCoarseLevel (const int a_finerLevel, const int a_maxGridSize)
 Build the "coarse level" where we initiate the recursion process. More...
 
bool isRegular (const Box a_box, const RealVect a_probLo, const Real a_dx) const
 Check if every point in input box is regular. More...
 
bool isCovered (const Box a_box, const RealVect a_probLo, const Real a_dx) const
 Check if every point in box is covered. More...
 
std::vector< std::pair< Box, int > > getSortedBoxesAndTypes (const Vector< Box > &a_boxes, const Vector< int > &a_types) const
 Sort boxes lexicographically. More...
 
void defineLevel (Vector< Box > &coveredBoxes, Vector< Box > &regularBoxes, Vector< Box > &cutCellBoxes, const int a_level)
 Define the "box map" on a specified level.
 

Protected Attributes

std::string m_fileName
 Set output file name (if doing profiling)
 
BoxSorting m_boxSorting
 For arranging boxes in space when we load balance.
 
Timer m_timer
 Timer for when we use run-time profiling.
 
bool m_profile
 Bool for run-time profiling of ScanShop.
 
int m_scanLevel
 Scan level where we first begin to break up boxes. This is relative the EBIS level.
 
int m_ebGhost
 Maximum number of ghost cells near the EB.
 
RealVect m_probLo
 Lower-left corner of simulation domain.
 
const BaseIF * m_baseIF
 Implicit function used to generate geometrys.
 
bool m_hasScanLevel
 Check if scan level has been built.
 
Vector< Real > m_dx
 Level resolutions. Note that index 0 is the finest level.
 
Vector< ProblemDomain > m_domains
 Level domains. Note that index 0 is the finest level.
 
Vector< DisjointBoxLayout > m_grids
 Grids on each level, used for generating the EBIS information.
 
Vector< RefCountedPtr< LayoutData< GeometryService::InOut > > > m_boxMap
 Box maps. More...
 
std::vector< bool > m_hasThisLevel
 Check if level has been scanned. 0 = false, != 0 implies true.
 

Detailed Description

Derived version of GeometryShop that load balances based on the cut cells themselves.

The internals of this class are basically the same as GeometryShop, with the exception that this class will generate an internal map of the computational domain on each level. This map is used to load balance the EB generation, most often leading to orders of magnitude speedup compared to Chombo's approach.

Constructor & Destructor Documentation

◆ ScanShop()

ScanShop::ScanShop ( const BaseIF &  a_localGeom,
const int  a_verbosity,
const Real  a_dx,
const RealVect  a_probLo,
const ProblemDomain  a_finestDomain,
const ProblemDomain  a_scanLevel,
const int  a_ebGhost = 4,
const Real  a_thrshdVoF = 1.0e-16 
)

Constructor.

CD_ScanShop.cpp.

Parameters
[in]a_geometryThe implicit function for the geometry
[in]a_verbosityVerbosity
[in]a_finestDxResolution on the finest level
[in]a_probLoPhysical coordinates of the lower-left corner of simulation domain
[in]a_finestDomainFinest grid level
[in]a_scanLevelScan level, i.e. on which level to initiate the load balancing sequence.
[in]a_ebGhostNumber of EB ghost cells
[in]a_thsdhVoFThreshold for GeometryShop

Implementation of CD_ScanShop.H

Author
Robert Marskar

Member Function Documentation

◆ buildCoarseLevel()

void ScanShop::buildCoarseLevel ( const int  a_finerLevel,
const int  a_maxGridSize 
)
protected

Build the "coarse level" where we initiate the recursion process.

This level must be defined in order to recurse towards deeper levels. Which is why this is ALWAYS called exact ONCE before buildFinerLevels builds the finer levels.

Parameters
[in]a_coarserLevelCoarser level
[in]a_maxGridSizeMaximum patch size

◆ buildFinerLevels()

void ScanShop::buildFinerLevels ( const int  a_coarserLevel,
const int  a_maxGridSize 
)
protected

Refine levels recursively down to the finest level.

Parameters
[in]a_coarserLevelCoarser level
[in]a_maxGridSizeMaximum patch size

◆ fillGraph()

void ScanShop::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
overridevirtual

Override of GeometryShop's fillGraph.

This just wraps a timer around the base version to spot load imbalance.

Parameters
[in,out]a_regIrregCoveredRegular/Covered/Irregular cells
[in,out]a_nodesNodes
[in]a_validRegionGrid region
[in]a_ghostRegionGrid region, including ghost cells
[in]a_domainDomain
[in]a_probLoLower-left corner of computational domain
[in]a_dxGrid resolution
[in]a_diGrid index

◆ getSortedBoxesAndTypes()

std::vector< std::pair< Box, int > > ScanShop::getSortedBoxesAndTypes ( const Vector< Box > &  a_boxes,
const Vector< int > &  a_types 
) const
inlineprotected

Sort boxes lexicographically.

A strange but true thing that is necessary because DisjointBoxlayout sorts the boxes under the hood

◆ InsideOutside()

GeometryService::InOut ScanShop::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.

This allows EBGraph boxes to be designed covered/regular or irregular without actually calling the implicit function. Since this class uses recursion froma deeper level, we are immediately able to say that a refined box does not contain cut-cells if the coarse box didn't either.

Parameters
[in]a_regionRegion for inside/outside testing
[in]a_domainProblem domain on level
[in]a_probLoLower-left corner of physical domain
[in]a_dxGrid resolution on level
[in]a_ditGrid index

◆ isCovered()

bool ScanShop::isCovered ( const Box  a_box,
const RealVect  a_probLo,
const Real  a_dx 
) const
inlineprotected

Check if every point in box is covered.

Parameters
[in]a_boxCell-centered box
[in]a_probLoLower-left corner of simulation domain
[in]a_dxGrid resolution

◆ isRegular()

bool ScanShop::isRegular ( const Box  a_box,
const RealVect  a_probLo,
const Real  a_dx 
) const
inlineprotected

Check if every point in input box is regular.

CD_ScanShopImplem.H.

Parameters
[in]a_boxCell-centered box
[in]a_probLoLower-left corner of simulation domain
[in]a_dxGrid resolution

Implementation of CD_ScanShop.H

Author
Robert Marskar

◆ makeDomains()

void ScanShop::makeDomains ( const Real  a_dx,
const RealVect  a_probLo,
const ProblemDomain  a_finestDomain,
const ProblemDomain  a_scanLevel 
)
protected

Create the problem domain and resolutions.

Parameters
[in]a_dxGrid resolution
[in]a_probLoLower-left corner of computational domain
[in]a_finestDomainFinest AMR domain
[in]a_scanLevelDomain where we initiate the load balanced recusion process.

◆ makeGrids()

void ScanShop::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.

Parameters
[in]a_domainProblem domain on level
[out]a_gridsLoad-balanced grids.
[in]a_maxGridSizeMaximum grid size.
[in]a_maxIrregGridSizeMaximum irregular grid size.

This function will create an internal "map" of the cut-cell geometry and return grids that are load-balanced with respect to the cut cells.

Member Data Documentation

◆ m_boxMap

Vector<RefCountedPtr<LayoutData<GeometryService::InOut> > > ScanShop::m_boxMap
protected

Box maps.

BoxType is a essentially just an integer on each patch which is =0,1,2 depending on whether or not the box is covered/regular/cut.


The documentation for this class was generated from the following files: