]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement connector function and provide reinit function for explicit reinitialization 14982/head
authorMaximilian Bergbauer <bergbauer@lnm.mw.tum.de>
Thu, 30 Mar 2023 18:41:24 +0000 (20:41 +0200)
committerMaximilian Bergbauer <bergbauer@lnm.mw.tum.de>
Thu, 30 Mar 2023 18:46:35 +0000 (20:46 +0200)
include/deal.II/matrix_free/fe_point_evaluation.h
include/deal.II/non_matching/mapping_info.h

index 0e19bd271edd5ea958142c4271359072851bdf6a..dd447cbe005f7fc255f9e77c83890e2c391eba40 100644 (file)
@@ -470,6 +470,13 @@ public:
   reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
          const ArrayView<const Point<dim>> &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<n_components, dim, spacedim, Number>::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<n_components, dim, spacedim, Number>::reinit(
 
 
 
+template <int n_components, int dim, int spacedim, typename Number>
+void
+FEPointEvaluation<n_components, dim, spacedim, Number>::reinit()
+{
+  current_cell_index  = numbers::invalid_unsigned_int;
+  current_face_number = numbers::invalid_unsigned_int;
+
+  do_reinit();
+}
+
+
+
 template <int n_components, int dim, int spacedim, typename Number>
 void
 FEPointEvaluation<n_components, dim, spacedim, Number>::reinit(
@@ -1014,7 +1033,7 @@ FEPointEvaluation<n_components, dim, spacedim, Number>::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<n_components, dim, spacedim, Number>::integrate(
   const ArrayView<Number> &               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);
index 3693c3758dc37fcfd4f248a3b7af0cd337411188..5dc9d8f6656a622b23050a44691d2cc30e000675 100644 (file)
@@ -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<void()> is_reinitialized;
+    /**
+     * Connects to is_reinitialized().
+     */
+    boost::signals2::connection
+    connect_is_reinitialized(const std::function<void()> &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<void()> 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 <int dim, int spacedim>
+  boost::signals2::connection
+  MappingInfo<dim, spacedim>::connect_is_reinitialized(
+    const std::function<void()> &set_is_reinitialized)
+  {
+    return is_reinitialized.connect(set_is_reinitialized);
+  }
+
+
+
   template <int dim, int spacedim>
   void
   MappingInfo<dim, spacedim>::compute_mapping_data_for_generic_points(

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.