From 9923d5f0eacc95e481b3f029b87a1a220295ce9c Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 20 Sep 2010 17:19:51 +0000 Subject: [PATCH] add additional add_update_flags functions and use in step 39 git-svn-id: https://svn.dealii.org/trunk@22092 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/mesh_worker_info.h | 68 ++++++++++++++++++- deal.II/examples/step-39/step-39.cc | 36 ++++++---- 2 files changed, 87 insertions(+), 17 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 8a927b0d88..ced843f5f9 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.h @@ -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 + inline + void + IntegrationInfoBox::add_update_flags_all (const UpdateFlags flags) + { + add_update_flags(flags, true, true, true, true); + } + + + template + inline + void + IntegrationInfoBox::add_update_flags_cell (const UpdateFlags flags) + { + add_update_flags(flags, true, false, false, false); + } + + + template + inline + void + IntegrationInfoBox::add_update_flags_boundary (const UpdateFlags flags) + { + add_update_flags(flags, false, true, false, false); + } + + + template + inline + void + IntegrationInfoBox::add_update_flags_face (const UpdateFlags flags) + { + add_update_flags(flags, false, false, true, true); + } + } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/examples/step-39/step-39.cc b/deal.II/examples/step-39/step-39.cc index 275dcb1e37..335bec6d78 100644 --- a/deal.II/examples/step-39/step-39.cc +++ b/deal.II/examples/step-39/step-39.cc @@ -577,14 +577,16 @@ Step39::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 - // initialize_update_flags - // 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::assemble_mg_matrix() MeshWorker::IntegrationInfoBox 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 dof_info(mg_dof_handler); @@ -674,9 +675,8 @@ Step39::assemble_right_hand_side() MeshWorker::IntegrationInfoBox 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 dof_info(dof_handler); @@ -855,11 +855,18 @@ Step39::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::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 dof_info(dof_handler); -- 2.39.5