chombo-discharge
Loading...
Searching...
No Matches
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_localGeom, int a_verbosity, Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel, int a_ebGhost=4, Real a_thrshdVoF=1.0e-16)
 Constructor.
 
 ~ScanShop () override
 Destructor (does nothing)
 
 ScanShop (const ScanShop &)=delete
 Disallow copy construction.
 
ScanShopoperator= (const ScanShop &)=delete
 Disallow copy assignment.
 
 ScanShop (ScanShop &&)=delete
 Disallow move construction.
 
ScanShopoperator= (ScanShop &&)=delete
 Disallow move assignment.
 
void setProfileFileName (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.
 
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.
 
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.
 

Protected Member Functions

void makeDomains (Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel)
 Create the problem domain and resolutions.
 
void buildFinerLevels (int a_coarserLevel, int a_maxGridSize)
 Refine levels recursively down to the finest level.
 
void buildCoarseLevel (int a_level, int a_maxGridSize)
 Build the "coarse level" where we initiate the recursion process.
 
bool isRegular (Box a_box, const RealVect &a_probLo, Real a_dx) const
 Check if every point in input box is regular.
 
bool isCovered (Box a_box, const RealVect &a_probLo, Real a_dx) const
 Check if every point in box is covered.
 
std::vector< std::pair< Box, int > > getSortedBoxesAndTypes (const Vector< Box > &a_boxes, const Vector< int > &a_types) const
 Sort boxes lexicographically.
 
void defineLevel (Vector< Box > &coveredBoxes, Vector< Box > &regularBoxes, Vector< Box > &cutCellBoxes, 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 geometries.
 
bool m_hasScanLevel
 Check if scan level has been built.
 
Vector< Realm_dx
 Level resolutions. Note that index 0 is the finest level.
 
Vector< ProblemDomainm_domains
 Level domains. Note that index 0 is the finest level.
 
Vector< DisjointBoxLayoutm_grids
 Grids on each level, used for generating the EBIS information.
 
Vector< RefCountedPtr< LayoutData< GeometryService::InOut > > > m_boxMap
 Box maps.
 
std::vector< boolm_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,
int  a_verbosity,
Real  a_dx,
const RealVect a_probLo,
const ProblemDomain a_finestDomain,
const ProblemDomain a_scanLevel,
int  a_ebGhost = 4,
Real  a_thrshdVoF = 1.0e-16 
)

Constructor.

Parameters
[in]a_localGeomThe implicit function for the geometry
[in]a_verbosityVerbosity
[in]a_dxResolution 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_thrshdVoFThreshold for GeometryShop

Member Function Documentation

◆ buildCoarseLevel()

void ScanShop::buildCoarseLevel ( int  a_level,
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_levelLevel index for the coarse level
[in]a_maxGridSizeMaximum patch size

◆ buildFinerLevels()

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

Refine levels recursively down to the finest level.

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

◆ defineLevel()

void ScanShop::defineLevel ( Vector< Box > &  coveredBoxes,
Vector< Box > &  regularBoxes,
Vector< Box > &  cutCellBoxes,
int  a_level 
)
protected

Define the "box map" on a specified level.

Parameters
[in,out]coveredBoxesDescription
[in,out]regularBoxesDescription
[in,out]cutCellBoxesDescription
[in]a_levelDescription

◆ 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
override

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

Returns
Sorted boxes and types
Parameters
[in,out]a_boxesDescription
[in,out]a_typesDescription

◆ 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
Returns
Return value

◆ isCovered()

bool ScanShop::isCovered ( Box  a_box,
const RealVect a_probLo,
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
Returns
True if covered, false otherwise

◆ isRegular()

bool ScanShop::isRegular ( Box  a_box,
const RealVect a_probLo,
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
Returns
True if regular, false otherwise

◆ makeDomains()

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

◆ setProfileFileName()

void ScanShop::setProfileFileName ( std::string  a_fileName)

If doing profiling, set the output name.

Parameters
[in]a_fileNameFile name for profiling output

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: