]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add callback functions to cell_action
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 2010 14:48:50 +0000 (14:48 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 2010 14:48:50 +0000 (14:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@21062 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/mesh_worker_info.h
deal.II/deal.II/include/numerics/mesh_worker_loop.h

index d141bbb210861639c9e03383eae49789bf11ee3e..a44c6eae6c2b5f91e6d268bc542181845a885889 100644 (file)
@@ -732,6 +732,74 @@ namespace MeshWorker
 
 /// The type of the info objects for faces.
       typedef IntegrationInfo<dim, spacedim> FaceInfo;
+
+                                      /**
+                                       * A callback function which is
+                                       * called in the loop over all
+                                       * cells, after the action on a
+                                       * cell has been performed and
+                                       * before the faces are dealt
+                                       * with.
+                                       *
+                                       * In order for this function
+                                       * to have this effect,
+                                       * at least either of the
+                                       * arguments
+                                       * <tt>boundary_worker</tt> or
+                                       * <tt>face_worker</tt>
+                                       * arguments of loop() should
+                                       * be nonzero. Additionally,
+                                       * <tt>cells_first</tt> should
+                                       * be true. If
+                                       * <tt>cells_first</tt> is
+                                       * false, this function is
+                                       * called before any action on
+                                       * a cell is taken.
+                                       *
+                                       * And empty function in this
+                                       * class, but can be replaced
+                                       * in other classes given to
+                                       * loop() instead.
+                                       *
+                                       * See loop() and cell_action()
+                                       * for more details of how this
+                                       * function can be used.
+                                       */
+      template <class DOFINFO>
+      void post_cell(const DoFInfoBox<dim, DOFINFO>&);
+      
+                                      /**
+                                       * A callback function which is
+                                       * called in the loop over all
+                                       * cells, after the action on
+                                       * the faces of a cell has been
+                                       * performed and before the
+                                       * cell itself is dealt with
+                                       * (assumes
+                                       * <tt>cells_first</tt> is false).
+                                       *
+                                       * In order for this function
+                                       * to have a reasonable effect,
+                                       * at least either of the
+                                       * arguments
+                                       * <tt>boundary_worker</tt> or
+                                       * <tt>face_worker</tt>
+                                       * arguments of loop() should
+                                       * be nonzero. Additionally,
+                                       * <tt>cells_first</tt> should
+                                       * be false.
+                                       *
+                                       * And empty function in this
+                                       * class, but can be replaced
+                                       * in other classes given to
+                                       * loop() instead.
+                                       *
+                                       * See loop() and cell_action()
+                                       * for more details of how this
+                                       * function can be used.
+                                       */
+      template <class DOFINFO>
+      void post_faces(const DoFInfoBox<dim, DOFINFO>&);
       
       template <class WORKER>
       void initialize(const WORKER&,
@@ -752,7 +820,7 @@ namespace MeshWorker
                      const Mapping<dim, spacedim>& mapping,
                      const NamedData<MGLevelObject<VECTOR>*>& data,
                      const BlockInfo* block_info = 0);
-
+      
       boost::shared_ptr<MeshWorker::VectorDataBase<dim, spacedim> > cell_data;
       boost::shared_ptr<MeshWorker::VectorDataBase<dim, spacedim> > boundary_data;
       boost::shared_ptr<MeshWorker::VectorDataBase<dim, spacedim> > face_data;
@@ -1318,6 +1386,22 @@ namespace MeshWorker
     subface.initialize_data(p);
     neighbor.initialize_data(p);
   }
+
+
+  template <int dim, int sdim>
+  template <class DOFINFO>
+  void
+  IntegrationInfoBox<dim,sdim>::post_cell(const DoFInfoBox<dim, DOFINFO>&)
+  {}
+  
+
+  template <int dim, int sdim>
+  template <class DOFINFO>
+  void
+  IntegrationInfoBox<dim,sdim>::post_faces(const DoFInfoBox<dim, DOFINFO>&)
+  {}
+  
+
 }
 
 DEAL_II_NAMESPACE_CLOSE
index e3c5364ead366b59b8710d5029712cc5acddcbbd..7b47a4e8b821016e1ca78b3f358603be3181cd6d 100644 (file)
@@ -112,6 +112,12 @@ namespace MeshWorker
        info.cell.reinit(dof_info.cell);
        cell_worker(dof_info.cell, info.cell);
       }
+
+                                    // Call the callback function in
+                                    // the info box to do
+                                    // computations between cell and
+                                    // face action.
+    info.post_cell(dof_info);
     
     if (integrate_interior_face || integrate_boundary)
       for (unsigned int face_no=0; face_no < GeometryInfo<ITERATOR::AccessorType::Container::dimension>::faces_per_cell; ++face_no)
@@ -198,6 +204,12 @@ namespace MeshWorker
                }
            }
        } // faces
+                                    // Call the callback function in
+                                    // the info box to do
+                                    // computations between face and
+                                    // cell action.
+    info.post_faces(dof_info);
+    
                                     // Execute this, if faces
                                     // have to be handled first
     if (integrate_cell && !cells_first)
@@ -210,19 +222,15 @@ namespace MeshWorker
   
   
 /**
- * The main work function of this namespace. Its action consists of two
- * loops.
- *
- * First, a loop over all cells in the iterator range is performed, in
- * each step updating the CellInfo object, then calling
- * cell_worker() with this object.
- *
- * In the second loop, we walk through all the faces of cells in the
- * iterator range. The functions boundary_worker() and
- * face_worker() are called for each boundary and interior face,
- * respectively. Unilaterally refined interior faces are handled
+ * The main work function of this namespace. It is a loop over all
+ * cells in an iterator range, in which cell_action() is called for
+ * each cell. Unilaterally refined interior faces are handled
  * automatically by the loop.
  *
+ * Most of the work in this loop is done in cell_action(), whic halso
+ * reeived most of the parameters of this function. See the
+ * documentation there for mor details.
+ *
  * If you don't want integration on cells, interior or boundary faces
  * to happen, simply pass the Null pointer to one of the function
  * arguments.

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.