Proto  3.2
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Proto::MBGraph Class Reference

Graph of a mapped multiblock domain. Nodes represent blocks and arcs represent boundaries between blocks. Does not contain any information about the size of blocks; that information is provided by MBProblemDomain. More...

#include <Proto_MBGraph.H>

Public Member Functions

 MBGraph (BlockIndex numBlocks)
 Constructor. More...
 
void defineBoundary (BlockIndex srcBlock, BlockIndex dstBlock, Point dir, CoordPermutation &rotation)
 Define Boundary. More...
 
void defineBoundary (BlockIndex srcBlock, BlockIndex dstBlock, unsigned int dir, Side::LoHiSide side, CoordPermutation &rotation)
 Define Boundary overload using dir + side syntax instead of Point. More...
 
void close ()
 executes post processing steps once all boundaries of this graph have been defined This function must be called before the graph can be used. More...
 
unsigned int numBlocks () const
 Number of blocks in the graph. More...
 
unsigned int numBoundaries (BlockIndex srcBlock, Point &dir) const
 Number of boundaries block has in direction dir. More...
 
std::vector< MBGraphArcboundaries (BlockIndex srcBlock, Point dir) const
 Retrieve a vector of arcs associated with boundaries from srcBlock in the direction dir. More...
 
std::vector< PointfullConnectivity (BlockIndex srcBlock, BlockIndex dstBlock) const
 Returns the list of all directions along which srcBlock is connected to dstBlock. If two blocks share a codimension-D boundary, this list will contain a single direction of codimension-D and all of the higher codimensional connections associated with the shared edges, corners, etc of the boundary between blocks. More...
 
Point connectivity (BlockIndex srcBlock, BlockIndex dstBlock) const
 Returns the lowest codimension direction associated with the boundary between two blocks. This direction is guaranteed to be unique since MBGraph does not support two-block topological cycles. This is the direction associated with the "true" boundary between blocks. More...
 
Point reverseArc (BlockIndex srcBlock, BlockIndex dstBlock, Point dir) const
 Returns the direction from dstBlock to srcBlock given the direction from srcBlock to dstBlock. Fails by assertion if the arc implied by the inputs is not in the graph FIXME: This should return std::optional<Point> with no value if the arc doesn't exist. More...
 
Point mirrorDirAcrossBoundary (BlockIndex srcBlock, BlockIndex dstBlock, Point dir) const
 Given a direction in srcBlock's coordinates, mirror the direction across the boundary with dstBlock and return the result in dstBlock's coordinates. If R is the coordinate rotation from srcBlock to dstBlock and dir has normal and tangential components to the boundary n and t respectively, the output is R(t) - R(n). More...
 
CoordPermutation rotation (BlockIndex srcBlock, BlockIndex dstBlock) const
 Attempts to retrieve the coordinate permutation from srcBlock to dstBlock Fails by assertion if the input blocks don't share a boundary. More...
 
BlockIndex adjacentBlock (BlockIndex srcBlock, unsigned int dir, Side::LoHiSide side) const
 Get the block adjacent to srcBlock in the specified codimension-1 direction Since the direction is codimension-1, the block - should it exist - is guaranteed to be unique. More...
 
BlockIndex adjacentBlock (BlockIndex srcBlock, Point codim1Dir) const
 Get the block adjacent to srcBlock in the specified codimension-1 direction Fails if codim1Dir.codim() != 1. More...
 
std::set< BlockIndexadjacentBlocks (BlockIndex srcBlock, Point dir) const
 Get a vector of all blocks adjacent to this block in direction dir. More...
 
bool operator== (const MBGraph &rhs) const
 Equality operator. Equality is determined by value. More...
 
bool isBlockBoundary (BlockIndex srcBlock, Point dir) const
 Determine if the block - direction pair represents the boundary of a block This function returns true if dir points to a "triple point" region even though the graph has no arcs from the node associated with srcBlock in the direction dir. More...
 
bool isTriplePoint (BlockIndex srcBlock, Point dir) const
 returns true if the specified block boundary corresponds to a "triple point". In this context, a "triple point" is a codimension-2 block boundary where exactly three blocks meet. This function is used to infer corrections that must be made when building interpolation operators in such regions. More...
 
std::vector< std::pair< Point, Point > > getTriplePointCircuits (BlockIndex srcBlock, Point dir) const
 return a list of codimension-1 direction pairs which represent "triple point circuits" two codimension-1 directions represent a circuit relative to srcBlock if srcBlock has a codimension-1 boundary in those directions with two other blocks which in turn have a codimenison-1 boundary which lies in the same logical "plane" as the two directions defining the circuit. More...
 
bool isDomainBoundary (BlockIndex srcBlock, Point dir) const
 returns true if there are no blocks adjacent to srcBlock in the direction dir. This situation is assumed to correspond to a "domain boundary" More...
 
void print () const
 prints all of the MBGraphNode objects in this graph (one for each block) More...
 

Private Member Functions

void fixRotations ()
 internal function called inside of "close" adjusts errors in the implicitly constructed coordinate permutations between blocks with high codimensional connectivity. More...
 
CoordPermutationrotation (BlockIndex srcBlock, Point dir, BlockIndex dstBlock) const
 obtain a reference to the coordinate permuation object stored in the graph. Used by "close" to fix internal boundary rotations, and not intended for public use. If you think you need to use this externally, there is probably a bug in MBGraph::close that needs addressing instead More...
 
CoordPermutationrotation (BlockIndex block, Point dir) const
 obtain a reference to the coordinate permuation object stored in the graph. Used by "close" to fix internal boundary rotations, and not intended for public use. If you think you need to use this externally, there is probably a bug in MBGraph::close that needs addressing instead More...
 
std::vector< Pointcodim2TriplePointBoundaries (BlockIndex srcBlock, Point dir) const
 for a given block - direction pair, return all of the codimension-2 boundaries that are projections of dir which also represent triple point boundaries. More...
 

Private Attributes

bool m_closed
 Has "close" been called on this. More...
 
std::vector< std::shared_ptr< MBGraphNode > > m_blocks
 The nodes of this graph. More...
 

Friends

class MBProblemDomain
 

Detailed Description

Graph of a mapped multiblock domain. Nodes represent blocks and arcs represent boundaries between blocks. Does not contain any information about the size of blocks; that information is provided by MBProblemDomain.

MBGraph stores connections of all codimensionalities between connected blocks. This means that if two blocks are connected by a codimension 1 boundary (sharing faces in R3) then the MBGraph also stores the codimension 2 boundaries associated with the faces' edges, codimension 3 boundaries associated with the faces' corners, etc. up to codimension = DIM.

MBGraph currently does not completely support configurations wherein two blocks form a topological cycle. For example, two blocks cannot have multiple codimension-1 boundaries with eachother; there must be at least one other block in the circuit for the structure to be valid.

MBGraphs usually do not need to be constructed directly, but are created implicitly when a user constructs an MBProblemDomain.

Constructor & Destructor Documentation

◆ MBGraph()

Proto::MBGraph::MBGraph ( BlockIndex  numBlocks)
inline

Constructor.

Creates an empty graph with a specified number of nodes and no connections

Member Function Documentation

◆ defineBoundary() [1/2]

void Proto::MBGraph::defineBoundary ( BlockIndex  srcBlock,
BlockIndex  dstBlock,
Point  dir,
CoordPermutation rotation 
)
inline

Define Boundary.

Adds a codimension-1 boundary to the graph. This function creates both directional arcs that are implied by the boundary (i.e. there is no need to call this function twice for each pair of connected blocks), but doing so will not corrupt the graph

Implicitly creates any codimension-2+ boundaries. This function will result in an error if a codimension-2+ boundary or invalid geometry is specified.

Cannot be called after this->close() has been called

Parameters
srcBlockBlock A
dstBlockBlock B
dirCodimension-1 direction from A to B in the coords of block A
rotationCoordinate permutation from A to B

◆ defineBoundary() [2/2]

void Proto::MBGraph::defineBoundary ( BlockIndex  srcBlock,
BlockIndex  dstBlock,
unsigned int  dir,
Side::LoHiSide  side,
CoordPermutation rotation 
)
inline

Define Boundary overload using dir + side syntax instead of Point.

◆ close()

void Proto::MBGraph::close ( )
inline

executes post processing steps once all boundaries of this graph have been defined This function must be called before the graph can be used.

Many functions of MBGraph will fail if the graph has not been closed.

One of the purposes of this function is to implicitly compute higher codimensional boundaries between blocks and the coordinate permutations associated with those connections. This process is correct for codimension-2 boundaries, but may be incorrect for codimension-3 boundaries for graphs with a non-trivial 3 dimensional structure at the time of writing - 9/2/2025

◆ numBlocks()

unsigned int Proto::MBGraph::numBlocks ( ) const
inline

Number of blocks in the graph.

References boundaries, dir, Proto::MBGraphArc::dstBlock, and Proto::MBGraphArc::srcBlock.

◆ numBoundaries()

unsigned int Proto::MBGraph::numBoundaries ( BlockIndex  srcBlock,
Point dir 
) const
inline

Number of boundaries block has in direction dir.

Parameters
srcBlocka BlockIndex
dira direction specified in the coordinates of srcBlock

◆ boundaries()

std::vector< MBGraphArc > Proto::MBGraph::boundaries ( BlockIndex  srcBlock,
Point  dir 
) const
inline

Retrieve a vector of arcs associated with boundaries from srcBlock in the direction dir.

Parameters
srcBlocka BlockIndex
dira direction specified in the coordinates of srcBlock

◆ fullConnectivity()

std::vector< Point > Proto::MBGraph::fullConnectivity ( BlockIndex  srcBlock,
BlockIndex  dstBlock 
) const
inline

Returns the list of all directions along which srcBlock is connected to dstBlock. If two blocks share a codimension-D boundary, this list will contain a single direction of codimension-D and all of the higher codimensional connections associated with the shared edges, corners, etc of the boundary between blocks.

Intended for internal use only; don't use this unless you know what you are doing.

Parameters
srcBlockThe source block of the implied boundary
dstBlockThe destination block of the implied boundary
Returns
The directions associated with the implied boundary. Empty if no boundary exists.

◆ connectivity()

Point Proto::MBGraph::connectivity ( BlockIndex  srcBlock,
BlockIndex  dstBlock 
) const
inline

Returns the lowest codimension direction associated with the boundary between two blocks. This direction is guaranteed to be unique since MBGraph does not support two-block topological cycles. This is the direction associated with the "true" boundary between blocks.

Parameters
srcBlockThe source block of the implied boundary
dstBlockThe destination block of the implied boundary
Returns
The direction (srcBlock coordinates) of the implied boundary. Returns Point::Zeros if no boundary exists. FIXME: This should return std::optional<Point> with no value if the boundary doesn't exist

◆ reverseArc()

Point Proto::MBGraph::reverseArc ( BlockIndex  srcBlock,
BlockIndex  dstBlock,
Point  dir 
) const
inline

Returns the direction from dstBlock to srcBlock given the direction from srcBlock to dstBlock. Fails by assertion if the arc implied by the inputs is not in the graph FIXME: This should return std::optional<Point> with no value if the arc doesn't exist.

Parameters
srcBlockthe source block of the implied boundary
dstBlockthe destination block of the implied boundary
dirthe direction associated with an arc from source to destination (srcBlock coordinates)
Returns
the direction along the same arc as dir from destination to source (dstBlock coordinates)

◆ mirrorDirAcrossBoundary()

Point Proto::MBGraph::mirrorDirAcrossBoundary ( BlockIndex  srcBlock,
BlockIndex  dstBlock,
Point  dir 
) const
inline

Given a direction in srcBlock's coordinates, mirror the direction across the boundary with dstBlock and return the result in dstBlock's coordinates. If R is the coordinate rotation from srcBlock to dstBlock and dir has normal and tangential components to the boundary n and t respectively, the output is R(t) - R(n).

Fails by assertion if there is no boundary between srcBlock and dstBlock

Parameters
srcBlockthe source block of the implied boundary
dstBlockthe destination block of the implied boundary
dira direction in srcBlock's coordinates
Returns
a direction corresponding to dir being mirrored across the implied boundary

◆ rotation() [1/3]

CoordPermutation Proto::MBGraph::rotation ( BlockIndex  srcBlock,
BlockIndex  dstBlock 
) const
inline

Attempts to retrieve the coordinate permutation from srcBlock to dstBlock Fails by assertion if the input blocks don't share a boundary.

Parameters
srcBlockthe source block of the implied boundary
dstBlockthe destination block of the implied boundary
Returns
the permutation from srcBlock's coordinates to dstBlock's coordinates

◆ adjacentBlock() [1/2]

BlockIndex Proto::MBGraph::adjacentBlock ( BlockIndex  srcBlock,
unsigned int  dir,
Side::LoHiSide  side 
) const
inline

Get the block adjacent to srcBlock in the specified codimension-1 direction Since the direction is codimension-1, the block - should it exist - is guaranteed to be unique.

Parameters
srcBlockthe block whose adjacency is desired
dirthe coordinate axis along which to search for an adjacency
sidethe side (high / low) to search for the adjacency on

◆ adjacentBlock() [2/2]

BlockIndex Proto::MBGraph::adjacentBlock ( BlockIndex  srcBlock,
Point  codim1Dir 
) const
inline

Get the block adjacent to srcBlock in the specified codimension-1 direction Fails if codim1Dir.codim() != 1.

Parameters
srcBlocka valid block index
codim1Dira codimension-1 direction

◆ adjacentBlocks()

std::set< BlockIndex > Proto::MBGraph::adjacentBlocks ( BlockIndex  srcBlock,
Point  dir 
) const
inline

Get a vector of all blocks adjacent to this block in direction dir.

Parameters
srcBlocka valid block index
dira direction

◆ operator==()

bool Proto::MBGraph::operator== ( const MBGraph rhs) const
inline

Equality operator. Equality is determined by value.

◆ isBlockBoundary()

bool Proto::MBGraph::isBlockBoundary ( BlockIndex  srcBlock,
Point  dir 
) const
inline

Determine if the block - direction pair represents the boundary of a block This function returns true if dir points to a "triple point" region even though the graph has no arcs from the node associated with srcBlock in the direction dir.

Parameters
srcBlocka valid block index
dira direction

◆ isTriplePoint()

bool Proto::MBGraph::isTriplePoint ( BlockIndex  srcBlock,
Point  dir 
) const
inline

returns true if the specified block boundary corresponds to a "triple point". In this context, a "triple point" is a codimension-2 block boundary where exactly three blocks meet. This function is used to infer corrections that must be made when building interpolation operators in such regions.

Example: A "Triple Point" Configuration in 2D \ \ Block 2 Block 0 >----— / Block 1 /

◆ getTriplePointCircuits()

std::vector< std::pair< Point, Point > > Proto::MBGraph::getTriplePointCircuits ( BlockIndex  srcBlock,
Point  dir 
) const

return a list of codimension-1 direction pairs which represent "triple point circuits" two codimension-1 directions represent a circuit relative to srcBlock if srcBlock has a codimension-1 boundary in those directions with two other blocks which in turn have a codimenison-1 boundary which lies in the same logical "plane" as the two directions defining the circuit.

This function is not recommended for public use.

If DIM==2, there will be at most one circuit for a given block. In higher dimensions, there will in general be many, and will result in the function being called recursively.

At the time of writing, there are no dependencies in Proto which use this function, but it is likely that it will be useful for more complex graphs. - Chris Bozhart - 9/2/2025

Parameters
srcBlockthe reference block from which the search for triple point circuits is executed
dirthe direction in which triple point circuits are searched

◆ isDomainBoundary()

bool Proto::MBGraph::isDomainBoundary ( BlockIndex  srcBlock,
Point  dir 
) const
inline

returns true if there are no blocks adjacent to srcBlock in the direction dir. This situation is assumed to correspond to a "domain boundary"

Parameters
srcBlockthe reference block from which domain boundaries are searched for
dirthe direction which constitutes the query for a domain boundary

◆ print()

void Proto::MBGraph::print ( ) const
inline

prints all of the MBGraphNode objects in this graph (one for each block)

which in turn prints all of the arcs extending from each block

◆ fixRotations()

void Proto::MBGraph::fixRotations ( )
inlineprivate

internal function called inside of "close" adjusts errors in the implicitly constructed coordinate permutations between blocks with high codimensional connectivity.

◆ rotation() [2/3]

CoordPermutation & Proto::MBGraph::rotation ( BlockIndex  srcBlock,
Point  dir,
BlockIndex  dstBlock 
) const
inlineprivate

obtain a reference to the coordinate permuation object stored in the graph. Used by "close" to fix internal boundary rotations, and not intended for public use. If you think you need to use this externally, there is probably a bug in MBGraph::close that needs addressing instead

◆ rotation() [3/3]

CoordPermutation & Proto::MBGraph::rotation ( BlockIndex  block,
Point  dir 
) const
inlineprivate

obtain a reference to the coordinate permuation object stored in the graph. Used by "close" to fix internal boundary rotations, and not intended for public use. If you think you need to use this externally, there is probably a bug in MBGraph::close that needs addressing instead

◆ codim2TriplePointBoundaries()

std::vector< Point > Proto::MBGraph::codim2TriplePointBoundaries ( BlockIndex  srcBlock,
Point  dir 
) const
inlineprivate

for a given block - direction pair, return all of the codimension-2 boundaries that are projections of dir which also represent triple point boundaries.

This function is highly experimental and not well tested. This function only has true utility for DIM >= 3. For an illustrative example of when This function has value, consider a graph of 4 blocks connected in such a way that the arcs for a tetrahedron. It is completely unused at the time of writing, but may come in handy in the future.

  • Chris Bozhart - 8/28/2025

Friends And Related Function Documentation

◆ MBProblemDomain

friend class MBProblemDomain
friend

Member Data Documentation

◆ m_closed

bool Proto::MBGraph::m_closed
private

Has "close" been called on this.

◆ m_blocks

std::vector<std::shared_ptr<MBGraphNode> > Proto::MBGraph::m_blocks
private

The nodes of this graph.


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