diff --git a/cpp/dolfinx/refinement/refine.cpp b/cpp/dolfinx/refinement/refine.cpp index 2b5ce85d3c..3fba0e2410 100644 --- a/cpp/dolfinx/refinement/refine.cpp +++ b/cpp/dolfinx/refinement/refine.cpp @@ -5,21 +5,18 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "refine.h" +#include -namespace dolfinx::refinement -{ +using namespace dolfinx; -graph::AdjacencyList maintain_coarse_partitioner( - MPI_Comm comm, int, const std::vector& cell_types, - const std::vector>& cells) +graph::AdjacencyList refinement::maintain_coarse_partitioner( + MPI_Comm comm, int /*nparts*/, std::vector cell_types, + std::vector> cells) { - int mpi_rank = MPI::rank(comm); int num_cell_vertices = mesh::num_cell_vertices(cell_types.front()); std::int32_t num_cells = cells.front().size() / num_cell_vertices; - std::vector destinations(num_cells, mpi_rank); + std::vector destinations(num_cells, dolfinx::MPI::rank(comm)); std::vector dest_offsets(num_cells + 1); std::iota(dest_offsets.begin(), dest_offsets.end(), 0); return graph::AdjacencyList(std::move(destinations), std::move(dest_offsets)); } - -} // namespace dolfinx::refinement diff --git a/cpp/dolfinx/refinement/refine.h b/cpp/dolfinx/refinement/refine.h index c23bc0a3c3..07a5b411a8 100644 --- a/cpp/dolfinx/refinement/refine.h +++ b/cpp/dolfinx/refinement/refine.h @@ -20,19 +20,19 @@ namespace dolfinx::refinement { - -/// @brief Partitioner that maintains the regional destribution for a refined -/// mesh. Meaning, process local data is just maintained and no redistribution -/// happens. +/// @brief Partitioner that maintains the regional distribution for a +/// refined mesh. Meaning, process local data is just maintained and no +/// redistribution happens. /// /// @param[in] comm MPI Communicator /// @param[in] nparts Number of partitions (input has no effect) /// @param[in] cell_types Cell types in the mesh /// @param[in] cells Lists of cells of each cell type. /// @return Destination ranks for each cell on this process -graph::AdjacencyList maintain_coarse_partitioner( - MPI_Comm comm, int nparts, const std::vector& cell_types, - const std::vector>& cells); +graph::AdjacencyList +maintain_coarse_partitioner(MPI_Comm comm, int nparts, + std::vector cell_types, + std::vector> cells); /// @brief Refine with markers, optionally redistributing, and /// optionally calculating the parent-child relationships. diff --git a/python/dolfinx/wrappers/refinement.cpp b/python/dolfinx/wrappers/refinement.cpp index 7921ffb22e..8bb89b7260 100644 --- a/python/dolfinx/wrappers/refinement.cpp +++ b/python/dolfinx/wrappers/refinement.cpp @@ -4,12 +4,18 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later +#include "MPICommWrapper.h" +#include "array.h" #include #include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include - #include #include #include @@ -17,26 +23,15 @@ #include #include #include - -#include -#include -#include -#include -#include -#include -#include - -#include "MPICommWrapper.h" -#include "array.h" +#include +#include namespace nb = nanobind; namespace dolfinx_wrappers { - namespace { - using PythonCellPartitionFunction = std::function( dolfinx_wrappers::MPICommWrapper, int,