]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add additional add_update_flags functions and use in step 39
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 17:19:51 +0000 (17:19 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 17:19:51 +0000 (17:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@22092 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/mesh_worker_info.h
deal.II/examples/step-39/step-39.cc

index 8a927b0d881ab8fd259ca1fe0ec11cc9a26f4a7f..ced843f5f9d9fb63b555dff99e1ed99c7a7ed472 100644 (file)
@@ -593,6 +593,32 @@ namespace MeshWorker
                                       /* @{ */
       void initialize_update_flags();
 
+                                      /**
+                                       * Add FEValues UpdateFlags for
+                                       * integration on all objects
+                                       * (cells, boundary faces and
+                                       * all interior faces).
+                                       */
+      void add_update_flags_all (const UpdateFlags flags);
+
+                                      /**
+                                       * Add FEValues UpdateFlags for
+                                       * integration on cells.
+                                       */
+      void add_update_flags_cell(const UpdateFlags flags);
+      
+                                      /**
+                                       * Add FEValues UpdateFlags for
+                                       * integration on boundary faces.
+                                       */
+      void add_update_flags_boundary(const UpdateFlags flags);
+      
+                                      /**
+                                       * Add FEValues UpdateFlags for
+                                       * integration on interior faces.
+                                       */
+      void add_update_flags_face(const UpdateFlags flags);
+      
                                       /**
                                        * Add additional update flags
                                        * to the ones already set in
@@ -600,8 +626,9 @@ namespace MeshWorker
                                        * boolean flags indicate
                                        * wether the additional flags
                                        * should be set for cell,
-                                       * boundary, interelement face,
-                                       * or neighbor integration, or
+                                       * boundary, interelement face
+                                       * for the cell itself
+                                       * or neighbor cell, or
                                        * any combination thereof.
                                        */
       void add_update_flags(const UpdateFlags flags,
@@ -1450,6 +1477,43 @@ namespace MeshWorker
   {
     cell_quadrature = QGauss<1>(cp);
   }
+
+  
+  template <int dim, int sdim>
+  inline
+  void
+  IntegrationInfoBox<dim,sdim>::add_update_flags_all (const UpdateFlags flags)
+  {
+    add_update_flags(flags, true, true, true, true);
+  }
+
+  
+  template <int dim, int sdim>
+  inline
+  void
+  IntegrationInfoBox<dim,sdim>::add_update_flags_cell (const UpdateFlags flags)
+  {
+    add_update_flags(flags, true, false, false, false);
+  }
+
+  
+  template <int dim, int sdim>
+  inline
+  void
+  IntegrationInfoBox<dim,sdim>::add_update_flags_boundary (const UpdateFlags flags)
+  {
+    add_update_flags(flags, false, true, false, false);
+  }
+
+  
+  template <int dim, int sdim>
+  inline
+  void
+  IntegrationInfoBox<dim,sdim>::add_update_flags_face (const UpdateFlags flags)
+  {
+    add_update_flags(flags, false, false, true, true);
+  }
+  
 }
 
 DEAL_II_NAMESPACE_CLOSE
index 275dcb1e37c66f7d3f755f9f637bf1d087b4eeb9..335bec6d7810c5b78c9751d20d1ebe567837bf2b 100644 (file)
@@ -577,14 +577,16 @@ Step39<dim>::assemble_matrix()
   const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
   info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points, n_gauss_points);
                                   // which values to update in these
-                                  // points. We call
-                                  // <tt>initialize_update_flags</tt>
-                                  // first in order to set default
-                                  // values. Then, we add what we
-                                  // need additionally.
-  info_box.initialize_update_flags();
+                                  // points. Update flags are
+                                  // initialized to some default
+                                  // values to be able to
+                                  // integrate. Here, we add what we
+                                  // need additionally, namely the
+                                  // values and gradients of shape
+                                  // functions on all objects (cells,
+                                  // boundary and interior faces).
   UpdateFlags update_flags = update_values | update_gradients;
-  info_box.add_update_flags(update_flags, true, true, true, true);
+  info_box.add_update_flags_all(update_flags);
   info_box.initialize(fe, mapping);
 
                                   // This is the object into which we
@@ -628,9 +630,8 @@ Step39<dim>::assemble_mg_matrix()
   MeshWorker::IntegrationInfoBox<dim> info_box;
   const unsigned int n_gauss_points = mg_dof_handler.get_fe().tensor_degree()+1;
   info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points, n_gauss_points);
-  info_box.initialize_update_flags();
   UpdateFlags update_flags = update_values | update_gradients;
-  info_box.add_update_flags(update_flags, true, true, true, true);
+  info_box.add_update_flags_all(update_flags);
   info_box.initialize(fe, mapping);
 
   MeshWorker::DoFInfo<dim> dof_info(mg_dof_handler);
@@ -674,9 +675,8 @@ Step39<dim>::assemble_right_hand_side()
   MeshWorker::IntegrationInfoBox<dim> info_box;
   const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
   info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
-  info_box.initialize_update_flags();
   UpdateFlags update_flags = update_quadrature_points | update_values | update_gradients;
-  info_box.add_update_flags(update_flags, true, true, true, true);
+  info_box.add_update_flags_all(update_flags);
   info_box.initialize(fe, mapping);
   
   MeshWorker::DoFInfo<dim> dof_info(dof_handler);
@@ -855,11 +855,18 @@ Step39<dim>::estimate()
                                   // Then, we tell the Meshworker::VectorSelector
                                   // for cells, that we need the
                                   // second derivatives of this
-                                  // solution (to compute the Laplacian).
+                                  // solution (to compute the
+                                  // Laplacian). Therefore, the
+                                  // boolean arguments selecting
+                                  // function values and first
+                                  // derivatives a false, only the
+                                  // last one selecting second
+                                  // derivatives is true.
   info_box.cell_selector.add("solution", false, false, true);
                                   // On interior and boundary faces,
                                   // we need the function values and
-                                  // the first derivatives.
+                                  // the first derivatives, but not
+                                  // second derivatives.
   info_box.boundary_selector.add("solution", true, true, false);
   info_box.face_selector.add("solution", true, true, false);
 
@@ -868,8 +875,7 @@ Step39<dim>::estimate()
                                   // update flags are already
                                   // adjusted to the values and
                                   // derivatives we requested above.
-  info_box.initialize_update_flags();
-  info_box.add_update_flags(update_quadrature_points, false, true, false, false);
+  info_box.add_update_flags_boundary(update_quadrature_points);
   info_box.initialize(fe, mapping, solution_data);
   
   MeshWorker::DoFInfo<dim> dof_info(dof_handler);

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.