From: kanschat Date: Tue, 4 May 2010 14:48:50 +0000 (+0000) Subject: add callback functions to cell_action X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=091a670ed54cb46817b98cec78d2708b49db3685;p=dealii-svn.git add callback functions to cell_action git-svn-id: https://svn.dealii.org/trunk@21062 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/mesh_worker_info.h b/deal.II/deal.II/include/numerics/mesh_worker_info.h index d141bbb210..a44c6eae6c 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.h @@ -732,6 +732,74 @@ namespace MeshWorker /// The type of the info objects for faces. typedef IntegrationInfo 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 + * boundary_worker or + * face_worker + * arguments of loop() should + * be nonzero. Additionally, + * cells_first should + * be true. If + * cells_first 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 + void post_cell(const DoFInfoBox&); + + /** + * 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 + * cells_first is false). + * + * In order for this function + * to have a reasonable effect, + * at least either of the + * arguments + * boundary_worker or + * face_worker + * arguments of loop() should + * be nonzero. Additionally, + * cells_first 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 + void post_faces(const DoFInfoBox&); template void initialize(const WORKER&, @@ -752,7 +820,7 @@ namespace MeshWorker const Mapping& mapping, const NamedData*>& data, const BlockInfo* block_info = 0); - + boost::shared_ptr > cell_data; boost::shared_ptr > boundary_data; boost::shared_ptr > face_data; @@ -1318,6 +1386,22 @@ namespace MeshWorker subface.initialize_data(p); neighbor.initialize_data(p); } + + + template + template + void + IntegrationInfoBox::post_cell(const DoFInfoBox&) + {} + + + template + template + void + IntegrationInfoBox::post_faces(const DoFInfoBox&) + {} + + } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/deal.II/include/numerics/mesh_worker_loop.h b/deal.II/deal.II/include/numerics/mesh_worker_loop.h index e3c5364ead..7b47a4e8b8 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_loop.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_loop.h @@ -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::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.