From fa260ddcf97d2f5e32a0460cca37cbf8e3de0abb Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 15 Feb 2010 16:24:04 +0000 Subject: [PATCH] bundle cell and face data in loop git-svn-id: https://svn.dealii.org/trunk@20633 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/mesh_worker_info.h | 68 ++++++++--------- .../include/numerics/mesh_worker_loop.h | 76 ++++++++++--------- 2 files changed, 72 insertions(+), 72 deletions(-) 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 8ab1652271..40d9445f59 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.h @@ -568,7 +568,14 @@ namespace MeshWorker /** * A simple container collecting the five info objects required by the - * integration loops. + * integration loops. In addition to providing these objects, this + * class offers two functions to initialize them with reasonable + * contents all at once. + * + * MeshWorker::loop() requires five info objects collected into a + * single class. These are the data members #cell, #boundary, #face, + * #subface, and #neighbor. The names of those are expected by + * MeshWorker::loop(). * * @ingroup MeshWorker * @author Guido Kanschat, 2009 @@ -577,16 +584,13 @@ namespace MeshWorker class IntegrationInfoBox { public: - typedef IntegrationInfo, spacedim> CellInfo; - typedef IntegrationInfo, spacedim> FaceInfo; - /** - * Initialize all members - * with the same argument. - */ - template - IntegrationInfoBox(const T&); +/// The type of the info object for cells + typedef IntegrationInfo, spacedim> CellInfo; +/// The type of the info objects for faces. + typedef IntegrationInfo, spacedim> FaceInfo; + template void initialize(const WORKER&, const FiniteElement& el, @@ -598,18 +602,20 @@ namespace MeshWorker const Mapping& mapping, const NamedData& data); -// private: - boost::shared_ptr > cell_data; boost::shared_ptr > boundary_data; boost::shared_ptr > face_data; - DoFInfo dof_info; - CellInfo cell_info; - FaceInfo boundary_info; - FaceInfo face_info; - FaceInfo subface_info; - FaceInfo neighbor_info; +/// The info object for a cell + CellInfo cell; +/// The info object for a boundary face + FaceInfo boundary; +/// The info object for a regular interior face, seen from the first cell + FaceInfo face; +/// The info object for the refined side of an interior face seen from the first cell + FaceInfo subface; +/// The info object for an interior face, seen from the other cell + FaceInfo neighbor; }; @@ -925,14 +931,6 @@ namespace MeshWorker //----------------------------------------------------------------------// - template - template - IntegrationInfoBox::IntegrationInfoBox(const T& t) - : - dof_info(t) - {} - - template template void @@ -941,15 +939,15 @@ namespace MeshWorker const FiniteElement& el, const Mapping& mapping) { - cell_info.initialize >(el, mapping, integrator.cell_quadrature, + cell.initialize >(el, mapping, integrator.cell_quadrature, integrator.cell_flags); - boundary_info.initialize >(el, mapping, integrator.boundary_quadrature, + boundary.initialize >(el, mapping, integrator.boundary_quadrature, integrator.boundary_flags); - face_info.initialize >(el, mapping, integrator.face_quadrature, + face.initialize >(el, mapping, integrator.face_quadrature, integrator.face_flags); - subface_info.initialize >(el, mapping, integrator.face_quadrature, + subface.initialize >(el, mapping, integrator.face_quadrature, integrator.face_flags); - neighbor_info.initialize >(el, mapping, integrator.face_quadrature, + neighbor.initialize >(el, mapping, integrator.face_quadrature, integrator.neighbor_flags); } @@ -969,19 +967,19 @@ namespace MeshWorker p = boost::shared_ptr >(new VectorData (integrator.cell_selector)); p->initialize(data); cell_data = p; - cell_info.initialize_data(p); + cell.initialize_data(p); p = boost::shared_ptr >(new VectorData (integrator.boundary_selector)); p->initialize(data); boundary_data = p; - boundary_info.initialize_data(p); + boundary.initialize_data(p); p = boost::shared_ptr >(new VectorData (integrator.face_selector)); p->initialize(data); face_data = p; - face_info.initialize_data(p); - subface_info.initialize_data(p); - neighbor_info.initialize_data(p); + face.initialize_data(p); + subface.initialize_data(p); + neighbor.initialize_data(p); } } 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 b48f92cc37..02978105f0 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_loop.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_loop.h @@ -24,27 +24,29 @@ DEAL_II_NAMESPACE_OPEN template class TriaActiveIterator; -namespace MeshWorker +namespace internal { - namespace internal - { /** * Find out if an iterator supports inactive cells. */ - template - inline bool is_active_iterator(const DI&) - { - return false; - } - - template - inline bool is_active_iterator(const TriaActiveIterator&) - { - return true; - } + template + inline bool is_active_iterator(const DI&) + { + return false; + } + + template + inline bool is_active_iterator(const TriaActiveIterator&) + { + return true; } +} + + +namespace MeshWorker +{ /** * The main work function of this namespace. Its action consists of two * loops. @@ -66,15 +68,16 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template void loop(ITERATOR begin, typename identity::type end, DOFINFO cell_dof_info, - CELLINFO& cell_info, FACEINFO& boundary_info, - FACEINFO& face_info, FACEINFO& subface_info, FACEINFO& neighbor_info, - const std_cxx1x::function &cell_worker, - const std_cxx1x::function &boundary_worker, - const std_cxx1x::function &face_worker, + INFOBOX& info, + const std_cxx1x::function &cell_worker, + const std_cxx1x::function &boundary_worker, + const std_cxx1x::function &face_worker, ASSEMBLER &assembler, bool cells_first = true) { @@ -98,8 +101,8 @@ namespace MeshWorker if (integrate_cell && cells_first) { cell_dof_info.reinit(cell); - cell_info.reinit(cell_dof_info); - cell_worker(cell_dof_info, cell_info); + info.cell.reinit(cell_dof_info); + cell_worker(cell_dof_info, info.cell); assembler.assemble(cell_dof_info); } @@ -112,8 +115,8 @@ namespace MeshWorker if (integrate_boundary) { cell_dof_info.reinit(cell, face, face_no); - boundary_info.reinit(cell_dof_info); - boundary_worker(cell_dof_info, boundary_info); + info.boundary.reinit(cell_dof_info); + boundary_worker(cell_dof_info, info.boundary); assembler.assemble(cell_dof_info); } } @@ -144,15 +147,15 @@ namespace MeshWorker = neighbor->face(neighbor_face_no.first); face_dof_info.reinit(cell, face, face_no); - face_info.reinit(face_dof_info); + info.face.reinit(face_dof_info); neighbor_dof_info.reinit(neighbor, nface, neighbor_face_no.first, neighbor_face_no.second); - subface_info.reinit(neighbor_dof_info); + info.subface.reinit(neighbor_dof_info); // Neighbor // first to // conform to // old version - face_worker(face_dof_info, neighbor_dof_info, face_info, subface_info); + face_worker(face_dof_info, neighbor_dof_info, info.face, info.subface); assembler.assemble (face_dof_info, neighbor_dof_info); } else @@ -177,11 +180,11 @@ namespace MeshWorker Assert (neighbor->face(neighbor_face_no) == face, ExcInternalError()); // Regular interior face face_dof_info.reinit(cell, face, face_no); - face_info.reinit(face_dof_info); + info.face.reinit(face_dof_info); neighbor_dof_info.reinit(neighbor, neighbor->face(neighbor_face_no), neighbor_face_no); - neighbor_info.reinit(neighbor_dof_info); - face_worker(face_dof_info, neighbor_dof_info, face_info, neighbor_info); + info.neighbor.reinit(neighbor_dof_info); + face_worker(face_dof_info, neighbor_dof_info, info.face, info.neighbor); assembler.assemble(face_dof_info, neighbor_dof_info); } } @@ -191,8 +194,8 @@ namespace MeshWorker if (integrate_cell && !cells_first) { cell_dof_info.reinit(cell); - cell_info.reinit(cell_dof_info); - cell_worker(cell_dof_info, cell_info); + info.cell.reinit(cell_dof_info); + cell_worker(cell_dof_info, info.cell); assembler.assemble (cell_dof_info); } } @@ -207,6 +210,7 @@ namespace MeshWorker template void integration_loop(ITERATOR begin, typename identity::type end, + DoFInfo& dof_info, IntegrationInfoBox& box, const std_cxx1x::function&, CELLINFO &)> &cell_worker, const std_cxx1x::function&, FACEINFO &)> &boundary_worker, @@ -214,12 +218,10 @@ namespace MeshWorker ASSEMBLER &assembler, bool cells_first = true) { - loop,CELLINFO,FACEINFO> + loop,IntegrationInfoBox > (begin, end, - box.dof_info, - box.cell_info, box.boundary_info, - box.face_info, - box.subface_info, box.neighbor_info, + dof_info, + box, cell_worker, boundary_worker, face_worker, -- 2.39.5