From d003fb9c4736b77ceddd2645c5fca4e519607e5e Mon Sep 17 00:00:00 2001 From: Spencer Patty Date: Wed, 10 Feb 2016 10:53:21 -0600 Subject: [PATCH] run indent and add comments to describe test --- tests/grid/get_dof_to_support_patch_map_01.cc | 159 +++++++++--------- 1 file changed, 82 insertions(+), 77 deletions(-) diff --git a/tests/grid/get_dof_to_support_patch_map_01.cc b/tests/grid/get_dof_to_support_patch_map_01.cc index fee6dd97e3..adf0ca5c52 100644 --- a/tests/grid/get_dof_to_support_patch_map_01.cc +++ b/tests/grid/get_dof_to_support_patch_map_01.cc @@ -16,7 +16,11 @@ // --------------------------------------------------------------------- -// Test GridTools::map_dof_to_support_patch () +// Test GridTools::map_dof_to_support_patch () using a quadratic FE_Q +// space. We output the barycenter of each cell in the patch around the dof +// for a few dofs in the triangulation. We have three layers of refinement in +// the triangulation which represents the various patches that could arise in +// practice. @@ -28,7 +32,6 @@ #include #include #include - #include #include @@ -49,39 +52,41 @@ void test() triangulation.refine_global (2); { + // choose barycenters of cells to refine or coarsen to end up with + // a three level triangulation. std::vector > refine_centers; std::vector > coarsen_centers; - if(dim==1) - { - refine_centers.push_back(Point (1./8.)); + if (dim==1) + { + refine_centers.push_back(Point (1./8.)); - coarsen_centers.push_back(Point (5./8.)); - coarsen_centers.push_back(Point (7./8.)); - } + coarsen_centers.push_back(Point (5./8.)); + coarsen_centers.push_back(Point (7./8.)); + } else if (dim==2) - { - refine_centers.push_back(Point (1./8., 7./8.)); + { + refine_centers.push_back(Point (1./8., 7./8.)); - coarsen_centers.push_back(Point (5./8., 5./8.)); - coarsen_centers.push_back(Point (5./8., 7./8.)); - coarsen_centers.push_back(Point (7./8., 5./8.)); - coarsen_centers.push_back(Point (7./8., 7./8.)); + coarsen_centers.push_back(Point (5./8., 5./8.)); + coarsen_centers.push_back(Point (5./8., 7./8.)); + coarsen_centers.push_back(Point (7./8., 5./8.)); + coarsen_centers.push_back(Point (7./8., 7./8.)); - } + } else if (dim==3) - { - refine_centers.push_back(Point (1./8., 7./8., 1./8.)); - - coarsen_centers.push_back(Point (7./8., 7./8., 7./8.)); - coarsen_centers.push_back(Point (5./8., 7./8., 7./8.)); - coarsen_centers.push_back(Point (7./8., 5./8., 7./8.)); - coarsen_centers.push_back(Point (5./8., 5./8., 7./8.)); - coarsen_centers.push_back(Point (7./8., 7./8., 5./8.)); - coarsen_centers.push_back(Point (5./8., 7./8., 5./8.)); - coarsen_centers.push_back(Point (7./8., 5./8., 5./8.)); - coarsen_centers.push_back(Point (5./8., 5./8., 5./8.)); - } + { + refine_centers.push_back(Point (1./8., 7./8., 1./8.)); + + coarsen_centers.push_back(Point (7./8., 7./8., 7./8.)); + coarsen_centers.push_back(Point (5./8., 7./8., 7./8.)); + coarsen_centers.push_back(Point (7./8., 5./8., 7./8.)); + coarsen_centers.push_back(Point (5./8., 5./8., 7./8.)); + coarsen_centers.push_back(Point (7./8., 7./8., 5./8.)); + coarsen_centers.push_back(Point (5./8., 7./8., 5./8.)); + coarsen_centers.push_back(Point (7./8., 5./8., 5./8.)); + coarsen_centers.push_back(Point (5./8., 5./8., 5./8.)); + } else Assert(false, ExcNotImplemented() ); @@ -90,38 +95,38 @@ void test() cell = triangulation.begin_active(); cell != triangulation.end(); ++cell, ++index) - { - Point cell_bary = cell->barycenter(); - - // refine cells - for (unsigned int i=0; iset_refine_flag (); - break; - } - } - // coarsen cells - for (unsigned int i=0; iset_coarsen_flag (); - break; - } + Point cell_bary = cell->barycenter(); + + // refine cells + for (unsigned int i=0; iset_refine_flag (); + break; + } + } + // coarsen cells + for (unsigned int i=0; iset_coarsen_flag (); + break; + } + } } - } triangulation.execute_coarsening_and_refinement (); } @@ -136,28 +141,28 @@ void test() dof_to_cell_map = GridTools::get_dof_to_support_patch_map(dof_handler); for (unsigned int i=0; i::active_cell_iterator>::iterator - patch_iter = dof_to_cell_map[i].begin(), - patch_iter_end = dof_to_cell_map[i].end(); - for (; patch_iter != patch_iter_end ; ++patch_iter ) - { - typename dealii::DoFHandler::active_cell_iterator patch_cell = *(patch_iter); - Point cell_bary = patch_cell->barycenter(); - deallog << "(" ; - for (unsigned int d=0; d::active_cell_iterator>::iterator + patch_iter = dof_to_cell_map[i].begin(), + patch_iter_end = dof_to_cell_map[i].end(); + for (; patch_iter != patch_iter_end ; ++patch_iter ) + { + typename dealii::DoFHandler::active_cell_iterator patch_cell = *(patch_iter); + Point cell_bary = patch_cell->barycenter(); + deallog << "(" ; + for (unsigned int d=0; d