]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add new test to check for intergrid constraints. Does not really work yet, but have...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 Dec 2000 14:34:15 +0000 (14:34 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 Dec 2000 14:34:15 +0000 (14:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@3560 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/Makefile.in
tests/deal.II/intergrid_constraints.cc [new file with mode: 0644]

index 449e44d2b7c39b8127bdb472f79abce4d64f8e8b..a247d53ca8e2b5cb9dc81242ebef83913c4639f0 100644 (file)
@@ -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 (file)
index 0000000..a4b37e0
--- /dev/null
@@ -0,0 +1,116 @@
+/* $Id$ */
+/* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */
+/* 
+   Purpose: check some things with the intergrid map
+*/
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_constraints.h>
+#include <dofs/dof_tools.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_handler.h>
+#include <grid/intergrid_map.h>
+#include <fe/fe_lib.lagrange.h>
+#include <fe/fe_lib.dg.h>
+#include <fe/fe_system.h>
+
+#include <fstream>
+
+
+template <int dim>
+void check ()
+{
+  deallog << "Checking in " << dim << " space dimensions"
+         << endl
+         << "---------------------------------------" << endl;
+  
+                                  // create two grids
+  Triangulation<dim> 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<dim> fe_linear;
+  const FEQ2<dim> fe_quadratic;
+  const FEDG_Q2<dim> fe_dq_quadratic;
+  const FESystem<dim> fe_1 (fe_dq_quadratic, 3,
+                           fe_quadratic, 2,
+                           fe_linear, 1);
+  const FESystem<dim> 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<dim> dof_1 (tria_1);
+      DoFHandler<dim> dof_2 (tria_2);
+
+      dof_1.distribute_dofs (fe_1);
+      dof_2.distribute_dofs (fe_2);
+
+                                      // now compute intergrid
+                                      // constraints
+      InterGridMap<DoFHandler,dim> 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<dim>::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> ();
+};
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.