]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added mapping_q1_eulerian support
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 27 Apr 2009 17:12:05 +0000 (17:12 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 27 Apr 2009 17:12:05 +0000 (17:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@18755 0785d39b-7218-0410-832d-ea1e28bc413d

tests/codim_one/mapping_q1_eulerian.cc [new file with mode: 0644]

diff --git a/tests/codim_one/mapping_q1_eulerian.cc b/tests/codim_one/mapping_q1_eulerian.cc
new file mode 100644 (file)
index 0000000..96219dc
--- /dev/null
@@ -0,0 +1,90 @@
+
+//----------------------------  template.cc  ---------------------------
+//    $Id: testsuite.html 13373 2006-07-13 13:12:08Z kanschat $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005, 2009 by the deal.II authors 
+//
+//    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.
+//
+//----------------------------  template.cc  ---------------------------
+
+
+// computes points in real space starting from some quadrature points on the unit element
+
+#include "../tests.h"
+#include <fstream>
+#include <base/logstream.h>
+
+// all include files you need here
+
+#include <grid/tria.h>
+#include <grid/grid_in.h>
+#include <grid/grid_out.h>
+#include <dofs/dof_handler.h>
+#include <fe/mapping.h>
+#include <fe/fe_system.h>
+#include <fe/fe_q.h>
+#include <fe/mapping_q1_eulerian.h>
+#include <base/quadrature_lib.h>
+
+#include <fstream>
+#include <string>
+
+std::ofstream logfile("mapping_q1_eulerian/output");
+
+template <int dim, int spacedim>
+void test(std::string filename) {
+  Triangulation<dim, spacedim> tria;
+  DoFHandler<dim, spacedim> shift_dh(tria);
+  FE_Q<dim, spacedim> base_fe(1);
+  FESystem<dim, spacedim> fe(base_fe, spacedim);
+  
+  GridIn<dim, spacedim> gi;
+  gi.attach_triangulation (tria);
+  std::ifstream in (filename.c_str());
+  gi.read_ucd (in);
+
+  shift_dh.distribute_dofs(fe);
+  
+  Vector<double> shift(shift_dh.n_dofs());
+
+  GridOut grid_out;
+  grid_out.set_flags (GridOutFlags::Ucd(true));
+  grid_out.write_ucd (tria, logfile);
+
+  QTrapez<dim> quad;
+  MappingQ1Eulerian<dim,Vector<double>,spacedim> mapping(shift, shift_dh);
+  
+  typename Triangulation<dim,spacedim>::active_cell_iterator cell=tria.begin_active(), 
+    endc=tria.end() ;
+  Point<spacedim> real;
+  Point<dim> unit;
+  for(;cell!=endc;++cell)
+    {
+      deallog<<cell<< std::endl;       
+      for(unsigned int q=0; q<quad.n_quadrature_points; ++q)
+       {
+         real = mapping.transform_unit_to_real_cell(cell, quad.point(q));
+         // unit = mapping.transform_real_to_unit_cell(cell, real);
+         deallog<<quad.point(q)<< " -> " << real << std::endl;
+       }
+    }     
+    
+}
+
+int main () 
+{
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  test<1,2>("grids/circle_1.inp");
+  test<2,3>("grids/square.inp");
+  test<2,3>("grids/sphere_1.inp");
+
+  return 0;
+}
+                  

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.