From 741a44081b5eb023313304c6ebeedfdb626f4da2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 17 Apr 2023 13:46:43 -0600 Subject: [PATCH] Add 'requires' clauses to the rest of the triangulation classes. --- include/deal.II/base/template_constraints.h | 3 + .../distributed/fully_distributed_tria.h | 1 + include/deal.II/distributed/p4est_wrappers.h | 1 + include/deal.II/distributed/shared_tria.h | 9 +- include/deal.II/distributed/tria.h | 3 + include/deal.II/distributed/tria_base.h | 1 + include/deal.II/grid/grid_tools.h | 1 + source/distributed/fully_distributed_tria.cc | 72 +++--- source/distributed/shared_tria.cc | 67 +++--- source/distributed/tria.cc | 211 ++++++++++-------- source/distributed/tria_base.cc | 160 +++++++------ 11 files changed, 305 insertions(+), 224 deletions(-) diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 15392d1b28..da9ba16131 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -837,16 +837,19 @@ namespace parallel namespace distributed { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation; } namespace shared { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation; } namespace fullydistributed { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation; } } // namespace parallel diff --git a/include/deal.II/distributed/fully_distributed_tria.h b/include/deal.II/distributed/fully_distributed_tria.h index 7339de6b52..87c93a3a83 100644 --- a/include/deal.II/distributed/fully_distributed_tria.h +++ b/include/deal.II/distributed/fully_distributed_tria.h @@ -107,6 +107,7 @@ namespace parallel * GridTools::collect_periodic_faces()) are supported. */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation : public parallel::DistributedTriangulationBase { diff --git a/include/deal.II/distributed/p4est_wrappers.h b/include/deal.II/distributed/p4est_wrappers.h index 44d3a8c1a7..c3c46f84e8 100644 --- a/include/deal.II/distributed/p4est_wrappers.h +++ b/include/deal.II/distributed/p4est_wrappers.h @@ -47,6 +47,7 @@ namespace parallel namespace distributed { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation; } } // namespace parallel diff --git a/include/deal.II/distributed/shared_tria.h b/include/deal.II/distributed/shared_tria.h index e3830e8ed1..86897e3097 100644 --- a/include/deal.II/distributed/shared_tria.h +++ b/include/deal.II/distributed/shared_tria.h @@ -103,6 +103,7 @@ namespace parallel * @ingroup distributed */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation : public dealii::parallel::TriangulationBase { @@ -402,10 +403,13 @@ namespace parallel true_level_subdomain_ids_of_cells; }; + + template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) template - void - Triangulation::load(Archive &ar, const unsigned int version) + void Triangulation::load(Archive & ar, + const unsigned int version) { dealii::Triangulation::load(ar, version); partition(); @@ -428,6 +432,7 @@ namespace parallel * MPI is not available. */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation : public dealii::parallel::TriangulationBase { diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index ccb7e18a2f..e23b2a9358 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -242,6 +242,7 @@ namespace parallel * @ingroup distributed */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation : public dealii::parallel::DistributedTriangulationBase { @@ -852,6 +853,7 @@ namespace parallel * all this class does is throw an exception. */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) class Triangulation<1, spacedim> : public dealii::parallel::DistributedTriangulationBase<1, spacedim> { @@ -992,6 +994,7 @@ namespace parallel * p4est is not available. */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation : public dealii::parallel::DistributedTriangulationBase { diff --git a/include/deal.II/distributed/tria_base.h b/include/deal.II/distributed/tria_base.h index 012de34920..d6575b8e4d 100644 --- a/include/deal.II/distributed/tria_base.h +++ b/include/deal.II/distributed/tria_base.h @@ -430,6 +430,7 @@ namespace parallel * @endcode */ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class DistributedTriangulationBase : public dealii::parallel::TriangulationBase { diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index f78f1e2c22..c418ac2aad 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -77,6 +77,7 @@ namespace parallel namespace distributed { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) class Triangulation; } } // namespace parallel diff --git a/source/distributed/fully_distributed_tria.cc b/source/distributed/fully_distributed_tria.cc index 361af19d8b..5f158e268e 100644 --- a/source/distributed/fully_distributed_tria.cc +++ b/source/distributed/fully_distributed_tria.cc @@ -44,6 +44,7 @@ namespace parallel namespace fullydistributed { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) Triangulation::Triangulation( const MPI_Comm &mpi_communicator) : parallel::DistributedTriangulationBase(mpi_communicator) @@ -60,8 +61,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const TriangulationDescription::Description &construction_data) { @@ -217,8 +218,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const std::vector> & vertices, const std::vector> &cells, const SubCellData & subcelldata) @@ -246,8 +247,8 @@ namespace parallel template - void - Triangulation::copy_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::copy_triangulation( const dealii::Triangulation &other_tria) { // pointer to the triangulation for which the construction data @@ -295,8 +296,8 @@ namespace parallel template - void - Triangulation::set_partitioner( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::set_partitioner( const std::function &, const unsigned int)> &partitioner, const TriangulationDescription::Settings & settings) @@ -308,8 +309,8 @@ namespace parallel template - void - Triangulation::set_partitioner( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::set_partitioner( const RepartitioningPolicyTools::Base &partitioner, const TriangulationDescription::Settings & settings) { @@ -320,8 +321,8 @@ namespace parallel template - void - Triangulation::repartition() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::repartition() { // signal that repartitioning has started this->signals.pre_distributed_repartition(); @@ -348,8 +349,8 @@ namespace parallel template - void - Triangulation::execute_coarsening_and_refinement() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::execute_coarsening_and_refinement() { Assert(false, ExcNotImplemented()); } @@ -357,8 +358,8 @@ namespace parallel template - bool - Triangulation::prepare_coarsening_and_refinement() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::prepare_coarsening_and_refinement() { Assert( currently_processing_prepare_coarsening_and_refinement_for_internal_usage, @@ -371,8 +372,8 @@ namespace parallel template - std::size_t - Triangulation::memory_consumption() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::size_t Triangulation::memory_consumption() const { const std::size_t mem = this->dealii::parallel::TriangulationBase:: @@ -387,8 +388,9 @@ namespace parallel template - bool - Triangulation::is_multilevel_hierarchy_constructed() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::is_multilevel_hierarchy_constructed() + const { return ( settings & @@ -398,9 +400,10 @@ namespace parallel template - unsigned int - Triangulation::coarse_cell_id_to_coarse_cell_index( - const types::coarse_cell_id coarse_cell_id) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int Triangulation:: + coarse_cell_id_to_coarse_cell_index( + const types::coarse_cell_id coarse_cell_id) const { const auto coarse_cell_index = std::lower_bound( coarse_cell_id_to_coarse_cell_index_vector.begin(), @@ -417,9 +420,10 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::coarse_cell_id - Triangulation::coarse_cell_index_to_coarse_cell_id( - const unsigned int coarse_cell_index) const + Triangulation::coarse_cell_index_to_coarse_cell_id( + const unsigned int coarse_cell_index) const { AssertIndexRange(coarse_cell_index, coarse_cell_index_to_coarse_cell_id_vector.size()); @@ -433,8 +437,8 @@ namespace parallel template - void - Triangulation::update_cell_relations() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::update_cell_relations() { // Reorganize memory for local_cell_relations. this->local_cell_relations.clear(); @@ -449,8 +453,8 @@ namespace parallel template - void - Triangulation::save(const std::string &filename) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::save(const std::string &filename) const { #ifdef DEAL_II_WITH_MPI AssertThrow(this->cell_attached_data.pack_callbacks_variable.size() == 0, @@ -590,8 +594,8 @@ namespace parallel template - void - Triangulation::load(const std::string &filename) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::load(const std::string &filename) { #ifdef DEAL_II_WITH_MPI Assert(this->n_cells() == 0, @@ -735,9 +739,9 @@ namespace parallel template - void - Triangulation::load(const std::string &filename, - const bool autopartition) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::load(const std::string &filename, + const bool autopartition) { (void)autopartition; load(filename); diff --git a/source/distributed/shared_tria.cc b/source/distributed/shared_tria.cc index f111aa38fe..e4982a5adb 100644 --- a/source/distributed/shared_tria.cc +++ b/source/distributed/shared_tria.cc @@ -39,6 +39,7 @@ namespace parallel namespace shared { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) Triangulation::Triangulation( const MPI_Comm &mpi_communicator, const typename dealii::Triangulation::MeshSmoothing @@ -73,8 +74,9 @@ namespace parallel template - bool - Triangulation::is_multilevel_hierarchy_constructed() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::is_multilevel_hierarchy_constructed() + const { return (settings & construct_multigrid_hierarchy); } @@ -82,8 +84,8 @@ namespace parallel template - void - Triangulation::partition() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::partition() { # ifdef DEBUG // Check that all meshes are the same (or at least have the same @@ -318,8 +320,8 @@ namespace parallel template - bool - Triangulation::with_artificial_cells() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::with_artificial_cells() const { return allow_artificial_cells; } @@ -327,8 +329,9 @@ namespace parallel template - const std::vector & - Triangulation::get_true_subdomain_ids_of_cells() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_true_subdomain_ids_of_cells() const { return true_subdomain_ids_of_cells; } @@ -336,9 +339,10 @@ namespace parallel template - const std::vector & - Triangulation::get_true_level_subdomain_ids_of_cells( - const unsigned int level) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_true_level_subdomain_ids_of_cells( + const unsigned int level) const { Assert(level < true_level_subdomain_ids_of_cells.size(), ExcInternalError()); @@ -351,8 +355,8 @@ namespace parallel template - void - Triangulation::execute_coarsening_and_refinement() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::execute_coarsening_and_refinement() { // make sure that all refinement/coarsening flags are the same on all // processes @@ -422,8 +426,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const std::vector> &vertices, const std::vector> & cells, const SubCellData & subcelldata) @@ -448,8 +452,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const TriangulationDescription::Description &construction_data) { @@ -461,8 +465,8 @@ namespace parallel template - void - Triangulation::copy_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::copy_triangulation( const dealii::Triangulation &other_tria) { Assert( @@ -487,23 +491,29 @@ namespace parallel namespace shared { template - bool - Triangulation::with_artificial_cells() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::with_artificial_cells() const { Assert(false, ExcNotImplemented()); return true; } + + template - bool - Triangulation::is_multilevel_hierarchy_constructed() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::is_multilevel_hierarchy_constructed() + const { return false; } + + template - const std::vector & - Triangulation::get_true_subdomain_ids_of_cells() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_true_subdomain_ids_of_cells() const { Assert(false, ExcNotImplemented()); return true_subdomain_ids_of_cells; @@ -512,9 +522,10 @@ namespace parallel template - const std::vector & - Triangulation::get_true_level_subdomain_ids_of_cells( - const unsigned int) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_true_level_subdomain_ids_of_cells( + const unsigned int) const { Assert(false, ExcNotImplemented()); return true_level_subdomain_ids_of_cells; diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 437362557d..e43caf145c 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1696,6 +1696,7 @@ namespace parallel { /*----------------- class Triangulation ---------------\*/ template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) Triangulation::Triangulation( const MPI_Comm &mpi_communicator, const typename dealii::Triangulation::MeshSmoothing @@ -1724,6 +1725,7 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) Triangulation::~Triangulation() { // virtual functions called in constructors and destructors never use the @@ -1744,8 +1746,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const std::vector> &vertices, const std::vector> & cells, const SubCellData & subcelldata) @@ -1797,8 +1799,8 @@ namespace parallel template - void - Triangulation::create_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::create_triangulation( const TriangulationDescription::Description &construction_data) { @@ -1810,8 +1812,8 @@ namespace parallel template - void - Triangulation::clear() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::clear() { triangulation_has_content = false; @@ -1846,8 +1848,9 @@ namespace parallel template - bool - Triangulation::is_multilevel_hierarchy_constructed() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::is_multilevel_hierarchy_constructed() + const { return settings & Triangulation::construct_multigrid_hierarchy; @@ -1856,8 +1859,9 @@ namespace parallel template - bool - Triangulation::are_vertices_communicated_to_p4est() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::are_vertices_communicated_to_p4est() + const { return settings & Triangulation::communicate_vertices_to_p4est; @@ -1866,8 +1870,8 @@ namespace parallel template - void - Triangulation::execute_transfer( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::execute_transfer( const typename dealii::internal::p4est::types::forest *parallel_forest, const typename dealii::internal::p4est::types::gloidx @@ -1961,8 +1965,9 @@ namespace parallel template - void - Triangulation::setup_coarse_cell_to_p4est_tree_permutation() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::setup_coarse_cell_to_p4est_tree_permutation() { DynamicSparsityPattern cell_connectivity; dealii::GridTools::get_vertex_connectivity_of_cells(*this, @@ -1978,8 +1983,8 @@ namespace parallel template - void - Triangulation::write_mesh_vtk( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::write_mesh_vtk( const std::string &file_basename) const { Assert(parallel_forest != nullptr, @@ -1997,8 +2002,8 @@ namespace parallel template - void - Triangulation::save(const std::string &filename) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::save(const std::string &filename) const { Assert( this->cell_attached_data.n_attached_deserialize == 0, @@ -2052,8 +2057,8 @@ namespace parallel template - void - Triangulation::load(const std::string &filename) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::load(const std::string &filename) { Assert( this->n_cells() > 0, @@ -2152,9 +2157,9 @@ namespace parallel template - void - Triangulation::load(const std::string &filename, - const bool autopartition) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::load(const std::string &filename, + const bool autopartition) { (void)autopartition; load(filename); @@ -2163,8 +2168,8 @@ namespace parallel template - void - Triangulation::load( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::load( const typename dealii::internal::p4est::types::forest *forest) { Assert(this->n_cells() > 0, @@ -2216,8 +2221,8 @@ namespace parallel template - unsigned int - Triangulation::get_checksum() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int Triangulation::get_checksum() const { Assert(parallel_forest != nullptr, ExcMessage( @@ -2228,8 +2233,9 @@ namespace parallel template - const typename dealii::internal::p4est::types::forest * - Triangulation::get_p4est() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const typename dealii::internal::p4est::types::forest + *Triangulation::get_p4est() const { Assert(parallel_forest != nullptr, ExcMessage("The forest has not been allocated yet.")); @@ -2239,9 +2245,10 @@ namespace parallel template - typename dealii::internal::p4est::types::tree * - Triangulation::init_tree( - const int dealii_coarse_cell_index) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + typename dealii::internal::p4est::types::tree + *Triangulation::init_tree( + const int dealii_coarse_cell_index) const { const unsigned int tree_index = coarse_cell_to_p4est_tree_permutation[dealii_coarse_cell_index]; @@ -2733,8 +2740,8 @@ namespace parallel template - bool - Triangulation::prepare_coarsening_and_refinement() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool Triangulation::prepare_coarsening_and_refinement() { bool mesh_changed = false; unsigned int loop_counter = 0; @@ -2769,8 +2776,8 @@ namespace parallel template - void - Triangulation::copy_local_forest_to_triangulation() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::copy_local_forest_to_triangulation() { // Disable mesh smoothing for recreating the deal.II triangulation, // otherwise we might not be able to reproduce the p4est mesh @@ -3110,8 +3117,9 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::subdomain_id - Triangulation::find_point_owner_rank(const Point &p) + Triangulation::find_point_owner_rank(const Point &p) { // Call the other function std::vector> point{p}; @@ -3123,9 +3131,9 @@ namespace parallel template - std::vector - Triangulation::find_point_owner_rank( - const std::vector> &points) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::vector Triangulation:: + find_point_owner_rank(const std::vector> &points) { # ifndef P4EST_SEARCH_LOCAL (void)points; @@ -3223,8 +3231,8 @@ namespace parallel template - void - Triangulation::execute_coarsening_and_refinement() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::execute_coarsening_and_refinement() { // do not allow anisotropic refinement # ifdef DEBUG @@ -3487,8 +3495,8 @@ namespace parallel template - void - Triangulation::repartition() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::repartition() { # ifdef DEBUG for (const auto &cell : this->active_cell_iterators()) @@ -3596,9 +3604,10 @@ namespace parallel template - const std::vector & - Triangulation::get_p4est_tree_to_coarse_cell_permutation() - const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_p4est_tree_to_coarse_cell_permutation() + const { return p4est_tree_to_coarse_cell_permutation; } @@ -3606,9 +3615,10 @@ namespace parallel template - const std::vector & - Triangulation::get_coarse_cell_to_p4est_tree_permutation() - const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::vector + &Triangulation::get_coarse_cell_to_p4est_tree_permutation() + const { return coarse_cell_to_p4est_tree_permutation; } @@ -3616,9 +3626,9 @@ namespace parallel template - std::vector - Triangulation::mark_locally_active_vertices_on_level( - const int level) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::vector Triangulation:: + mark_locally_active_vertices_on_level(const int level) const { Assert(dim > 1, ExcNotImplemented()); @@ -3684,9 +3694,10 @@ namespace parallel template - unsigned int - Triangulation::coarse_cell_id_to_coarse_cell_index( - const types::coarse_cell_id coarse_cell_id) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int Triangulation:: + coarse_cell_id_to_coarse_cell_index( + const types::coarse_cell_id coarse_cell_id) const { return p4est_tree_to_coarse_cell_permutation[coarse_cell_id]; } @@ -3694,9 +3705,10 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::coarse_cell_id - Triangulation::coarse_cell_index_to_coarse_cell_id( - const unsigned int coarse_cell_index) const + Triangulation::coarse_cell_index_to_coarse_cell_id( + const unsigned int coarse_cell_index) const { return coarse_cell_to_p4est_tree_permutation[coarse_cell_index]; } @@ -3704,8 +3716,8 @@ namespace parallel template - void - Triangulation::add_periodicity( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::add_periodicity( const std::vector> &periodicity_vector) { @@ -3867,8 +3879,8 @@ namespace parallel template - std::size_t - Triangulation::memory_consumption() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::size_t Triangulation::memory_consumption() const { std::size_t mem = this->dealii::parallel::TriangulationBase:: @@ -3895,8 +3907,8 @@ namespace parallel template - std::size_t - Triangulation::memory_consumption_p4est() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::size_t Triangulation::memory_consumption_p4est() const { return dealii::internal::p4est::functions::forest_memory_used( parallel_forest) + @@ -3907,8 +3919,8 @@ namespace parallel template - void - Triangulation::copy_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::copy_triangulation( const dealii::Triangulation &other_tria) { Assert( @@ -3991,8 +4003,8 @@ namespace parallel template - void - Triangulation::update_cell_relations() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void Triangulation::update_cell_relations() { // reorganize memory for local_cell_relations this->local_cell_relations.resize(parallel_forest->local_num_quadrants); @@ -4024,8 +4036,9 @@ namespace parallel template - std::vector - Triangulation::get_cell_weights() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::vector Triangulation::get_cell_weights() + const { // check if local_cell_relations have been previously gathered // correctly @@ -4058,6 +4071,7 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) Triangulation<1, spacedim>::Triangulation( const MPI_Comm &mpi_communicator, const typename dealii::Triangulation<1, spacedim>::MeshSmoothing @@ -4073,6 +4087,7 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) Triangulation<1, spacedim>::~Triangulation() { AssertNothrow(false, ExcNotImplemented()); @@ -4081,9 +4096,10 @@ namespace parallel template - const std::vector & - Triangulation<1, spacedim>::get_p4est_tree_to_coarse_cell_permutation() - const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + const std::vector + &Triangulation<1, spacedim>::get_p4est_tree_to_coarse_cell_permutation() + const { static std::vector a; return a; @@ -4092,9 +4108,11 @@ namespace parallel template - std::map> - Triangulation<1, spacedim>::compute_level_vertices_with_ghost_neighbors( - const unsigned int /*level*/) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + std::map> Triangulation<1, spacedim>:: + compute_level_vertices_with_ghost_neighbors( + const unsigned int /*level*/) const { Assert(false, ExcNotImplemented()); @@ -4104,9 +4122,9 @@ namespace parallel template - std::vector - Triangulation<1, spacedim>::mark_locally_active_vertices_on_level( - const unsigned int) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + std::vector Triangulation<1, spacedim>:: + mark_locally_active_vertices_on_level(const unsigned int) const { Assert(false, ExcNotImplemented()); return std::vector(); @@ -4115,9 +4133,9 @@ namespace parallel template - unsigned int - Triangulation<1, spacedim>::coarse_cell_id_to_coarse_cell_index( - const types::coarse_cell_id) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + unsigned int Triangulation<1, spacedim>:: + coarse_cell_id_to_coarse_cell_index(const types::coarse_cell_id) const { Assert(false, ExcNotImplemented()); return 0; @@ -4126,9 +4144,10 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) types::coarse_cell_id - Triangulation<1, spacedim>::coarse_cell_index_to_coarse_cell_id( - const unsigned int) const + Triangulation<1, spacedim>::coarse_cell_index_to_coarse_cell_id( + const unsigned int) const { Assert(false, ExcNotImplemented()); return 0; @@ -4137,8 +4156,8 @@ namespace parallel template - void - Triangulation<1, spacedim>::load(const std::string &) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + void Triangulation<1, spacedim>::load(const std::string &) { Assert(false, ExcNotImplemented()); } @@ -4146,8 +4165,8 @@ namespace parallel template - void - Triangulation<1, spacedim>::load(const std::string &, const bool) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + void Triangulation<1, spacedim>::load(const std::string &, const bool) { Assert(false, ExcNotImplemented()); } @@ -4155,8 +4174,8 @@ namespace parallel template - void - Triangulation<1, spacedim>::save(const std::string &) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + void Triangulation<1, spacedim>::save(const std::string &) const { Assert(false, ExcNotImplemented()); } @@ -4164,8 +4183,8 @@ namespace parallel template - bool - Triangulation<1, spacedim>::is_multilevel_hierarchy_constructed() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + bool Triangulation<1, spacedim>::is_multilevel_hierarchy_constructed() const { Assert(false, ExcNotImplemented()); return false; @@ -4174,8 +4193,8 @@ namespace parallel template - bool - Triangulation<1, spacedim>::are_vertices_communicated_to_p4est() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + bool Triangulation<1, spacedim>::are_vertices_communicated_to_p4est() const { Assert(false, ExcNotImplemented()); return false; @@ -4184,8 +4203,8 @@ namespace parallel template - void - Triangulation<1, spacedim>::update_cell_relations() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<1, spacedim>)) + void Triangulation<1, spacedim>::update_cell_relations() { Assert(false, ExcNotImplemented()); } diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index 1b69fa8410..aed0cc2e10 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -44,6 +44,7 @@ DEAL_II_NAMESPACE_OPEN namespace parallel { template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) TriangulationBase::TriangulationBase( const MPI_Comm &mpi_communicator, const typename dealii::Triangulation::MeshSmoothing @@ -63,8 +64,8 @@ namespace parallel template - void - TriangulationBase::copy_triangulation( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::copy_triangulation( const dealii::Triangulation &other_tria) { #ifndef DEAL_II_WITH_MPI @@ -88,8 +89,8 @@ namespace parallel template - std::size_t - TriangulationBase::memory_consumption() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::size_t TriangulationBase::memory_consumption() const { std::size_t mem = this->dealii::Triangulation::memory_consumption() + @@ -101,7 +102,10 @@ namespace parallel return mem; } + + template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) TriangulationBase::~TriangulationBase() { // release unused vector memory because the vector layout is going to look @@ -110,45 +114,60 @@ namespace parallel release_all_unused_memory(); } + + template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) TriangulationBase::NumberCache::NumberCache() : n_locally_owned_active_cells(0) , number_of_global_coarse_cells(0) , n_global_levels(0) {} + + template - unsigned int - TriangulationBase::n_locally_owned_active_cells() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int TriangulationBase::n_locally_owned_active_cells() + const { return number_cache.n_locally_owned_active_cells; } + + template - unsigned int - TriangulationBase::n_global_levels() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int TriangulationBase::n_global_levels() const { return number_cache.n_global_levels; } + + template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::global_cell_index - TriangulationBase::n_global_active_cells() const + TriangulationBase::n_global_active_cells() const { return number_cache.n_global_active_cells; } + + template - MPI_Comm - TriangulationBase::get_communicator() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + MPI_Comm TriangulationBase::get_communicator() const { return mpi_communicator; } + + #ifdef DEAL_II_WITH_MPI template - void - TriangulationBase::update_number_cache() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::update_number_cache() { number_cache.ghost_owners.clear(); number_cache.level_ghost_owners.clear(); @@ -283,8 +302,8 @@ namespace parallel #else template - void - TriangulationBase::update_number_cache() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::update_number_cache() { Assert(false, ExcNeedsMPI()); } @@ -292,8 +311,8 @@ namespace parallel #endif template - void - TriangulationBase::update_reference_cells() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::update_reference_cells() { // run algorithm for locally-owned cells dealii::Triangulation::update_reference_cells(); @@ -321,8 +340,9 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::subdomain_id - TriangulationBase::locally_owned_subdomain() const + TriangulationBase::locally_owned_subdomain() const { return my_subdomain; } @@ -330,8 +350,9 @@ namespace parallel template - const std::set & - TriangulationBase::ghost_owners() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::set + &TriangulationBase::ghost_owners() const { return number_cache.ghost_owners; } @@ -339,8 +360,9 @@ namespace parallel template - const std::set & - TriangulationBase::level_ghost_owners() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::set + &TriangulationBase::level_ghost_owners() const { return number_cache.level_ghost_owners; } @@ -348,8 +370,9 @@ namespace parallel template - std::vector - TriangulationBase::get_boundary_ids() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::vector TriangulationBase:: + get_boundary_ids() const { return Utilities::MPI::compute_set_union( dealii::Triangulation::get_boundary_ids(), @@ -359,8 +382,9 @@ namespace parallel template - std::vector - TriangulationBase::get_manifold_ids() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + std::vector TriangulationBase:: + get_manifold_ids() const { return Utilities::MPI::compute_set_union( dealii::Triangulation::get_manifold_ids(), @@ -370,8 +394,8 @@ namespace parallel template - void - TriangulationBase::reset_global_cell_indices() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::reset_global_cell_indices() { #ifndef DEAL_II_WITH_MPI Assert(false, ExcNeedsMPI()); @@ -554,8 +578,8 @@ namespace parallel template - void - TriangulationBase::communicate_locally_moved_vertices( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void TriangulationBase::communicate_locally_moved_vertices( const std::vector &vertex_locally_moved) { AssertDimension(vertex_locally_moved.size(), this->n_vertices()); @@ -609,8 +633,10 @@ namespace parallel template - const std::weak_ptr - TriangulationBase::global_active_cell_index_partitioner() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::weak_ptr TriangulationBase< + dim, + spacedim>::global_active_cell_index_partitioner() const { return number_cache.active_cell_index_partitioner; } @@ -618,9 +644,11 @@ namespace parallel template - const std::weak_ptr - TriangulationBase::global_level_cell_index_partitioner( - const unsigned int level) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + const std::weak_ptr TriangulationBase< + dim, + spacedim>::global_level_cell_index_partitioner(const unsigned int level) + const { Assert(this->is_multilevel_hierarchy_constructed(), ExcNotImplemented()); AssertIndexRange(level, this->n_global_levels()); @@ -631,8 +659,9 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) types::coarse_cell_id - TriangulationBase::n_global_coarse_cells() const + TriangulationBase::n_global_coarse_cells() const { return number_cache.number_of_global_coarse_cells; } @@ -640,6 +669,7 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) DistributedTriangulationBase::DistributedTriangulationBase( const MPI_Comm &mpi_communicator, const typename dealii::Triangulation::MeshSmoothing @@ -656,8 +686,8 @@ namespace parallel template - void - DistributedTriangulationBase::clear() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::clear() { cell_attached_data = {0, 0, {}, {}}; data_transfer.clear(); @@ -668,8 +698,8 @@ namespace parallel template - void - DistributedTriangulationBase::save_attached_data( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::save_attached_data( const unsigned int global_first_cell, const unsigned int global_num_cells, const std::string &filename) const @@ -705,8 +735,8 @@ namespace parallel template - bool - DistributedTriangulationBase::has_hanging_nodes() const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + bool DistributedTriangulationBase::has_hanging_nodes() const { if (this->n_global_levels() <= 1) return false; // can not have hanging nodes without refined cells @@ -732,8 +762,8 @@ namespace parallel template - void - DistributedTriangulationBase::load_attached_data( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::load_attached_data( const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, @@ -769,11 +799,12 @@ namespace parallel template - unsigned int - DistributedTriangulationBase::register_data_attach( - const std::function(const cell_iterator &, - const CellStatus)> &pack_callback, - const bool returns_variable_size_data) + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + unsigned int DistributedTriangulationBase:: + register_data_attach( + const std::function(const cell_iterator &, + const CellStatus)> &pack_callback, + const bool returns_variable_size_data) { unsigned int handle = numbers::invalid_unsigned_int; @@ -799,8 +830,8 @@ namespace parallel template - void - DistributedTriangulationBase::notify_ready_to_unpack( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::notify_ready_to_unpack( const unsigned int handle, const std::function< void(const cell_iterator &, @@ -844,6 +875,7 @@ namespace parallel template + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) DistributedTriangulationBase::DataTransfer::DataTransfer( const MPI_Comm &mpi_communicator) : variable_size_data_stored(false) @@ -853,8 +885,8 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::pack_data( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer::pack_data( const std::vector &cell_relations, const std::vector &pack_callbacks_fixed, @@ -1189,9 +1221,9 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::unpack_cell_status( - std::vector &cell_relations) const + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer:: + unpack_cell_status(std::vector &cell_relations) const { Assert(sizes_fixed_cumulative.size() > 0, ExcMessage("No data has been packed!")); @@ -1225,8 +1257,8 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::unpack_data( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer::unpack_data( const std::vector &cell_relations, const unsigned int handle, const std::function< @@ -1396,8 +1428,8 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::save( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer::save( const unsigned int global_first_cell, const unsigned int global_num_cells, const std::string &filename) const @@ -1577,8 +1609,8 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::load( + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer::load( const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, @@ -1742,8 +1774,8 @@ namespace parallel template - void - DistributedTriangulationBase::DataTransfer::clear() + DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) + void DistributedTriangulationBase::DataTransfer::clear() { variable_size_data_stored = false; -- 2.39.5