Skip to content
Snippets Groups Projects
Commit 41f2fbec authored by Tom Fischer's avatar Tom Fischer
Browse files

[A/U/MP] 'Partition' mesh into one partition.

Useful for debug purposes and scalability measurements.
parent 4eb53ba6
No related branches found
No related tags found
No related merge requests found
...@@ -86,6 +86,9 @@ int main(int argc, char* argv[]) ...@@ -86,6 +86,9 @@ int main(int argc, char* argv[])
mesh_ptr->getNumberOfNodes(), mesh_ptr->getNumberOfNodes(),
mesh_ptr->getNumberOfElements()); mesh_ptr->getNumberOfElements());
std::size_t const number_of_nodes(mesh_ptr->getNumberOfNodes());
std::size_t const number_of_elements(mesh_ptr->getNumberOfElements());
ApplicationUtils::NodeWiseMeshPartitioner mesh_partitioner( ApplicationUtils::NodeWiseMeshPartitioner mesh_partitioner(
nparts.getValue(), std::move(mesh_ptr)); nparts.getValue(), std::move(mesh_ptr));
...@@ -119,6 +122,25 @@ int main(int argc, char* argv[]) ...@@ -119,6 +122,25 @@ int main(int argc, char* argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
else if (num_partitions == 1 && exe_metis_flag.getValue())
{
// The mpmetis tool can not be used for 'partitioning' in only one
// domain. For this reason the according files are written for just
// one domain in the metis output format in the following.
auto writePartitionFile = [&file_name_base](
std::string const& file_name_extension, std::size_t number) {
std::string const name(file_name_base + file_name_extension);
std::ofstream os(name);
if (!os)
OGS_FATAL("Couldn't open file '%s' for writing.",
name.c_str())
for (std::size_t n(0); n < number; ++n)
os << "0\n";
};
writePartitionFile(".mesh.npart.1", number_of_nodes);
writePartitionFile(".mesh.epart.1", number_of_elements);
}
mesh_partitioner.readMetisData(file_name_base); mesh_partitioner.readMetisData(file_name_base);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment