From 6fa1dfea893bd5844aa52dfab975527458525c6d Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 4 Nov 2020 10:20:34 +0100 Subject: [PATCH] Add internal::TriangulationImplementation::ImplementationMixedMesh --- include/deal.II/grid/tria.h | 3 ++ source/grid/tria.cc | 95 ++++++++++++++++++++++++++++++++----- 2 files changed, 86 insertions(+), 12 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 5a8efeeb31..2a57871fe6 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -99,6 +99,7 @@ namespace internal * information. */ struct Implementation; + struct ImplementationMixedMesh; } // namespace TriangulationImplementation namespace TriaAccessorImplementation @@ -4025,6 +4026,8 @@ private: friend class hp::DoFHandler; friend struct dealii::internal::TriangulationImplementation::Implementation; + friend struct dealii::internal::TriangulationImplementation:: + ImplementationMixedMesh; friend class dealii::internal::TriangulationImplementation::TriaObjects; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 5912648524..68778d1a82 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -9354,6 +9354,68 @@ namespace internal }; + /** + * Same as above but for mixed meshes (and simplex meshes). + */ + struct ImplementationMixedMesh + { + template + static void + delete_children( + Triangulation & triangulation, + typename Triangulation::cell_iterator &cell, + std::vector & line_cell_count, + std::vector & quad_cell_count) + { + AssertThrow(false, ExcNotImplemented()); + (void)triangulation; + (void)cell; + (void)line_cell_count; + (void)quad_cell_count; + } + + template + static typename Triangulation::DistortedCellList + execute_refinement(Triangulation &triangulation, + const bool check_for_distorted_cells) + { + AssertThrow(false, ExcNotImplemented()); + (void)triangulation; + (void)check_for_distorted_cells; + + return {}; + } + + template + static void + prevent_distorted_boundary_cells( + Triangulation &triangulation) + { + AssertThrow(false, ExcNotImplemented()); + (void)triangulation; + } + + template + static void + prepare_refinement_dim_dependent( + Triangulation &triangulation) + { + AssertThrow(false, ExcNotImplemented()); + (void)triangulation; + } + + template + static bool + coarsening_allowed( + const typename Triangulation::cell_iterator &cell) + { + AssertThrow(false, ExcNotImplemented()); + (void)cell; + + return false; + } + }; + template const Manifold & @@ -9795,12 +9857,6 @@ Triangulation::create_triangulation( // are used Assert(subcelldata.check_consistency(dim), ExcInternalError()); - this->policy = - std::make_unique>(); - // try to create a triangulation; if this fails, we still want to // throw an exception but if we just do so we'll get into trouble // because sometimes other objects are already attached to it: @@ -9810,12 +9866,6 @@ Triangulation::create_triangulation( create_triangulation(v, cells, subcelldata, *this); this->update_reference_cell_types(); - -#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT - Assert(this->all_reference_cell_types_are_hyper_cube(), - ExcMessage( - "A cell with invalid number of vertices has been provided.")); -#endif } catch (...) { @@ -9823,6 +9873,27 @@ Triangulation::create_triangulation( throw; } + if (this->all_reference_cell_types_are_hyper_cube()) + { + this->policy = + std::make_unique>(); + } + else + { +#ifndef DEAL_II_WITH_SIMPLEX_SUPPORT + Assert(false, ExcNeedsSimplexSupport()); +#endif + + this->policy = + std::make_unique>(); + } + // update our counts of the various elements of a triangulation, and set // active_cell_indices of all cells internal::TriangulationImplementation::Implementation::compute_number_cache( -- 2.39.5