Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::SpatialDomains::MeshPartitionPtScotch Class Reference

#include <MeshPartitionPtScotch.h>

Inheritance diagram for Nektar::SpatialDomains::MeshPartitionPtScotch:
[legend]

Public Member Functions

 MeshPartitionPtScotch (const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)
 
 ~MeshPartitionPtScotch () override
 
- Public Member Functions inherited from Nektar::SpatialDomains::MeshPartition
 MeshPartition (const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)
 
virtual ~MeshPartition ()
 
void PartitionMesh (int nParts, bool shared=false, bool overlapping=false, int nLocal=0)
 
void PrintPartInfo (std::ostream &out)
 
void GetElementIDs (const int procid, std::vector< unsigned int > &tmp)
 

Static Public Member Functions

static MeshPartitionSharedPtr create (const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 
static std::string cmdSwitch
 

Protected Member Functions

void v_PartitionGraphImpl (int &nVerts, int &nVertConds, Nektar::Array< Nektar::OneD, int > &xadj, Nektar::Array< Nektar::OneD, int > &adjcy, Nektar::Array< Nektar::OneD, int > &vertWgt, Nektar::Array< Nektar::OneD, int > &vertSize, Nektar::Array< Nektar::OneD, int > &edgeWgt, int &nparts, int &volume, Nektar::Array< Nektar::OneD, int > &part) final
 
- Protected Member Functions inherited from Nektar::SpatialDomains::MeshPartition
void ReadExpansions ()
 
void ReadConditions ()
 
void WeightElements ()
 
void CreateGraph ()
 
void PartitionGraph (int nParts, bool overlapping=false)
 Partition the graph. More...
 
void CheckPartitions (int nParts, Array< OneD, int > &pPart)
 
int CalculateElementWeight (LibUtilities::ShapeType elmtType, bool bndWeight, int na, int nb, int nc)
 
int CalculateEdgeWeight (LibUtilities::ShapeType elmtType, int na, int nb, int nc)
 
virtual void v_PartitionGraphImpl (int &nVerts, int &nVertConds, Nektar::Array< Nektar::OneD, int > &xadj, Nektar::Array< Nektar::OneD, int > &adjcy, Nektar::Array< Nektar::OneD, int > &vertWgt, Nektar::Array< Nektar::OneD, int > &vertSize, Nektar::Array< Nektar::OneD, int > &edgeWgt, int &nparts, int &volume, Nektar::Array< Nektar::OneD, int > &part)=0
 

Additional Inherited Members

- Protected Types inherited from Nektar::SpatialDomains::MeshPartition
typedef std::vector< unsigned int > MultiWeight
 
typedef boost::adjacency_list< boost::setS, boost::vecS, boost::undirectedS, GraphVertexProperties, boost::property< boost::edge_index_t, unsigned int, GraphEdgeProperties > > BoostGraph
 
typedef boost::graph_traits< BoostGraph >::vertex_descriptor BoostVertex
 
typedef boost::graph_traits< BoostGraph >::edge_descriptor BoostEdge
 
typedef boost::graph_traits< BoostGraph >::edge_iterator BoostEdgeIterator
 
typedef boost::graph_traits< BoostGraph >::vertex_iterator BoostVertexIterator
 
typedef boost::graph_traits< BoostGraph >::adjacency_iterator BoostAdjacencyIterator
 
typedef std::vector< unsigned int > NumModes
 
typedef std::map< std::string, NumModesNummodesPerField
 
- Protected Attributes inherited from Nektar::SpatialDomains::MeshPartition
LibUtilities::SessionReaderSharedPtr m_session
 
LibUtilities::CommSharedPtr m_comm
 
int m_dim
 
int m_numFields
 
std::map< int, MeshEntitym_elements
 
std::map< int, MeshEntitym_ghostElmts
 
CompositeDescriptor m_compMap
 
std::map< int, NummodesPerFieldm_expansions
 
std::map< int, LibUtilities::ShapeTypem_shape
 
std::map< std::string, int > m_fieldNameToId
 
std::map< int, MultiWeightm_vertWeights
 
std::map< int, MultiWeightm_vertBndWeights
 
std::map< int, MultiWeightm_edgeWeights
 
BoostGraph m_graph
 
std::map< int, std::vector< unsigned int > > m_localPartition
 
bool m_weightingRequired
 
bool m_weightBnd
 
bool m_weightDofs
 
bool m_shared
 
bool m_parallel
 

Detailed Description

Definition at line 43 of file MeshPartitionPtScotch.h.

Constructor & Destructor Documentation

◆ MeshPartitionPtScotch()

Nektar::SpatialDomains::MeshPartitionPtScotch::MeshPartitionPtScotch ( const LibUtilities::SessionReaderSharedPtr  session,
LibUtilities::CommSharedPtr  comm,
int  meshDim,
std::map< int, MeshEntity element,
CompositeDescriptor  compMap 
)

Definition at line 59 of file MeshPartitionPtScotch.cpp.

63 : MeshPartition(session, comm, meshDim, element, compMap)
64{
65 m_parallel = true;
66}
MeshPartition(const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)

References Nektar::SpatialDomains::MeshPartition::m_parallel.

◆ ~MeshPartitionPtScotch()

Nektar::SpatialDomains::MeshPartitionPtScotch::~MeshPartitionPtScotch ( )
override

Definition at line 68 of file MeshPartitionPtScotch.cpp.

69{
70}

Member Function Documentation

◆ create()

static MeshPartitionSharedPtr Nektar::SpatialDomains::MeshPartitionPtScotch::create ( const LibUtilities::SessionReaderSharedPtr  session,
LibUtilities::CommSharedPtr  comm,
int  meshDim,
std::map< int, MeshEntity element,
CompositeDescriptor  compMap 
)
inlinestatic

Creates an instance of this class.

Definition at line 47 of file MeshPartitionPtScotch.h.

51 {
53 session, comm, meshDim, element, compMap);
54 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ v_PartitionGraphImpl()

void Nektar::SpatialDomains::MeshPartitionPtScotch::v_PartitionGraphImpl ( int &  nVerts,
int &  nVertConds,
Nektar::Array< Nektar::OneD, int > &  xadj,
Nektar::Array< Nektar::OneD, int > &  adjcy,
Nektar::Array< Nektar::OneD, int > &  vertWgt,
Nektar::Array< Nektar::OneD, int > &  vertSize,
Nektar::Array< Nektar::OneD, int > &  edgeWgt,
int &  nparts,
int &  volume,
Nektar::Array< Nektar::OneD, int > &  part 
)
finalprotectedvirtual

Implements Nektar::SpatialDomains::MeshPartition.

Definition at line 72 of file MeshPartitionPtScotch.cpp.

78{
80 std::dynamic_pointer_cast<LibUtilities::CommMpi>(
81 m_comm->GetSpaceComm());
82
83 ASSERTL0(mpiComm, "PtScotch not supported in serial execution.");
84
85 SCOTCH_Dgraph scGraph;
86 SCOTCH_CALL(SCOTCH_dgraphInit, (&scGraph, mpiComm->GetComm()));
87 SCOTCH_CALL(SCOTCH_dgraphBuild,
88 (&scGraph, 0, nVerts, nVerts, &xadj[0], &xadj[1], &vertWgt[0],
89 nullptr, adjcy.size(), adjcy.size(), &adjcy[0], nullptr,
90 nullptr));
91 SCOTCH_CALL(SCOTCH_dgraphCheck, (&scGraph));
92
93 SCOTCH_Strat strat;
94 SCOTCH_CALL(SCOTCH_stratInit, (&strat));
95 SCOTCH_CALL(SCOTCH_stratDgraphMapBuild,
96 (&strat, SCOTCH_STRATQUALITY, nparts, nparts, 0.05));
97
98 SCOTCH_CALL(SCOTCH_dgraphPart, (&scGraph, nparts, &strat, &part[0]));
99}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define SCOTCH_CALL(scotchFunc, args)
LibUtilities::CommSharedPtr m_comm
std::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
Definition: CommMpi.h:56

References ASSERTL0, Nektar::SpatialDomains::MeshPartition::m_comm, and SCOTCH_CALL.

Member Data Documentation

◆ className

std::string Nektar::SpatialDomains::MeshPartitionPtScotch::className
static
Initial value:
=
"Parallel partitioning using the PtScotch library.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static MeshPartitionSharedPtr create(const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)
Creates an instance of this class.
MeshPartitionFactory & GetMeshPartitionFactory()

Name of class.

Definition at line 57 of file MeshPartitionPtScotch.h.

◆ cmdSwitch

std::string Nektar::SpatialDomains::MeshPartitionPtScotch::cmdSwitch
static
Initial value:
=
"use-ptscotch", "", "Use PtScotch for parallel mesh partitioning.")
static std::string RegisterCmdLineFlag(const std::string &pName, const std::string &pShortName, const std::string &pDescription)
Registers a command-line flag with the session reader.

Definition at line 58 of file MeshPartitionPtScotch.h.