From 210113708e954598a23d4caeaa093af4c6641aee Mon Sep 17 00:00:00 2001 From: Spencer Patty Date: Wed, 10 Feb 2016 10:47:18 -0600 Subject: [PATCH] add test of FE_Q(2) with dof_to_support_patch_map --- tests/grid/get_dof_to_support_patch_map_01.cc | 186 ++++++++++++++++++ .../get_dof_to_support_patch_map_01.output | 60 ++++++ 2 files changed, 246 insertions(+) create mode 100644 tests/grid/get_dof_to_support_patch_map_01.cc create mode 100644 tests/grid/get_dof_to_support_patch_map_01.output diff --git a/tests/grid/get_dof_to_support_patch_map_01.cc b/tests/grid/get_dof_to_support_patch_map_01.cc new file mode 100644 index 0000000000..fee6dd97e3 --- /dev/null +++ b/tests/grid/get_dof_to_support_patch_map_01.cc @@ -0,0 +1,186 @@ + + +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 - 2016 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// Test GridTools::map_dof_to_support_patch () + + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +using namespace dealii; + + +template +void test() +{ + using namespace dealii; + + Triangulation triangulation (Triangulation::limit_level_difference_at_vertices); + + GridGenerator::hyper_cube(triangulation,0,1); + + triangulation.refine_global (2); + { + + std::vector > refine_centers; + std::vector > coarsen_centers; + + if(dim==1) + { + refine_centers.push_back(Point (1./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.)); + + 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.)); + } + else + Assert(false, ExcNotImplemented() ); + + unsigned int index = 0; + for (typename Triangulation::active_cell_iterator + 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; + } + } + } + triangulation.execute_coarsening_and_refinement (); + + } + + + DoFHandler dof_handler(triangulation); + unsigned int iFEDeg = 2; + FE_Q finite_element(iFEDeg); + dof_handler.distribute_dofs (finite_element); + + std::map< types::global_dof_index, std::vector::active_cell_iterator> > + 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(); + deallog.pop(); + + deallog.push("2d"); + test<2>(); + deallog.pop(); + + deallog.push("3d"); + test<3>(); + deallog.pop(); +} \ No newline at end of file diff --git a/tests/grid/get_dof_to_support_patch_map_01.output b/tests/grid/get_dof_to_support_patch_map_01.output new file mode 100644 index 0000000000..d70a58ecd3 --- /dev/null +++ b/tests/grid/get_dof_to_support_patch_map_01.output @@ -0,0 +1,60 @@ + +DEAL:1d::Patch around dof 0: (0.750000) (0.375000) +DEAL:1d::Patch around dof 1: (0.750000) +DEAL:1d::Patch around dof 2: (0.750000) +DEAL:1d::Patch around dof 3: (0.375000) (0.187500) +DEAL:1d::Patch around dof 4: (0.375000) +DEAL:1d::Patch around dof 5: (0.0625000) +DEAL:1d::Patch around dof 6: (0.0625000) (0.187500) +DEAL:1d::Patch around dof 7: (0.0625000) +DEAL:1d::Patch around dof 8: (0.187500) +DEAL:2d::Patch around dof 0: (0.750000, 0.750000) (0.375000, 0.375000) (0.625000, 0.375000) (0.875000, 0.375000) (0.375000, 0.625000) (0.375000, 0.875000) +DEAL:2d::Patch around dof 5: (0.750000, 0.750000) +DEAL:2d::Patch around dof 10: (0.125000, 0.125000) (0.375000, 0.125000) +DEAL:2d::Patch around dof 15: (0.125000, 0.125000) +DEAL:2d::Patch around dof 20: (0.375000, 0.125000) (0.625000, 0.125000) +DEAL:2d::Patch around dof 25: (0.125000, 0.375000) (0.375000, 0.375000) (0.125000, 0.625000) (0.375000, 0.625000) +DEAL:2d::Patch around dof 30: (0.375000, 0.375000) (0.625000, 0.375000) +DEAL:2d::Patch around dof 35: (0.625000, 0.125000) (0.875000, 0.125000) +DEAL:2d::Patch around dof 40: (0.875000, 0.125000) (0.875000, 0.375000) +DEAL:2d::Patch around dof 45: (0.750000, 0.750000) (0.625000, 0.375000) (0.875000, 0.375000) +DEAL:2d::Patch around dof 50: (0.750000, 0.750000) (0.625000, 0.375000) (0.875000, 0.375000) +DEAL:2d::Patch around dof 55: (0.125000, 0.625000) (0.375000, 0.625000) +DEAL:2d::Patch around dof 60: (0.375000, 0.625000) (0.375000, 0.875000) +DEAL:2d::Patch around dof 65: (0.375000, 0.875000) +DEAL:2d::Patch around dof 70: (0.0625000, 0.812500) +DEAL:2d::Patch around dof 75: (0.375000, 0.875000) (0.187500, 0.812500) (0.187500, 0.937500) +DEAL:2d::Patch around dof 80: (0.0625000, 0.937500) +DEAL:2d::Patch around dof 85: (0.0625000, 0.937500) +DEAL:3d::Patch around dof 0: (0.750000, 0.750000, 0.750000) (0.375000, 0.375000, 0.375000) (0.625000, 0.375000, 0.375000) (0.875000, 0.375000, 0.375000) (0.375000, 0.625000, 0.375000) (0.375000, 0.875000, 0.375000) (0.625000, 0.625000, 0.375000) (0.875000, 0.625000, 0.375000) (0.625000, 0.875000, 0.375000) (0.875000, 0.875000, 0.375000) (0.375000, 0.375000, 0.625000) (0.375000, 0.375000, 0.875000) (0.625000, 0.375000, 0.625000) (0.875000, 0.375000, 0.625000) (0.625000, 0.375000, 0.875000) (0.875000, 0.375000, 0.875000) (0.375000, 0.625000, 0.625000) (0.375000, 0.875000, 0.625000) (0.375000, 0.625000, 0.875000) (0.375000, 0.875000, 0.875000) +DEAL:3d::Patch around dof 25: (0.750000, 0.750000, 0.750000) +DEAL:3d::Patch around dof 50: (0.125000, 0.125000, 0.125000) (0.125000, 0.375000, 0.125000) +DEAL:3d::Patch around dof 75: (0.125000, 0.375000, 0.125000) (0.375000, 0.375000, 0.125000) (0.125000, 0.375000, 0.375000) (0.375000, 0.375000, 0.375000) (0.125000, 0.625000, 0.125000) (0.375000, 0.625000, 0.125000) (0.125000, 0.625000, 0.375000) (0.375000, 0.625000, 0.375000) +DEAL:3d::Patch around dof 100: (0.375000, 0.375000, 0.125000) (0.375000, 0.375000, 0.375000) +DEAL:3d::Patch around dof 125: (0.375000, 0.125000, 0.375000) (0.625000, 0.125000, 0.375000) +DEAL:3d::Patch around dof 150: (0.375000, 0.375000, 0.375000) +DEAL:3d::Patch around dof 175: (0.875000, 0.125000, 0.125000) (0.875000, 0.375000, 0.125000) +DEAL:3d::Patch around dof 200: (0.875000, 0.375000, 0.125000) (0.875000, 0.375000, 0.375000) (0.875000, 0.625000, 0.125000) (0.875000, 0.625000, 0.375000) +DEAL:3d::Patch around dof 225: (0.875000, 0.125000, 0.375000) (0.875000, 0.125000, 0.625000) +DEAL:3d::Patch around dof 250: (0.125000, 0.625000, 0.125000) (0.0625000, 0.812500, 0.0625000) (0.187500, 0.812500, 0.0625000) (0.0625000, 0.812500, 0.187500) (0.187500, 0.812500, 0.187500) +DEAL:3d::Patch around dof 275: (0.375000, 0.625000, 0.125000) (0.625000, 0.625000, 0.125000) +DEAL:3d::Patch around dof 300: (0.125000, 0.625000, 0.375000) (0.125000, 0.625000, 0.625000) +DEAL:3d::Patch around dof 325: (0.125000, 0.875000, 0.375000) (0.125000, 0.875000, 0.625000) +DEAL:3d::Patch around dof 350: (0.625000, 0.625000, 0.125000) +DEAL:3d::Patch around dof 375: (0.625000, 0.875000, 0.125000) (0.625000, 0.875000, 0.375000) +DEAL:3d::Patch around dof 400: (0.875000, 0.625000, 0.375000) (0.875000, 0.875000, 0.375000) +DEAL:3d::Patch around dof 425: (0.125000, 0.125000, 0.625000) (0.375000, 0.125000, 0.625000) (0.125000, 0.125000, 0.875000) (0.375000, 0.125000, 0.875000) +DEAL:3d::Patch around dof 450: (0.125000, 0.375000, 0.625000) (0.125000, 0.375000, 0.875000) (0.125000, 0.625000, 0.625000) (0.125000, 0.625000, 0.875000) +DEAL:3d::Patch around dof 475: (0.125000, 0.125000, 0.875000) (0.375000, 0.125000, 0.875000) +DEAL:3d::Patch around dof 500: (0.125000, 0.375000, 0.875000) (0.125000, 0.625000, 0.875000) +DEAL:3d::Patch around dof 525: (0.625000, 0.125000, 0.625000) (0.875000, 0.125000, 0.625000) (0.625000, 0.375000, 0.625000) (0.875000, 0.375000, 0.625000) +DEAL:3d::Patch around dof 550: (0.625000, 0.375000, 0.625000) +DEAL:3d::Patch around dof 575: (0.875000, 0.125000, 0.875000) (0.875000, 0.375000, 0.875000) +DEAL:3d::Patch around dof 600: (0.125000, 0.625000, 0.625000) (0.125000, 0.625000, 0.875000) +DEAL:3d::Patch around dof 625: (0.125000, 0.875000, 0.625000) +DEAL:3d::Patch around dof 650: (0.750000, 0.750000, 0.750000) (0.375000, 0.625000, 0.625000) (0.375000, 0.875000, 0.625000) (0.375000, 0.625000, 0.875000) (0.375000, 0.875000, 0.875000) +DEAL:3d::Patch around dof 675: (0.375000, 0.875000, 0.875000) +DEAL:3d::Patch around dof 700: (0.0625000, 0.812500, 0.0625000) +DEAL:3d::Patch around dof 725: (0.0625000, 0.937500, 0.0625000) (0.187500, 0.937500, 0.0625000) +DEAL:3d::Patch around dof 750: (0.125000, 0.875000, 0.375000) (0.0625000, 0.812500, 0.187500) (0.187500, 0.812500, 0.187500) (0.0625000, 0.937500, 0.187500) (0.187500, 0.937500, 0.187500) +DEAL:3d::Patch around dof 775: (0.125000, 0.875000, 0.375000) (0.0625000, 0.812500, 0.187500) (0.187500, 0.812500, 0.187500) (0.0625000, 0.937500, 0.187500) (0.187500, 0.937500, 0.187500) -- 2.39.5