From: Martin Kronbichler Date: Wed, 24 Apr 2024 17:00:19 +0000 (+0200) Subject: FEPointEvaluation: Remove signal to keep track of reinit() state X-Git-Tag: v9.6.0-rc1~322^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16925%2Fhead;p=dealii.git FEPointEvaluation: Remove signal to keep track of reinit() state --- diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index 9ee92802d6..c8428b20be 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -700,11 +700,6 @@ protected: */ FEPointEvaluationBase(FEPointEvaluationBase &&other) noexcept; - /** - * Destructor. - */ - ~FEPointEvaluationBase(); - public: /** * Return the value at quadrature point number @p point_index after a call to @@ -1040,15 +1035,12 @@ protected: bool fast_path; /** - * Connection to NonMatching::MappingInfo to check whether mapping data - * has been invalidated. + * Bool indicating if class needs to call reinit() inside + * evaluate()/integrate() functions, which is the case when the present + * class does not own the MappingInfo object but shares evaluation points + * with another object. */ - boost::signals2::connection connection_is_reinitialized; - - /** - * Bool indicating if class is reinitialized and data vectors a resized. - */ - bool is_reinitialized; + bool must_reinitialize_pointers; /** * Vector containing tensor product shape functions evaluated (during @@ -1774,7 +1766,7 @@ FEPointEvaluationBase:: , mapping_info(mapping_info_on_the_fly.get()) , current_cell_index(numbers::invalid_unsigned_int) , current_face_number(numbers::invalid_unsigned_int) - , is_reinitialized(false) + , must_reinitialize_pointers(false) , is_interior(true) { setup(first_selected_component); @@ -1799,12 +1791,10 @@ FEPointEvaluationBase:: , mapping_info(&mapping_info) , current_cell_index(numbers::invalid_unsigned_int) , current_face_number(numbers::invalid_unsigned_int) - , is_reinitialized(false) + , must_reinitialize_pointers(true) , is_interior(is_interior) { setup(first_selected_component); - connection_is_reinitialized = mapping_info.connect_is_reinitialized( - [this]() { this->is_reinitialized = false; }); } @@ -1841,12 +1831,9 @@ FEPointEvaluationBase:: , current_cell_index(other.current_cell_index) , current_face_number(other.current_face_number) , fast_path(other.fast_path) - , is_reinitialized(false) + , must_reinitialize_pointers(true) , is_interior(other.is_interior) -{ - connection_is_reinitialized = mapping_info->connect_is_reinitialized( - [this]() { this->is_reinitialized = false; }); -} +{} @@ -1876,21 +1863,9 @@ FEPointEvaluationBase:: , current_cell_index(other.current_cell_index) , current_face_number(other.current_face_number) , fast_path(other.fast_path) - , is_reinitialized(false) + , must_reinitialize_pointers(other.must_reinitialize_pointers) , is_interior(other.is_interior) -{ - connection_is_reinitialized = mapping_info->connect_is_reinitialized( - [this]() { this->is_reinitialized = false; }); -} - - - -template -FEPointEvaluationBase:: - ~FEPointEvaluationBase() -{ - connection_is_reinitialized.disconnect(); -} +{} @@ -2012,10 +1987,7 @@ FEPointEvaluationBase::do_reinit() } if (n_q_points == 0) - { - is_reinitialized = true; - return; - } + return; // set unit point pointer const unsigned int unit_point_offset = @@ -2106,8 +2078,6 @@ FEPointEvaluationBase::do_reinit() } } } - - is_reinitialized = true; } @@ -2322,6 +2292,7 @@ FEPointEvaluation::reinit( ExcNotImplemented()); this->mapping_info->reinit(cell, unit_points); + this->must_reinitialize_pointers = false; if (!this->fast_path) { @@ -2347,8 +2318,9 @@ inline void FEPointEvaluation::reinit( const unsigned int cell_index) { - this->current_cell_index = cell_index; - this->current_face_number = numbers::invalid_unsigned_int; + this->current_cell_index = cell_index; + this->current_face_number = numbers::invalid_unsigned_int; + this->must_reinitialize_pointers = false; if (this->use_linear_path) this->template do_reinit(); @@ -2385,7 +2357,7 @@ FEPointEvaluation::evaluate( const StridedArrayView &solution_values, const EvaluationFlags::EvaluationFlags &evaluation_flags) { - if (!this->is_reinitialized) + if (this->must_reinitialize_pointers) reinit(); if (this->n_q_points == 0) @@ -3038,7 +3010,7 @@ FEPointEvaluation::do_integrate( const EvaluationFlags::EvaluationFlags &integration_flags, const bool sum_into_values) { - if (!this->is_reinitialized) + if (this->must_reinitialize_pointers) reinit(); Assert(!(integration_flags & EvaluationFlags::hessians), ExcNotImplemented()); @@ -3117,8 +3089,9 @@ FEFacePointEvaluation::reinit( const unsigned int cell_index, const unsigned int face_number) { - this->current_cell_index = cell_index; - this->current_face_number = face_number; + this->current_cell_index = cell_index; + this->current_face_number = face_number; + this->must_reinitialize_pointers = false; if (this->use_linear_path) this->template do_reinit(); @@ -3136,6 +3109,7 @@ FEFacePointEvaluation::reinit( this->current_cell_index = face_index; this->current_face_number = this->mapping_info->get_face_number(face_index, this->is_interior); + this->must_reinitialize_pointers = false; if (this->use_linear_path) this->template do_reinit(); @@ -3152,7 +3126,8 @@ FEFacePointEvaluation::evaluate( const StridedArrayView &solution_values, const EvaluationFlags::EvaluationFlags &evaluation_flags) { - Assert(this->is_reinitialized, ExcMessage("Is not reinitialized!")); + Assert(!this->must_reinitialize_pointers, + ExcMessage("Object has not been reinitialized!")); if (this->n_q_points == 0) return; @@ -3248,7 +3223,8 @@ FEFacePointEvaluation::integrate( const EvaluationFlags::EvaluationFlags &integration_flags, const bool sum_into_values) { - Assert(this->is_reinitialized, ExcMessage("Is not reinitialized!")); + Assert(!this->must_reinitialize_pointers, + ExcMessage("Object has not been reinitialized!")); Assert(!(integration_flags & EvaluationFlags::hessians), ExcNotImplemented()); @@ -3300,7 +3276,8 @@ FEFacePointEvaluation::test_and_sum( const EvaluationFlags::EvaluationFlags &integration_flags, const bool sum_into_values) { - Assert(this->is_reinitialized, ExcMessage("Is not reinitialized!")); + Assert(!this->must_reinitialize_pointers, + ExcMessage("Object has not been reinitialized!")); Assert(!(integration_flags & EvaluationFlags::hessians), ExcNotImplemented()); diff --git a/include/deal.II/non_matching/mapping_info.h b/include/deal.II/non_matching/mapping_info.h index 93672de532..abedfa67d3 100644 --- a/include/deal.II/non_matching/mapping_info.h +++ b/include/deal.II/non_matching/mapping_info.h @@ -455,12 +455,6 @@ namespace NonMatching UpdateFlags get_update_flags_mapping() const; - /** - * Connects to is_reinitialized(). - */ - boost::signals2::connection - connect_is_reinitialized(const std::function &set_is_reinitialized); - /** * Compute the geometry index offset of the current cell/face. */ @@ -758,12 +752,6 @@ namespace NonMatching */ 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; - /** * Reference to the triangulation passed via the cells to the * reinit functions. This field is only set if @@ -932,7 +920,6 @@ namespace NonMatching compressed_data_index_offsets.push_back(0); state = State::single_cell; - is_reinitialized(); } @@ -1153,7 +1140,6 @@ namespace NonMatching } state = State::cell_vector; - is_reinitialized(); } @@ -1473,7 +1459,6 @@ namespace NonMatching } state = State::faces_on_cells_in_vector; - is_reinitialized(); } @@ -1746,7 +1731,6 @@ namespace NonMatching } state = State::face_vector; - is_reinitialized(); } @@ -2173,16 +2157,6 @@ namespace NonMatching - template - boost::signals2::connection - MappingInfo::connect_is_reinitialized( - const std::function &set_is_reinitialized) - { - return is_reinitialized.connect(set_is_reinitialized); - } - - - template std::size_t MappingInfo::memory_consumption() const