From 1baa8509daecfeb05b241e1a430ad10bd5d10194 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Thu, 10 Apr 2025 16:30:44 +0200 Subject: [PATCH] Fix active fe index in MFT --- include/deal.II/matrix_free/fe_evaluation.h | 4 +++- include/deal.II/matrix_free/fe_evaluation_data.h | 7 ++++++- include/deal.II/matrix_free/matrix_free.h | 1 + include/deal.II/matrix_free/tools.h | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index d819941a54..496bae9dd7 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -6160,7 +6160,9 @@ inline FEEvaluation::FEEvaluationData( , subface_index(0) , cell_type(internal::MatrixFreeFunctions::general) , divergence_is_requested(false) -{} +{ + Assert(!data->data.empty(), ExcInternalError()); +} @@ -1199,6 +1201,9 @@ FEEvaluationData::set_data_pointers( const unsigned int n_components) { Assert(scratch_data_array != nullptr, ExcInternalError()); + Assert(data != nullptr, ExcInternalError()); + Assert(!data->data.empty(), ExcInternalError()); + const unsigned int tensor_dofs_per_component = Utilities::fixed_power(data->data.front().fe_degree + 1); diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 38fef3f1b7..aef158d9e5 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2353,6 +2353,7 @@ private: * Stores the index of the first DoFHandler that is in hp-mode. If no * DoFHandler is in hp-mode, the value is 0. */ +public: unsigned int first_hp_dof_handler_index; }; diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 1e1aca39ca..2740936df3 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -1352,7 +1352,9 @@ namespace MatrixFreeTools unsigned int active_fe_index = 0; if (!is_face) - active_fe_index = matrix_free.get_cell_active_fe_index(range); + active_fe_index = (matrix_free.first_hp_dof_handler_index == dof_no) ? + matrix_free.get_cell_active_fe_index(range) : + 0; else if (is_interior_face) active_fe_index = matrix_free.get_face_range_category(range).first; else -- 2.39.5