IFEM  90A354
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DomainDecomposition Class Reference

Class containing domain decomposition related partitioning. More...

#include <DomainDecomposition.h>

Collaboration diagram for DomainDecomposition:
Collaboration graph
[legend]

Classes

struct  BlockInfo
 Struct with information per matrix block. More...
 
class  OrientIterator
 Iterator for matching nodes on edges/faces with a given orientation and index. More...
 
class  SlaveOrder
 Functor to order ghost connections. More...
 

Public Member Functions

 DomainDecomposition ()
 Default constructor.
 
bool setup (const ProcessAdm &adm, const SIMbase &sim)
 Setup domain decomposition. More...
 
bool setup (const ProcessAdm &adm, const IntMat &neighs, const IntMat &meqn)
 Setup domain decomposition. More...
 
void setup (const int neq)
 Setup single-process domain decomposition. More...
 
std::vector< std::set< int > > getSubdomains (int nx, int ny, int nz, int overlap, size_t block) const
 Obtain local subdomains for an equation block. More...
 
int getMinEq (size_t idx=0) const
 Get first equation owned by this process.
 
int getMaxEq (size_t idx=0) const
 Get last equation owned by this process.
 
int getNoGlbEqs (size_t idx=0) const
 Get total number of equations in a block.
 
int getMinNode () const
 Get first node owned by this process.
 
int getMaxNode () const
 Get last node owned by this process.
 
int getMinDOF () const
 Get first DOF owned by this process.
 
int getMaxDOF () const
 Get last DOF owned by this process.
 
void setPatchOwner (size_t p, size_t owner)
 Set owner for a patch.
 
int getPatchOwner (size_t p) const
 Get process owning patch p.
 
int getGlobalEq (int lEq, size_t idx=0) const
 Get global equation number. More...
 
const IntVecgetMLGEQ (size_t idx=0) const
 Obtain local-to-global equation mapping.
 
const std::set< int > & getBlockEqs (size_t idx) const
 Obtain local-to-global equation mapping. More...
 
const std::map< int, int > & getG2LEQ (size_t idx) const
 Obtain global-to-local equation mapping. More...
 
const IntVecgetMLGN () const
 Obtain local-to-global node mapping.
 
const SAMpatchgetSAM () const
 Returns associated SAM.
 
size_t getNoBlocks () const
 Returns number of matrix blocks.
 
bool isPartitioned () const
 Returns whether a graph based partition is used.
 
const IntVecgetElms () const
 Returns elements in partition.
 
void setElms (const IntVec &elms, const std::string &save)
 Set elements in partition.
 
void clear ()
 Clear out partitioning information.
 

Static Public Member Functions

static IntMat calcSubdomains (size_t nel1, size_t nel2, size_t nel3, size_t g1, size_t g2, size_t g3, size_t overlap)
 Calculates subdomains with a given overlap. More...
 

Public Attributes

std::set< ASM::Interface, SlaveOrderghostConnections
 Connections to other processes.
 

Private Member Functions

bool calcGlobalNodeNumbers (const ProcessAdm &adm, const SIMbase &sim)
 Calculate the global node numbers for given finite element model.
 
bool calcGlobalEqNumbers (const ProcessAdm &adm, const SIMbase &sim)
 Calculate the global equation numbers for an element model.
 
template<class Callback >
bool calcGlobalEqNumbersPart (const ProcessAdm &adm, const Callback &cb)
 Calculate the global equation numbers for a partitioned model.
 
bool sanityCheckCorners (const SIMbase &sim)
 Sanity check model. More...
 
bool graphPartition (const ProcessAdm &adm, const IntMat &neigh)
 Setup domain decomposition based on graph partitioning.
 

Static Private Member Functions

static IntMat calcSubdomains1D (size_t nel1, size_t g1, size_t overlap)
 Calculates a 1D partitioning with a given overlap. More...
 
static IntMat calcSubdomains2D (size_t nel1, size_t nel2, size_t g1, size_t g2, size_t overlap)
 Calculates 2D subdomains with a given overlap. More...
 
static IntMat calcSubdomains3D (size_t nel1, size_t nel2, size_t nel3, size_t g1, size_t g2, size_t g3, size_t overlap)
 Calculates 3D subdomains with a given overlap. More...
 

Private Attributes

std::map< int, int > patchOwner
 Process that owns a particular patch.
 
IntVec MLGN
 Process-local-to-global node numbers.
 
std::vector< BlockInfoblocks
 Equation mappings for all matrix blocks.
 
IntVec myElms
 Elements in partition.
 
int minDof = 0
 First DOF we own.
 
int maxDof = 0
 Last DOF we own.
 
int minNode = 0
 First node we own.
 
int maxNode = 0
 Last node we own.
 
const SAMpatchsam = nullptr
 The assembly handler the DD is constructed for.
 
std::string savePart
 Non-empty to save partitioning to file.
 

Detailed Description

Class containing domain decomposition related partitioning.

Member Function Documentation

◆ calcSubdomains()

IntMat DomainDecomposition::calcSubdomains ( size_t  nel1,
size_t  nel2,
size_t  nel3,
size_t  g1,
size_t  g2,
size_t  g3,
size_t  overlap 
)
static

Calculates subdomains with a given overlap.

Parameters
[in]nel1Number of knot-spans in first parameter direction.
[in]nel2Number of knot-spans in second parameter direction.
[in]nel3Number of knot-spans in third parameter direction.
[in]g1Number of subdomains in first parameter direction.
[in]g2Number of subdomains in second parameter direction.
[in]g3Number of subdomains in third parameter direction.
[in]overlapOverlap of subdomains.

nel values determine the dimensionality.

References calcSubdomains1D(), calcSubdomains2D(), and calcSubdomains3D().

Referenced by getSubdomains().

◆ calcSubdomains1D()

IntMat DomainDecomposition::calcSubdomains1D ( size_t  nel1,
size_t  g1,
size_t  overlap 
)
staticprivate

Calculates a 1D partitioning with a given overlap.

Parameters
[in]nel1Number of knot-spans in first parameter direction.
[in]g1Number of subdomains in first parameter direction.
[in]overlapOverlap of subdomains.

Referenced by calcSubdomains().

◆ calcSubdomains2D()

IntMat DomainDecomposition::calcSubdomains2D ( size_t  nel1,
size_t  nel2,
size_t  g1,
size_t  g2,
size_t  overlap 
)
staticprivate

Calculates 2D subdomains with a given overlap.

Parameters
[in]nel1Number of knot-spans in first parameter direction.
[in]nel2Number of knot-spans in second parameter direction.
[in]g1Number of subdomains in first parameter direction.
[in]g2Number of subdomains in second parameter direction.
[in]overlapOverlap of subdomains.

Referenced by calcSubdomains().

◆ calcSubdomains3D()

IntMat DomainDecomposition::calcSubdomains3D ( size_t  nel1,
size_t  nel2,
size_t  nel3,
size_t  g1,
size_t  g2,
size_t  g3,
size_t  overlap 
)
staticprivate

Calculates 3D subdomains with a given overlap.

Parameters
[in]nel1Number of knot-spans in first parameter direction.
[in]nel2Number of knot-spans in second parameter direction.
[in]nel3Number of knot-spans in third parameter direction.
[in]g1Number of subdomains in first parameter direction.
[in]g2Number of subdomains in second parameter direction.
[in]g3Number of subdomains in third parameter direction.
[in]overlapOverlap of subdomains.

Referenced by calcSubdomains().

◆ getBlockEqs()

const std::set<int>& DomainDecomposition::getBlockEqs ( size_t  idx) const
inline

◆ getG2LEQ()

const std::map<int,int>& DomainDecomposition::getG2LEQ ( size_t  idx) const
inline

Obtain global-to-local equation mapping.

Parameters
idxBlock equation index

References blocks.

Referenced by _eig_ax(), ISTL::BlockPreconditioner::BlockPreconditioner(), eig_sol_(), SAMpatchPETSc::expandSolution(), PETScMatrix::setupGlb2Blk(), and PETScMatrix::solveEig().

◆ getGlobalEq()

int DomainDecomposition::getGlobalEq ( int  lEq,
size_t  idx = 0 
) const

Get global equation number.

Parameters
lEqLocal equation number
idxBlock to get index for

References blocks.

Referenced by _eig_ax(), PETScMatrix::add(), PETScVectors::assemble(), eig_sol_(), PETScVector::endAssembly(), PETScMatrix::initAssembly(), PETScSolParams::setupAdditiveSchwarz(), PETScMatrix::setupGlb2Blk(), and ISTLSolParams::setupPC().

◆ getSubdomains()

std::vector< std::set< int > > DomainDecomposition::getSubdomains ( int  nx,
int  ny,
int  nz,
int  overlap,
size_t  block 
) const

Obtain local subdomains for an equation block.

Parameters
nxNumber of domains in x
nyNumber of domains in y
nzNumber of domains in z
overlapOverlap
blockBlock to obtain equations for
Returns
Vector with equations on each subdomain

References blocks, calcSubdomains(), SAM::getElmEqns(), SAM::getElmNodes(), getNoBlocks(), SAM::getNodeEqns(), SAM::getNodeType(), ASMstruct::getNoStructElms(), and getSAM().

Referenced by PETScSolParams::setupAdditiveSchwarz(), and ISTLSolParams::setupPCInternal().

◆ sanityCheckCorners()

bool DomainDecomposition::sanityCheckCorners ( const SIMbase sim)
private

◆ setup() [1/3]

void DomainDecomposition::setup ( const int  neq)

Setup single-process domain decomposition.

neq Number of equations

References blocks.

◆ setup() [2/3]

bool DomainDecomposition::setup ( const ProcessAdm adm,
const IntMat neighs,
const IntMat meqn 
)

Setup domain decomposition.

Parameters
[in]admProcess administrator to setup dd across
[in]neighsElement connection graph for model
[in]meqnMatrix of element equation numbers

References blocks, calcGlobalEqNumbersPart(), IFEM::cout, getMaxEq(), getMinEq(), ProcessAdm::getNoProcs(), ProcessAdm::getProcId(), graphPartition(), and ProcessAdm::isParallel().

◆ setup() [3/3]

bool DomainDecomposition::setup ( const ProcessAdm adm,
const SIMbase sim 
)

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