From: Maximilian Bergbauer Date: Thu, 30 Mar 2023 18:41:24 +0000 (+0200) Subject: Implement connector function and provide reinit function for explicit reinitialization X-Git-Tag: v9.5.0-rc1~385^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14982%2Fhead;p=dealii.git Implement connector function and provide reinit function for explicit reinitialization --- diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index 0e19bd271e..dd447cbe00 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -470,6 +470,13 @@ public: reinit(const typename Triangulation::cell_iterator &cell, const ArrayView> &unit_points); + /** + * Reinitialize the evaluator to point to the correct precomputed mapping of + * the single cell in the MappingInfo object. + */ + void + reinit(); + /** * Reinitialize the evaluator to point to the correct precomputed mapping of * the cell in the MappingInfo object. @@ -832,7 +839,7 @@ FEPointEvaluation::FEPointEvaluation( , is_reinitialized(false) { setup(first_selected_component); - mapping_info.is_reinitialized.connect( + mapping_info.connect_is_reinitialized( [this]() { this->is_reinitialized = false; }); } @@ -937,6 +944,18 @@ FEPointEvaluation::reinit( +template +void +FEPointEvaluation::reinit() +{ + current_cell_index = numbers::invalid_unsigned_int; + current_face_number = numbers::invalid_unsigned_int; + + do_reinit(); +} + + + template void FEPointEvaluation::reinit( @@ -1014,7 +1033,7 @@ FEPointEvaluation::evaluate( const EvaluationFlags::EvaluationFlags &evaluation_flag) { if (!is_reinitialized) - reinit(numbers::invalid_unsigned_int); + reinit(); if (n_q_points == 0) return; @@ -1168,6 +1187,9 @@ FEPointEvaluation::integrate( const ArrayView & solution_values, const EvaluationFlags::EvaluationFlags &integration_flags) { + if (!is_reinitialized) + reinit(); + if (n_q_points == 0) // no evaluation points provided { std::fill(solution_values.begin(), solution_values.end(), 0.0); diff --git a/include/deal.II/non_matching/mapping_info.h b/include/deal.II/non_matching/mapping_info.h index 3693c3758d..5dc9d8f665 100644 --- a/include/deal.II/non_matching/mapping_info.h +++ b/include/deal.II/non_matching/mapping_info.h @@ -182,12 +182,11 @@ namespace NonMatching UpdateFlags get_update_flags() const; - /** - * This signal is triggered right after - * this object is reinitialized, to let dependent - * objects know that they need to reinitialize as well. - */ - boost::signals2::signal is_reinitialized; + /** + * Connects to is_reinitialized(). + */ + boost::signals2::connection + connect_is_reinitialized(const std::function &set_is_reinitialized); private: /** @@ -288,6 +287,12 @@ namespace NonMatching * A bool that determines weather cell index compression should be done. */ bool do_cell_index_compression; + + /** + * This signal is triggered right after this object is reinitialized, to let + * dependent objects know that they need to reinitialize as well. + */ + boost::signals2::signal is_reinitialized; }; // ----------------------- template functions ---------------------- @@ -343,7 +348,6 @@ namespace NonMatching mapping_data[0]); state = State::single_cell; - is_reinitialized(); } @@ -793,6 +797,16 @@ namespace NonMatching + template + boost::signals2::connection + MappingInfo::connect_is_reinitialized( + const std::function &set_is_reinitialized) + { + return is_reinitialized.connect(set_is_reinitialized); + } + + + template void MappingInfo::compute_mapping_data_for_generic_points(