16#include <fmt/format.h>
18int main(
int argc,
char *argv[]) {
23 util::io::print(fmt::format(
"Initialized MPI. MPI size = {}, MPI rank = {}\n", mpiSize, mpiRank));
32 <<
") -o <0 to perform basic test, 1 on uniform mesh and 2 to test on user mesh> -n <grid-size> -p <number-partitions> -m <horizon-integer-factor> -f <mesh-filename>" << std::endl;
33 std::cout <<
"To perform basic test" << std::endl;
34 std::cout << argv[0] <<
" -o 0" << std::endl;
35 std::cout <<
"To test on uniform mesh" << std::endl;
36 std::cout << argv[0] <<
" -o 1 -p 4 -m 4 -n 10 " << std::endl;
37 std::cout <<
"To test on user-provided mesh (filename = filepath/meshfile.vtu)" << std::endl;
38 std::cout << argv[0] <<
" -o 2 -p 4 -m 4 -f filepath/meshfile.vtu" << std::endl;
43 size_t testOption, nGrid(0), nPart, mHorizon;
44 std::string meshFilename(
"");
48 std::cerr <<
"Test requires following arguments -o <option integer> -n <grid-size> -p <number-partition> -m <horizon-integer-factor> -f <mesh-filename>\n";
52 if (testOption == 0) {
53 std::cout <<
"testMeshPartitioning: Simple test of metis graph partitioning\n\n";
55 }
else if (testOption == 1 or testOption == 2) {
61 if (testOption == 1) {
63 std::cout <<
"Running test with default grid size = "
64 << nGrid << std::endl;
72 std::cout <<
"Running test with default number of partitions = "
73 << nPart << std::endl;
81 std::cout <<
"Running test with default integer factor for horizon = "
82 << mHorizon << std::endl;
88 if ((nGrid > 0 and testOption == 2) or
89 (!meshFilename.empty() and testOption == 1)) {
91 <<
"Please specify either using uniform mesh (in-built) or user-defined mesh "
92 "to perform the partitioning test. "
93 "That is, either specify '-o 1 -n <grid-size>' "
94 "or '-o 2 -f <mesh-filename>'.\n";
100 <<
"\n\ntestMeshPartitioning: Test of metis graph partitioning on 2-D mesh with nonlocal interaction\n\n";
104 std::cout <<
"Invalid option -o argument.\n";
size_t const MINOR_VERSION
size_t const UPDATE_VERSION
size_t const MAJOR_VERSION
void testGraphPartitioningSimple()
Tests metis partitioning of graph.
void testGraphPartitioning(size_t nPart=4, size_t nGrid=10, size_t mHorizon=3, size_t testOption=0, std::string meshFilename="")
Tests metis partitioning of graph from a 2-D mesh with nonlocal interaction.
void print(const T &msg, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
Prints formatted information.
const MpiStatus * getMpiStatus()
Returns pointer to MpiStatus struct.
void initMpi(int argc=0, char *argv[]=nullptr)
Initializes MPI and also creates MpiStatus struct.
int mpiSize()
Get size (number) of processors.
int mpiRank()
get rank (id) of this processor