]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
As anna_1, but renumber in opposit direction.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 17 Oct 2002 19:59:45 +0000 (19:59 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 17 Oct 2002 19:59:45 +0000 (19:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@6684 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/Makefile
tests/fe/anna_2.cc [new file with mode: 0644]
tests/fe/anna_2.checked [new file with mode: 0644]

index a063e4ed29325edd5abad61e2da9ddbbbf567d54..d6fcfbdb0bef7ce040efa4285842d559d073ca45 100644 (file)
@@ -40,12 +40,13 @@ shapes.exe              : shapes.go              $(libraries)
 transfer.exe           : transfer.go            $(libraries)
 up_and_down.exe         : up_and_down.go        $(libraries)
 anna_1.exe              : anna_1.go              $(libraries)
+anna_2.exe              : anna_2.go              $(libraries)
 
 tests = derivatives fe_data_test fe_traits fe_tools_test mapping \
         mapping_c1 shapes numbering mapping_q1_eulerian \
         transfer internals \
         non_primitive_1 non_primitive_2 \
-        nedelec nedelec_2 nedelec_3 up_and_down anna_1
+        nedelec nedelec_2 nedelec_3 up_and_down anna_1 anna_2
 
 ############################################################
 
diff --git a/tests/fe/anna_2.cc b/tests/fe/anna_2.cc
new file mode 100644 (file)
index 0000000..c70b93a
--- /dev/null
@@ -0,0 +1,169 @@
+//----------------------------  non_primitive_1.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2002 by the deal.II authors and Anna Schneebeli
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  non_primitive_1.cc  ---------------------------
+
+
+// check some things about Nedelec elements, basically also that the
+// DoFRenumbering::component_wise function also works for
+// non_primitive elements, for which it did not work previously since
+// there is no component to associate a non-primitive shape function
+// with
+//
+// this program is similar to anna_1, except that it tests the
+// component_wise function with a different order of components than
+// the default is.
+//
+// this program is a modified version of one by Anna Schneebeli,
+// University of Basel
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <dofs/dof_handler.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_system.h>              
+#include <fe/fe_q.h>
+#include <fe/fe_nedelec.h>
+#include <fe/fe_base.h>
+#include <numerics/dof_renumbering.h>
+#include <iostream>
+#include <fstream>
+
+
+template <int dim>
+class SystemTest 
+{
+  public:
+    SystemTest ();
+    void run ();    
+                                   
+  private:
+    void make_grid_and_dofs ();
+    void shape_to_components ();
+    void check_numbering ();
+
+                                   
+    Triangulation<dim>     triangulation;
+    FESystem<dim>          fe;
+    DoFHandler<dim>        dof_handler;
+
+                                  
+};
+
+template <int dim>
+SystemTest<dim>::SystemTest () :
+                fe (FE_Nedelec<dim>(1), 2,
+                    FE_Q<dim>(1), 1),
+               dof_handler (triangulation)
+{};
+
+
+template <int dim>
+void SystemTest<dim>::make_grid_and_dofs ()
+{
+                                 
+  GridGenerator::hyper_cube (triangulation, -1, 1);
+  triangulation.refine_global (0);
+  deallog << "Number of active cells: " << triangulation.n_active_cells()
+          << std::endl;
+  deallog << "Total number of cells: " << triangulation.n_cells()
+          << std::endl;
+                                 
+  dof_handler.distribute_dofs (fe);
+  deallog << "Number of degrees of freedom: " << dof_handler.n_dofs()
+          << std::endl;
+                                 
+};
+
+template <int dim>
+void SystemTest<dim>::shape_to_components () 
+{
+                                   // testing, if the shape function
+                                   // with index i is of type Nedelec:
+                                   // (i.e. the first component of the FESystem)
+                                   // 1 for yes, 0 for no.
+   
+  for(unsigned int i = 0; i<fe.dofs_per_cell; i++)
+    deallog <<"  shapefunction "<< i << " is Nedelec:  "
+            << (fe.is_primitive(i) ? "false" : "true") << std::endl;
+};
+
+
+
+template <int dim>
+void SystemTest<dim>::check_numbering () 
+{
+  DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(),
+                                      endc = dof_handler.end();
+  std::vector<unsigned int>    local_dof_indices(fe.dofs_per_cell);
+       
+  for (; cell!=endc; ++cell)
+    {
+      cell->get_dof_indices (local_dof_indices);
+      for (unsigned int i=0; i<fe.dofs_per_cell; i++)
+        deallog <<"  DoF "<< local_dof_indices[i] << " belongs to base element " 
+                << fe.system_to_base_index(i).first.first
+                << ", instance " << fe.system_to_base_index(i).first.second
+                << std::endl;
+      deallog<< std::endl;
+    };
+        
+        
+                                   //Now: Componentwise reodering of the dofs
+       
+  deallog << "  Now we renumber the DoFs anti-component-wise:" << std::endl;
+  deallog << "  *********************************************" << std::endl;
+  std::vector<unsigned int> comp(fe.n_components());
+  for (unsigned int i=0; i<comp.size(); ++i)
+    comp[i] = comp.size()-i-1;
+  DoFRenumbering::component_wise (dof_handler, comp);
+       
+  cell = dof_handler.begin_active();
+  endc = dof_handler.end();
+       
+  for (; cell!=endc; ++cell)
+    {
+      cell->get_dof_indices (local_dof_indices);
+      for(unsigned int i=0; i<fe.dofs_per_cell; i++)
+        deallog <<"  DoF "<< local_dof_indices[i] << " belongs to base " 
+                << fe.system_to_base_index(i).first.first
+                << ", instance " << fe.system_to_base_index(i).first.second
+                << std::endl;
+      deallog << std::endl;
+    };
+       
+};
+
+
+template <int dim>
+void SystemTest<dim>::run () 
+{
+  make_grid_and_dofs ();
+  shape_to_components ();
+  check_numbering();
+};
+
+    
+
+int main () 
+{
+  std::ofstream logfile("anna_2.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  SystemTest<2>().run();
+  SystemTest<3>().run();  
+  return 0;
+};
diff --git a/tests/fe/anna_2.checked b/tests/fe/anna_2.checked
new file mode 100644 (file)
index 0000000..95cda6c
--- /dev/null
@@ -0,0 +1,147 @@
+
+DEAL::Number of active cells: 1
+DEAL::Total number of cells: 1
+DEAL::Number of degrees of freedom: 12
+DEAL::  shapefunction 0 is Nedelec:  false
+DEAL::  shapefunction 1 is Nedelec:  false
+DEAL::  shapefunction 2 is Nedelec:  false
+DEAL::  shapefunction 3 is Nedelec:  false
+DEAL::  shapefunction 4 is Nedelec:  true
+DEAL::  shapefunction 5 is Nedelec:  true
+DEAL::  shapefunction 6 is Nedelec:  true
+DEAL::  shapefunction 7 is Nedelec:  true
+DEAL::  shapefunction 8 is Nedelec:  true
+DEAL::  shapefunction 9 is Nedelec:  true
+DEAL::  shapefunction 10 is Nedelec:  true
+DEAL::  shapefunction 11 is Nedelec:  true
+DEAL::  DoF 0 belongs to base element 1, instance 0
+DEAL::  DoF 1 belongs to base element 1, instance 0
+DEAL::  DoF 2 belongs to base element 1, instance 0
+DEAL::  DoF 3 belongs to base element 1, instance 0
+DEAL::  DoF 4 belongs to base element 0, instance 0
+DEAL::  DoF 5 belongs to base element 0, instance 1
+DEAL::  DoF 6 belongs to base element 0, instance 0
+DEAL::  DoF 7 belongs to base element 0, instance 1
+DEAL::  DoF 8 belongs to base element 0, instance 0
+DEAL::  DoF 9 belongs to base element 0, instance 1
+DEAL::  DoF 10 belongs to base element 0, instance 0
+DEAL::  DoF 11 belongs to base element 0, instance 1
+DEAL::
+DEAL::  Now we renumber the DoFs anti-component-wise:
+DEAL::  *********************************************
+DEAL::  DoF 0 belongs to base 1, instance 0
+DEAL::  DoF 1 belongs to base 1, instance 0
+DEAL::  DoF 2 belongs to base 1, instance 0
+DEAL::  DoF 3 belongs to base 1, instance 0
+DEAL::  DoF 8 belongs to base 0, instance 0
+DEAL::  DoF 4 belongs to base 0, instance 1
+DEAL::  DoF 9 belongs to base 0, instance 0
+DEAL::  DoF 5 belongs to base 0, instance 1
+DEAL::  DoF 10 belongs to base 0, instance 0
+DEAL::  DoF 6 belongs to base 0, instance 1
+DEAL::  DoF 11 belongs to base 0, instance 0
+DEAL::  DoF 7 belongs to base 0, instance 1
+DEAL::
+DEAL::Number of active cells: 1
+DEAL::Total number of cells: 1
+DEAL::Number of degrees of freedom: 32
+DEAL::  shapefunction 0 is Nedelec:  false
+DEAL::  shapefunction 1 is Nedelec:  false
+DEAL::  shapefunction 2 is Nedelec:  false
+DEAL::  shapefunction 3 is Nedelec:  false
+DEAL::  shapefunction 4 is Nedelec:  false
+DEAL::  shapefunction 5 is Nedelec:  false
+DEAL::  shapefunction 6 is Nedelec:  false
+DEAL::  shapefunction 7 is Nedelec:  false
+DEAL::  shapefunction 8 is Nedelec:  true
+DEAL::  shapefunction 9 is Nedelec:  true
+DEAL::  shapefunction 10 is Nedelec:  true
+DEAL::  shapefunction 11 is Nedelec:  true
+DEAL::  shapefunction 12 is Nedelec:  true
+DEAL::  shapefunction 13 is Nedelec:  true
+DEAL::  shapefunction 14 is Nedelec:  true
+DEAL::  shapefunction 15 is Nedelec:  true
+DEAL::  shapefunction 16 is Nedelec:  true
+DEAL::  shapefunction 17 is Nedelec:  true
+DEAL::  shapefunction 18 is Nedelec:  true
+DEAL::  shapefunction 19 is Nedelec:  true
+DEAL::  shapefunction 20 is Nedelec:  true
+DEAL::  shapefunction 21 is Nedelec:  true
+DEAL::  shapefunction 22 is Nedelec:  true
+DEAL::  shapefunction 23 is Nedelec:  true
+DEAL::  shapefunction 24 is Nedelec:  true
+DEAL::  shapefunction 25 is Nedelec:  true
+DEAL::  shapefunction 26 is Nedelec:  true
+DEAL::  shapefunction 27 is Nedelec:  true
+DEAL::  shapefunction 28 is Nedelec:  true
+DEAL::  shapefunction 29 is Nedelec:  true
+DEAL::  shapefunction 30 is Nedelec:  true
+DEAL::  shapefunction 31 is Nedelec:  true
+DEAL::  DoF 0 belongs to base element 1, instance 0
+DEAL::  DoF 1 belongs to base element 1, instance 0
+DEAL::  DoF 2 belongs to base element 1, instance 0
+DEAL::  DoF 3 belongs to base element 1, instance 0
+DEAL::  DoF 4 belongs to base element 1, instance 0
+DEAL::  DoF 5 belongs to base element 1, instance 0
+DEAL::  DoF 6 belongs to base element 1, instance 0
+DEAL::  DoF 7 belongs to base element 1, instance 0
+DEAL::  DoF 8 belongs to base element 0, instance 0
+DEAL::  DoF 9 belongs to base element 0, instance 1
+DEAL::  DoF 10 belongs to base element 0, instance 0
+DEAL::  DoF 11 belongs to base element 0, instance 1
+DEAL::  DoF 12 belongs to base element 0, instance 0
+DEAL::  DoF 13 belongs to base element 0, instance 1
+DEAL::  DoF 14 belongs to base element 0, instance 0
+DEAL::  DoF 15 belongs to base element 0, instance 1
+DEAL::  DoF 16 belongs to base element 0, instance 0
+DEAL::  DoF 17 belongs to base element 0, instance 1
+DEAL::  DoF 18 belongs to base element 0, instance 0
+DEAL::  DoF 19 belongs to base element 0, instance 1
+DEAL::  DoF 20 belongs to base element 0, instance 0
+DEAL::  DoF 21 belongs to base element 0, instance 1
+DEAL::  DoF 22 belongs to base element 0, instance 0
+DEAL::  DoF 23 belongs to base element 0, instance 1
+DEAL::  DoF 24 belongs to base element 0, instance 0
+DEAL::  DoF 25 belongs to base element 0, instance 1
+DEAL::  DoF 26 belongs to base element 0, instance 0
+DEAL::  DoF 27 belongs to base element 0, instance 1
+DEAL::  DoF 28 belongs to base element 0, instance 0
+DEAL::  DoF 29 belongs to base element 0, instance 1
+DEAL::  DoF 30 belongs to base element 0, instance 0
+DEAL::  DoF 31 belongs to base element 0, instance 1
+DEAL::
+DEAL::  Now we renumber the DoFs anti-component-wise:
+DEAL::  *********************************************
+DEAL::  DoF 0 belongs to base 1, instance 0
+DEAL::  DoF 1 belongs to base 1, instance 0
+DEAL::  DoF 2 belongs to base 1, instance 0
+DEAL::  DoF 3 belongs to base 1, instance 0
+DEAL::  DoF 4 belongs to base 1, instance 0
+DEAL::  DoF 5 belongs to base 1, instance 0
+DEAL::  DoF 6 belongs to base 1, instance 0
+DEAL::  DoF 7 belongs to base 1, instance 0
+DEAL::  DoF 20 belongs to base 0, instance 0
+DEAL::  DoF 8 belongs to base 0, instance 1
+DEAL::  DoF 21 belongs to base 0, instance 0
+DEAL::  DoF 9 belongs to base 0, instance 1
+DEAL::  DoF 22 belongs to base 0, instance 0
+DEAL::  DoF 10 belongs to base 0, instance 1
+DEAL::  DoF 23 belongs to base 0, instance 0
+DEAL::  DoF 11 belongs to base 0, instance 1
+DEAL::  DoF 24 belongs to base 0, instance 0
+DEAL::  DoF 12 belongs to base 0, instance 1
+DEAL::  DoF 25 belongs to base 0, instance 0
+DEAL::  DoF 13 belongs to base 0, instance 1
+DEAL::  DoF 26 belongs to base 0, instance 0
+DEAL::  DoF 14 belongs to base 0, instance 1
+DEAL::  DoF 27 belongs to base 0, instance 0
+DEAL::  DoF 15 belongs to base 0, instance 1
+DEAL::  DoF 28 belongs to base 0, instance 0
+DEAL::  DoF 16 belongs to base 0, instance 1
+DEAL::  DoF 29 belongs to base 0, instance 0
+DEAL::  DoF 17 belongs to base 0, instance 1
+DEAL::  DoF 30 belongs to base 0, instance 0
+DEAL::  DoF 18 belongs to base 0, instance 1
+DEAL::  DoF 31 belongs to base 0, instance 0
+DEAL::  DoF 19 belongs to base 0, instance 1
+DEAL::

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.