From 32af4ecde8ac1839f4f1e011c2a6d29d091c0f97 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 18 Dec 2000 14:34:15 +0000 Subject: [PATCH] Add new test to check for intergrid constraints. Does not really work yet, but have to check it in to finish it in another directory. git-svn-id: https://svn.dealii.org/trunk@3560 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/Makefile.in | 16 ++++ tests/deal.II/intergrid_constraints.cc | 116 +++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 tests/deal.II/intergrid_constraints.cc diff --git a/tests/deal.II/Makefile.in b/tests/deal.II/Makefile.in index 449e44d2b7..a247d53ca8 100644 --- a/tests/deal.II/Makefile.in +++ b/tests/deal.II/Makefile.in @@ -300,6 +300,22 @@ intergrid_map.testcase: $(intergrid_map-o-files) $(libraries) @$(CXX) $(LDFLAGS) -g -o $@ $^ $(LIBS) $(lib-deal2-1d.g) $(lib-deal2-3d.g) +############################################################ + + +intergrid_constraints-cc-files = intergrid_constraints.cc + +ifeq ($(debug-mode),on) +intergrid_constraints-o-files = $(intergrid_constraints-cc-files:.cc=.go) +else +intergrid_constraints-o-files = $(intergrid_constraints-cc-files:.cc=.o) +endif + +intergrid_constraints.testcase: $(intergrid_constraints-o-files) $(libraries) + @echo =====linking======= $< + @$(CXX) $(LDFLAGS) -g -o $@ $^ $(LIBS) $(lib-deal2-1d.g) $(lib-deal2-3d.g) + + ############################################################ # Continue with other targets if needed ############################################################ diff --git a/tests/deal.II/intergrid_constraints.cc b/tests/deal.II/intergrid_constraints.cc new file mode 100644 index 0000000000..a4b37e0cfa --- /dev/null +++ b/tests/deal.II/intergrid_constraints.cc @@ -0,0 +1,116 @@ +/* $Id$ */ +/* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */ +/* + Purpose: check some things with the intergrid map +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +template +void check () +{ + deallog << "Checking in " << dim << " space dimensions" + << endl + << "---------------------------------------" << endl; + + // create two grids + Triangulation tria_1, tria_2; + GridGenerator::hyper_cube (tria_1, -1, 1); + tria_1.refine_global (5-dim); + tria_2.copy_triangulation (tria_1); + + // create two different fe's + const FEQ1 fe_linear; + const FEQ2 fe_quadratic; + const FEDG_Q2 fe_dq_quadratic; + const FESystem fe_1 (fe_dq_quadratic, 3, + fe_quadratic, 2, + fe_linear, 1); + const FESystem fe_2 (fe_quadratic, 1, + fe_linear, 2, + fe_dq_quadratic, 1); + + + // make several loops to refine the + // two grids + for (unsigned int i=0; i<3; ++i) + { + deallog << "Refinement step " << i << endl; + + DoFHandler dof_1 (tria_1); + DoFHandler dof_2 (tria_2); + + dof_1.distribute_dofs (fe_1); + dof_2.distribute_dofs (fe_2); + + // now compute intergrid + // constraints + InterGridMap intergrid_map; + intergrid_map.make_mapping (dof_1, dof_2); + ConstraintMatrix intergrid_constraints; + DoFTools::compute_intergrid_constraints (dof_1, 4, dof_2, 0, + intergrid_map, + intergrid_constraints); + + + + // now refine grids a little, + // but differently. this + // produces quite random grids + DoFHandler::cell_iterator cell, endc; + cell = dof_1.begin(); + endc = dof_1.end(); + for (unsigned int index=0; cell!=endc; ++cell) + if (cell->active()) + { + ++index; + if (index % 3 == 0) + cell->set_refine_flag (); + }; + + cell = dof_2.begin(); + endc = dof_2.end(); + for (unsigned int index=0; cell!=endc; ++cell) + if (cell->active()) + { + ++index; + if (index % 3 == 1) + cell->set_refine_flag (); + }; + + tria_1.execute_coarsening_and_refinement (); + tria_2.execute_coarsening_and_refinement (); + }; +}; + + + +int main () +{ + ofstream logfile("intergrid_map.output"); + logfile.precision(4); + + deallog.attach(logfile); + deallog.depth_console(0); + + check<1> (); + check<2> (); + check<3> (); +}; + -- 2.39.5