I am coding up a parallel algorithm in which each processor has a copy of a mesh. Each processor then identifies a subset of the cells in this coarse mesh as its 'home domain.' The home domains should be distinct and cover the whole coarse mesh.
I want to know how I can partition the mesh on each processor to identify home domains by leveraging the mesh partitioning already implemented in fenics. It is as if I want to parallelize a local mesh: I want to calculate which cells should be owned by each processor, but don't want to actually redistribute these cells.
Bellow is a minimal working example for what I'm trying right now (I'm running on 4 mpi processes). This does not give the desired result, however: cell_partition ends up only splitting the mesh between 2 processes in each case (e.g. on rank 0, the mesh is partitioned between only ranks 0 and 1). Is there a way to tweak this to get what I want (or a different way altogether which works better)?
Thanks.
// Initialize some coarse mesh on each processor
UnitSquareMesh mesh(MPI_COMM_SELF,2,2);
// Get partitioning of this coarse mesh to determine home turf
SCOTCH scotch;
std::vector<std::size_t> cell_partition;
std::map<std::size_t, dolfin::Set<unsigned int>> ghost_procs;
LocalMeshData mesh_data(MPI_COMM_WORLD);
mesh_data.extract_mesh_data(mesh);
scotch.compute_partition(MPI_COMM_WORLD, cell_partition, ghost_procs, mesh_data);