chombo-discharge
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
VofUtils Class Reference

Static class which contains some routines for fetching VoFs using various algorithms. Very useful in combination with least squares. More...

#include <CD_VofUtils.H>

Public Types

enum class  Connectivity { MonotonePath , SimplyConnected , All }
 Class for specifying connectivity of Vofs. More...
 
enum class  Neighborhood { Quadrant , Radius , SemiCircle }
 Neighborhood type. More...
 

Public Member Functions

 VofUtils ()=delete
 Disallowed.
 

Static Public Member Functions

static Vector< VolIndex > getVofsInRadius (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const Connectivity a_connectivity, const bool a_addStartVof)
 Fetch vofs in a specified radius and with a specified connectivitiy between them. More...
 
static Vector< VolIndex > getVofsInRadius (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const DenseIntVectSet &a_validCells, const Connectivity a_connectivity, const bool a_addStartVof)
 Fetch vofs in a specified radius and with a specified connectivitiy between them. More...
 
static Vector< VolIndex > getVofsInQuadrant (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const int a_radius, const Connectivity a_connectivity, const bool a_addStartVof)
 Fetch vofs in a quadrant, using a specified radius and with a specified connectivitiy between them. More...
 
static Vector< VolIndex > getVofsInSemiCircle (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const int a_radius, const Real a_deltaThresh, const Connectivity a_connectivity, const Location::Cell a_vofLocation, const Location::Cell a_cellLocation, const bool a_addStartVof)
 Get all vofs lying in a semi-circle (sphere in 3D) from the indicated position in the starting vof. More...
 
static void excludeCells (Vector< VolIndex > &a_vofs, const Box &a_excludeBox)
 Modifies a_vofs so it doesn't include cells in a_excludeIVS. More...
 
static void excludeCells (Vector< VolIndex > &a_vofs, const IntVectSet &a_excludeIVS)
 Modifies a_vofs so it doesn't include cells in a_excludeIVS. More...
 
static void includeCells (Vector< VolIndex > &a_vofs, const Box &a_includeBox)
 Modifies a_vofs so it only includes cells in a box. More...
 
static void includeCells (Vector< VolIndex > &a_vofs, const IntVectSet &a_includeIVS)
 Modifies a_vofs so it only includes cells in a box. More...
 
static void includeCells (Vector< VolIndex > &a_vofs, const DenseIntVectSet &a_includeIVS)
 Modifies a_vofs so it only includes cells in a box. More...
 
static void onlyUnique (Vector< VolIndex > &a_vofs)
 Discard duplicates. More...
 

Static Protected Member Functions

static bool isQuadrantWellDefined (const RealVect a_normal)
 Check if a quadrant is well-defined for a direction in space. More...
 
static std::pair< int, Side::LoHiSide > getCardinalDirection (const RealVect a_normal)
 Returns the coordinate direction. More...
 
static Vector< VolIndex > getVofsInMonotonePath (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
 Get all VoFs that can be found with a monotone path with specified radius. More...
 
static Vector< VolIndex > getConnectedVofsInRadius (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
 Get all connected Vofs in radius which can be reached without crossing a covered face or reaching into a domain boundary. More...
 
static Vector< VolIndex > getAllVofsInRadius (const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
 Get all Vofs in a radius from a starting Vof. More...
 
static Vector< VolIndex > connectedVofsOnly (const VolIndex &a_startVof, const Vector< VolIndex > &a_allVofs, const EBISBox &a_ebisbox)
 Get all Vofs that are connected to a specific starting Vof. The connection does not have to be direct. More...
 
static Box getQuadrant (const RealVect &a_normal, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real a_radius)
 Get quadrant defined by direction in space. More...
 
static Box getSymmetricQuadrant (const std::pair< int, Side::LoHiSide > &a_cardinal, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real a_radius)
 Get "symmetric" quadrant defined by direction in space. More...
 
static void getVofsInMonotonePath (Vector< VolIndex > &a_vofList, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const IntVect &a_timesMoved, const IntVect &a_pathSign)
 Get all Vofs in a monotone path. Does not move more than a_radius in any direction. More...
 
static void getVofsInMonotonePath (std::set< VolIndex > &a_vofList, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const Box &a_validBox, const int &a_radius, const IntVect &a_timesMoved, const IntVect &a_pathSign)
 Get all Vofs in a monotone path. Does not move more than a_radius in any direction. More...
 

Detailed Description

Static class which contains some routines for fetching VoFs using various algorithms. Very useful in combination with least squares.

Member Enumeration Documentation

◆ Connectivity

Class for specifying connectivity of Vofs.

MontonePath: Vofs must be reachable with monotone path.

SimplyConnected: All vofs must be connected

All: All vofs allowed

◆ Neighborhood

Neighborhood type.

Parameters
[in]Quadrant.Only fetch vofs in a specified quadrant.
[in]Radius.Fetch all vofs in a specified radius.
[in]SemiCircle.Fetch all vofs in a half-circle with specified radius.

Member Function Documentation

◆ connectedVofsOnly()

Vector< VolIndex > VofUtils::connectedVofsOnly ( const VolIndex &  a_startVof,
const Vector< VolIndex > &  a_allVofs,
const EBISBox &  a_ebisbox 
)
staticprotected

Get all Vofs that are connected to a specific starting Vof. The connection does not have to be direct.

Parameters
[in]a_startVofStarting Vof
[in]a_allVofsAll Vofs. This can, but does not have to, include a_startVof.
[in]a_ebisboxEBISBox.
Returns
List of Vofs that are connected to a_startVof. This list does not include a_startVof

◆ excludeCells() [1/2]

void VofUtils::excludeCells ( Vector< VolIndex > &  a_vofs,
const Box &  a_excludeBox 
)
static

Modifies a_vofs so it doesn't include cells in a_excludeIVS.

Parameters
[in]a_vofsList of vofs to be modified
[in]a_excludeBoxBox to be excluded
Returns
Modifed list of vofs which do not include cell in a box

◆ excludeCells() [2/2]

void VofUtils::excludeCells ( Vector< VolIndex > &  a_vofs,
const IntVectSet &  a_excludeIVS 
)
static

Modifies a_vofs so it doesn't include cells in a_excludeIVS.

Parameters
[in]a_vofsList of vofs to be modified
[in]a_excludeIVSList of cells to be excluded.
Returns
Modifed list of vofs which do not include a_excludeIVS cells.

◆ getAllVofsInRadius()

Vector< VolIndex > VofUtils::getAllVofsInRadius ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const bool  a_addStartVof 
)
staticprotected

Get all Vofs in a radius from a starting Vof.

Parameters
[in]a_startVofStarting Vof
[in]a_ebisboxEBISBox
[in]a_radiusSearch radius
[in]a_addStartVofIf false, a_startVof will not be included in the list.

◆ getCardinalDirection()

std::pair< int, Side::LoHiSide > VofUtils::getCardinalDirection ( const RealVect  a_normal)
staticprotected

Returns the coordinate direction.

Parameters
[in]Non-zeronormal vector
[in]Returnsdirction where ||a_normal[dir]|| == 1. If a_normal[dir] == -1 then dir => -dir

◆ getConnectedVofsInRadius()

Vector< VolIndex > VofUtils::getConnectedVofsInRadius ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const bool  a_addStartVof 
)
staticprotected

Get all connected Vofs in radius which can be reached without crossing a covered face or reaching into a domain boundary.

Parameters
[in]a_startVofStarting Vof
[in]a_ebisboxEBISBox
[in]a_radiusSearch radius
[in]a_addStartVofIf false, a_startVof will not be in the returned list.
Returns
Returns all Vofs within radius a_radius from a_startVof

◆ getQuadrant()

Box VofUtils::getQuadrant ( const RealVect &  a_normal,
const VolIndex &  a_vof,
const EBISBox &  a_ebisbox,
const Real  a_radius 
)
staticprotected

Get quadrant defined by direction in space.

Parameters
[in]a_cardinalThe direction in space which defines the quadrant.
[in]a_vofStarting vof
[in]a_ebisboxEBISBox
[in]a_radiusQuadrant radius
Returns
Quadrant as a box, with one of the corners on a_vof.

◆ getSymmetricQuadrant()

Box VofUtils::getSymmetricQuadrant ( const std::pair< int, Side::LoHiSide > &  a_cardinal,
const VolIndex &  a_vof,
const EBISBox &  a_ebisbox,
const Real  a_radius 
)
staticprotected

Get "symmetric" quadrant defined by direction in space.

Parameters
[in]a_cardinalThe direction in space which defines the quadrant.
[in]a_vofStarting vof
[in]a_radiusQuadrant radius
Returns
Symmetric quadrant with a_vof on one of the sides.

◆ getVofsInMonotonePath() [1/3]

Vector< VolIndex > VofUtils::getVofsInMonotonePath ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const bool  a_addStartVof 
)
staticprotected

Get all VoFs that can be found with a monotone path with specified radius.

Parameters
[in]a_startVofStarting Vof.
[in]a_ebisboxEBISBox.
[in]a_radiusRadius.
[in]a_addStartVofIf false, a_startVof will not be included in the list.
Returns
Returns list of VoFs that can be found with a monotone path of radius <= a_radius.

◆ getVofsInMonotonePath() [2/3]

void VofUtils::getVofsInMonotonePath ( std::set< VolIndex > &  a_vofList,
const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const Box &  a_validBox,
const int &  a_radius,
const IntVect &  a_timesMoved,
const IntVect &  a_pathSign 
)
staticprotected

Get all Vofs in a monotone path. Does not move more than a_radius in any direction.

Parameters
[in,out]a_vofListList of vofs that were within the monotone path
[in]a_startVofStarting vof.
[in]a_ebisboxEBISBox.
[in]a_radiusMaximum radius.
[in]a_timesMovedNumber of times moved in any direction
[in]a_pathSignPath sign.

◆ getVofsInMonotonePath() [3/3]

void VofUtils::getVofsInMonotonePath ( Vector< VolIndex > &  a_vofList,
const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const IntVect &  a_timesMoved,
const IntVect &  a_pathSign 
)
staticprotected

Get all Vofs in a monotone path. Does not move more than a_radius in any direction.

Parameters
[in,out]a_vofListList of vofs that were within the monotone path
[in]a_startVofStarting vof.
[in]a_ebisboxEBISBox.
[in]a_radiusMaximum radius.
[in]a_timesMovedNumber of times moved in any direction
[in]a_pathSignPath sign.

◆ getVofsInQuadrant()

Vector< VolIndex > VofUtils::getVofsInQuadrant ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const RealVect &  a_normal,
const int  a_radius,
const Connectivity  a_connectivity,
const bool  a_addStartVof 
)
static

Fetch vofs in a quadrant, using a specified radius and with a specified connectivitiy between them.

Parameters
[in]a_startVofStarting Vof.
[in]a_ebisboxEBISBox.
[in]a_normalNormal vector
[in]a_radiusRadius.
[in]a_connectivityConnectivity specification (e.g. monotone path or simplyconnected)
[in]a_addStartVofIf false, a_startVof will not be included in the list.
Note
This routine will fetch in a "symmetric" quadrant if the normal vector aligns with a coordinate direction

◆ getVofsInRadius() [1/2]

Vector< VolIndex > VofUtils::getVofsInRadius ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const Connectivity  a_connectivity,
const bool  a_addStartVof 
)
static

Fetch vofs in a specified radius and with a specified connectivitiy between them.

Parameters
[in]a_startVofStarting Vof.
[in]a_ebisboxEBISBox.
[in]a_radiusRadius.
[in]a_connectivityConnectivity specification (e.g. monotone path or simplyconnected)
[in]a_addStartVofIf false, a_startVof will not be included in the list.

◆ getVofsInRadius() [2/2]

static Vector<VolIndex> VofUtils::getVofsInRadius ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const int  a_radius,
const DenseIntVectSet &  a_validCells,
const Connectivity  a_connectivity,
const bool  a_addStartVof 
)
static

Fetch vofs in a specified radius and with a specified connectivitiy between them.

Parameters
[in]a_startVofStarting Vof.
[in]a_ebisboxEBISBox.
[in]a_radiusRadius.
[in]a_validCellsValid cells to include
[in]a_connectivityConnectivity specification (e.g. monotone path or simplyconnected)
[in]a_addStartVofIf false, a_startVof will not be included in the list.

◆ getVofsInSemiCircle()

Vector< VolIndex > VofUtils::getVofsInSemiCircle ( const VolIndex &  a_startVof,
const EBISBox &  a_ebisbox,
const RealVect &  a_normal,
const int  a_radius,
const Real  a_deltaThresh,
const Connectivity  a_connectivity,
const Location::Cell  a_vofLocation,
const Location::Cell  a_cellLocation,
const bool  a_addStartVof 
)
static

Get all vofs lying in a semi-circle (sphere in 3D) from the indicated position in the starting vof.

Parameters
[in]a_startVofStarting Vof.
[in]a_ebisboxEBISBox.
[in]a_normalNormal vector
[in]a_radiusRadius.
[in]a_deltaThreshThreshold for the normal distance betw
[in]a_connectivityConnectivity specification (e.g. monotone path or simplyconnected)
[in]a_vofLocationPoint inside the current vof
[in]a_cellLocationOther cell locations to test with.
[in]a_addStartVofIf false, a_startVof will not be included in the list.
Note
This routine will fetch vofs within a_radius and discard the ones that fall on the ''wrong'' side of the semi-circle (sphere in 3D). Here, the wrong side is defined as all points (x-x0)*n < a_deltaThresh

◆ includeCells() [1/3]

void VofUtils::includeCells ( Vector< VolIndex > &  a_vofs,
const Box &  a_includeBox 
)
static

Modifies a_vofs so it only includes cells in a box.

Parameters
[in]a_vofsList of vofs to be modified
[in]a_includeBoxList of cells to be excluded.
Returns
Modifed list of vofs which are guaranteed to lie in a_box

◆ includeCells() [2/3]

void VofUtils::includeCells ( Vector< VolIndex > &  a_vofs,
const DenseIntVectSet &  a_includeIVS 
)
static

Modifies a_vofs so it only includes cells in a box.

Parameters
[in]a_vofsList of vofs to be modified
[in]a_includeIVSList of cells to be included
Returns
Modifed list of vofs which are guaranteed to lie in specified grid cells

◆ includeCells() [3/3]

void VofUtils::includeCells ( Vector< VolIndex > &  a_vofs,
const IntVectSet &  a_includeIVS 
)
static

Modifies a_vofs so it only includes cells in a box.

Parameters
[in]a_vofsList of vofs to be modified
[in]a_includeIVSList of cells to be included
Returns
Modifed list of vofs which are guaranteed to lie in specified grid cells

◆ isQuadrantWellDefined()

bool VofUtils::isQuadrantWellDefined ( const RealVect  a_normal)
staticprotected

Check if a quadrant is well-defined for a direction in space.

Parameters
[in]a_normalThe direction in space which defines the quadrant.
Returns
True if the quadrant is well defined and false otherwise.

a_normal.vectorLength(); // Idiot guard.

◆ onlyUnique()

void VofUtils::onlyUnique ( Vector< VolIndex > &  a_vofs)
static

Discard duplicates.

Parameters
[in,out]a_vofsList of Vofs
Returns
Returns the same vofs with discarded duplicates.

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