35 #include <boost/core/ignore_unused.hpp>
42 #define SCOTCH_CALL(scotchFunc, args) \
44 ASSERTL0(scotchFunc args == 0, \
45 std::string("Error in Scotch calling function ") \
46 + std::string(#scotchFunc)); \
51 namespace SpatialDomains
57 "Parallel partitioning using the PtScotch library.");
61 "use-ptscotch",
"",
"Use PtScotch for parallel mesh partitioning.");
67 std::map<int, MeshEntity> element,
86 boost::ignore_unused(nVertConds, vertSize, edgeWgt, volume);
91 ASSERTL0(mpiComm,
"PtScotch not supported in serial execution.");
93 SCOTCH_Dgraph scGraph;
94 SCOTCH_CALL(SCOTCH_dgraphInit, (&scGraph, mpiComm->GetComm()));
96 (&scGraph, 0, nVerts, nVerts, &xadj[0], &xadj[1], &vertWgt[0],
97 NULL, adjcy.size(), adjcy.size(),
98 &adjcy[0], NULL, NULL));
104 (&strat, SCOTCH_STRATQUALITY, nparts, nparts, 0.05));
106 SCOTCH_CALL(SCOTCH_dgraphPart, (&scGraph, nparts, &strat, &part[0]));
#define ASSERTL0(condition, msg)
#define SCOTCH_CALL(scotchFunc, args)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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.
LibUtilities::CommSharedPtr m_comm
static std::string cmdSwitch
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.
virtual void 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)
static std::string className
Name of class.
MeshPartitionPtScotch(const LibUtilities::SessionReaderSharedPtr session, LibUtilities::CommSharedPtr comm, int meshDim, std::map< int, MeshEntity > element, CompositeDescriptor compMap)
virtual ~MeshPartitionPtScotch()
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
MeshPartitionFactory & GetMeshPartitionFactory()
The above copyright notice and this permission notice shall be included.