From: Martin Kronbichler Date: Mon, 20 Jun 2022 07:28:15 +0000 (+0200) Subject: Reduce header inclusions of index_set.h in evaluation_kernels X-Git-Tag: v9.5.0-rc1~1167^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f14a86f6d19fd8f5120cb10d7bbdcc3c2ded58d8;p=dealii.git Reduce header inclusions of index_set.h in evaluation_kernels --- diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index f2961e2784..f89e80b42d 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -19,10 +19,10 @@ #include #include -#include #include #include #include +#include #include @@ -116,9 +116,10 @@ namespace Utilities * return the @p my_partition_id 's IndexSet. */ IndexSet - create_evenly_distributed_partitioning(const unsigned int my_partition_id, - const unsigned int n_partitions, - const IndexSet::size_type total_size); + create_evenly_distributed_partitioning( + const unsigned int my_partition_id, + const unsigned int n_partitions, + const types::global_dof_index total_size); /** * A namespace for utility functions that abstract certain operations using @@ -485,8 +486,9 @@ namespace Utilities * starts at the index one larger than the last one stored on process p. */ std::vector - create_ascending_partitioning(const MPI_Comm & comm, - const IndexSet::size_type locally_owned_size); + create_ascending_partitioning( + const MPI_Comm & comm, + const types::global_dof_index locally_owned_size); /** * Given the total number of elements @p total_size, create an evenly @@ -497,8 +499,8 @@ namespace Utilities */ IndexSet create_evenly_distributed_partitioning( - const MPI_Comm & comm, - const IndexSet::size_type total_size); + const MPI_Comm & comm, + const types::global_dof_index total_size); #ifdef DEAL_II_WITH_MPI /** diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index 9efe87266f..52f40f3071 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -21,12 +21,10 @@ #include #include -#include #include #include #include -#include #include #include @@ -48,6 +46,8 @@ namespace internal template struct FPArrayComparator; + + struct TaskInfo; } // namespace MatrixFreeFunctions } // namespace internal @@ -62,6 +62,14 @@ class TriaIterator; template class DoFCellAccessor; +namespace Utilities +{ + namespace MPI + { + class Partitioner; + } +} // namespace Utilities + #endif namespace internal diff --git a/include/deal.II/matrix_free/fe_evaluation_data.h b/include/deal.II/matrix_free/fe_evaluation_data.h index f4cbf4fdc2..abd3f0e70c 100644 --- a/include/deal.II/matrix_free/fe_evaluation_data.h +++ b/include/deal.II/matrix_free/fe_evaluation_data.h @@ -33,7 +33,6 @@ #include #include #include -#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/matrix_free/task_info.h b/include/deal.II/matrix_free/task_info.h index bb0851818e..4cf5147256 100644 --- a/include/deal.II/matrix_free/task_info.h +++ b/include/deal.II/matrix_free/task_info.h @@ -21,8 +21,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/include/deal.II/matrix_free/vector_data_exchange.h b/include/deal.II/matrix_free/vector_data_exchange.h index 1ce25e4507..6a2e349740 100644 --- a/include/deal.II/matrix_free/vector_data_exchange.h +++ b/include/deal.II/matrix_free/vector_data_exchange.h @@ -20,11 +20,28 @@ #include -#include +#include +#include + +#include DEAL_II_NAMESPACE_OPEN +#ifndef DOXYGEN + +// forward declaration +namespace Utilities +{ + namespace MPI + { + class Partitioner; + } +} // namespace Utilities + +#endif + + namespace internal { namespace MatrixFreeFunctions diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 6678a8cc10..9c7eec0362 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -71,10 +71,15 @@ DEAL_II_NAMESPACE_OPEN namespace Utilities { IndexSet - create_evenly_distributed_partitioning(const unsigned int my_partition_id, - const unsigned int n_partitions, - const IndexSet::size_type total_size) + create_evenly_distributed_partitioning( + const unsigned int my_partition_id, + const unsigned int n_partitions, + const types::global_dof_index total_size) { + static_assert( + std::is_same::value, + "IndexSet::size_type must match types::global_dof_index for " + "using this function"); const unsigned int remain = total_size % n_partitions; const IndexSet::size_type min_size = total_size / n_partitions; @@ -214,9 +219,14 @@ namespace Utilities std::vector - create_ascending_partitioning(const MPI_Comm & comm, - const IndexSet::size_type locally_owned_size) + create_ascending_partitioning( + const MPI_Comm & comm, + const types::global_dof_index locally_owned_size) { + static_assert( + std::is_same::value, + "IndexSet::size_type must match types::global_dof_index for " + "using this function"); const unsigned int n_proc = n_mpi_processes(comm); const std::vector sizes = all_gather(comm, locally_owned_size); @@ -238,8 +248,9 @@ namespace Utilities IndexSet - create_evenly_distributed_partitioning(const MPI_Comm & comm, - const IndexSet::size_type total_size) + create_evenly_distributed_partitioning( + const MPI_Comm & comm, + const types::global_dof_index total_size) { const unsigned int this_proc = this_mpi_process(comm); const unsigned int n_proc = n_mpi_processes(comm); @@ -663,15 +674,17 @@ namespace Utilities std::vector - create_ascending_partitioning(const MPI_Comm & /*comm*/, - const IndexSet::size_type locally_owned_size) + create_ascending_partitioning( + const MPI_Comm & /*comm*/, + const types::global_dof_index locally_owned_size) { return std::vector(1, complete_index_set(locally_owned_size)); } IndexSet - create_evenly_distributed_partitioning(const MPI_Comm & /*comm*/, - const IndexSet::size_type total_size) + create_evenly_distributed_partitioning( + const MPI_Comm & /*comm*/, + const types::global_dof_index total_size) { return complete_index_set(total_size); } diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index 4c9745516d..12f6661f34 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include