From: Wolfgang Bangerth Date: Wed, 11 Jan 2017 20:19:47 +0000 (-0700) Subject: Add test. X-Git-Tag: v8.5.0-rc1~263^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f6fb676ea302a5848a9c4e340d723a1677824d4;p=dealii.git Add test. --- diff --git a/tests/hp/face_domination_03.cc b/tests/hp/face_domination_03.cc new file mode 100644 index 0000000000..584b4ee695 --- /dev/null +++ b/tests/hp/face_domination_03.cc @@ -0,0 +1,112 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 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. +// +// --------------------------------------------------------------------- + +// Make sure both sides of a face know which of the two elements dominates + + +#include "../tests.h" +#include + +#include +#include +#include +#include +#include +#include + + + +template +class MixedFECollection +{ +public: + MixedFECollection (); + ~MixedFECollection (); + + void run (); + + Triangulation triangulation; + + FESystem continuous_fe; + FESystem discontinuous_fe; + + hp::DoFHandler dof_handler; + hp::FECollection fe_collection; +}; + +template +MixedFECollection::MixedFECollection () + : + continuous_fe(FE_Q(1), dim), + discontinuous_fe(FE_DGQ(1), dim), + dof_handler (triangulation) +{ + +} + +template +MixedFECollection::~MixedFECollection () +{ + dof_handler.clear (); +} + +template +void MixedFECollection::run () +{ + // add two a CG and a DG finite element object to fe_collection + fe_collection.push_back (continuous_fe); + fe_collection.push_back (discontinuous_fe); + + // produce a simple grid with 16 cells + GridGenerator::hyper_cube (triangulation, -1, 1); + triangulation.refine_global (2); + + // looping over all cells and assigning the FE_DG object to the first cell that comes up -- works. + // looping over all cells and assigning the FE_DG object to the interior cells -- doesn't work. + typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + { + // if (cell == dof_handler.begin_active()) // this works + if (cell->center().norm() < 0.5) // this doesn't + { + cell->set_active_fe_index (cell->active_fe_index() + 1); + } + deallog << cell->center() << "\t" << cell->active_fe_index() << std::endl; + } + + dof_handler.distribute_dofs (fe_collection); + + deallog << " Number of active cells: " << triangulation.n_active_cells() << std::endl + << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl + << " Number of vertices: " << triangulation.n_vertices() << std::endl; +} + + + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + MixedFECollection<2> mixed_FECollection_problem; + mixed_FECollection_problem.run (); + +} + + + diff --git a/tests/hp/face_domination_03.output b/tests/hp/face_domination_03.output new file mode 100644 index 0000000000..e8139fd005 --- /dev/null +++ b/tests/hp/face_domination_03.output @@ -0,0 +1,17 @@ +JobId up.math.colostate.edu Wed Jan 11 13:08:56 2017 +DEAL::-0.750000 -0.750000 0 +DEAL::-0.250000 -0.750000 0 +DEAL::-0.750000 -0.250000 0 +DEAL::-0.250000 -0.250000 1 +DEAL::0.250000 -0.750000 0 +DEAL::0.750000 -0.750000 0 +DEAL::0.250000 -0.250000 1 +DEAL::0.750000 -0.250000 0 +DEAL::-0.750000 0.250000 0 +DEAL::-0.250000 0.250000 1 +DEAL::-0.750000 0.750000 0 +DEAL::-0.250000 0.750000 0 +DEAL::0.250000 0.250000 1 +DEAL::0.750000 0.250000 0 +DEAL::0.250000 0.750000 0 +DEAL::0.750000 0.750000 0