]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests for VectorTools::create_point_source_vector.
authorMarkus Buerg <buerg@math.tamu.edu>
Sun, 6 May 2012 10:08:41 +0000 (10:08 +0000)
committerMarkus Buerg <buerg@math.tamu.edu>
Sun, 6 May 2012 10:08:41 +0000 (10:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@25498 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/create_point_source.cc [new file with mode: 0644]
tests/deal.II/create_point_source/cmp/generic [new file with mode: 0644]
tests/deal.II/create_point_source_hp.cc [new file with mode: 0644]
tests/deal.II/create_point_source_hp/cmp/generic [new file with mode: 0644]

diff --git a/tests/deal.II/create_point_source.cc b/tests/deal.II/create_point_source.cc
new file mode 100644 (file)
index 0000000..23149c6
--- /dev/null
@@ -0,0 +1,74 @@
+//---------------------------  create_point_source.cc  --------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2012 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.
+//
+//---------------------------  create_point_source.cc  --------------------------
+
+
+// Test the function VectorTools::create_point_source_vector.
+
+
+
+#include "../tests.h"
+#include<deal.II/dofs/dof_handler.h>
+#include<deal.II/fe/fe_q.h>
+#include<deal.II/fe/fe_system.h>
+#include<deal.II/grid/grid_generator.h>
+#include<deal.II/grid/tria.h>
+#include<deal.II/numerics/vectors.h>
+
+#include<fstream>
+
+
+
+
+template <int dim>
+void
+check ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube (tria);
+  FESystem<dim> fe (FE_Q<dim> (2), dim);
+  DoFHandler<dim> dof (tria);
+  dof.distribute_dofs (fe);
+  Point<dim> orientation;
+  Point<dim> p (tria.begin_active ()->center ());
+  
+  for (unsigned int i = 0; i < dim; ++i)
+    orientation (i) = i;
+  
+  Vector<double> vector (dof.n_dofs ());
+  
+  VectorTools::create_point_source_vector (dof, p, orientation, vector);
+
+  for (unsigned int i = 0; i < dof.n_dofs(); ++i)
+    deallog << vector (i) << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile ("create_point_source/output");
+  deallog << std::setprecision (2);
+  deallog << std::fixed;  
+  deallog.attach(logfile);
+  deallog.depth_console (0);
+
+  deallog.push ("1d");
+  check<1> ();
+  deallog.pop ();
+  deallog.push ("2d");
+  check<2> ();
+  deallog.pop ();
+  deallog.push ("3d");
+  check<3> ();
+  deallog.pop ();
+}
diff --git a/tests/deal.II/create_point_source/cmp/generic b/tests/deal.II/create_point_source/cmp/generic
new file mode 100644 (file)
index 0000000..9360d5a
--- /dev/null
@@ -0,0 +1,103 @@
+
+DEAL:1d::0.00
+DEAL:1d::0.00
+DEAL:1d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.00
+DEAL:2d::1.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::0.00
+DEAL:3d::1.00
+DEAL:3d::2.00
diff --git a/tests/deal.II/create_point_source_hp.cc b/tests/deal.II/create_point_source_hp.cc
new file mode 100644 (file)
index 0000000..de95c4a
--- /dev/null
@@ -0,0 +1,79 @@
+//--------------------------  create_point_source_hp.cc  -------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2012 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.
+//
+//--------------------------  create_point_source_hp.cc  -------------------------
+
+
+// Test the function VectorTools::create_point_source_vector for hp.
+
+
+
+#include "../tests.h"
+#include<deal.II/fe/fe_q.h>
+#include<deal.II/fe/fe_system.h>
+#include<deal.II/grid/grid_generator.h>
+#include<deal.II/grid/tria.h>
+#include<deal.II/hp/dof_handler.h>
+#include<deal.II/hp/fe_collection.h>
+#include<deal.II/numerics/vectors.h>
+
+#include<fstream>
+
+
+
+
+template <int dim>
+void
+check ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube (tria);
+  hp::FECollection<dim> fe_collection;
+  
+  for (unsigned int i = 1; i <= tria.n_active_cells (); ++i)
+    fe_collection.push_back (FESystem<dim> (FE_Q<dim> (i), dim));
+
+  hp::DoFHandler<dim> dof (tria);
+  dof.distribute_dofs (fe_collection);
+  Point<dim> orientation;
+  Point<dim> p (tria.begin_active ()->center ());
+  
+  for (unsigned int i = 0; i < dim; ++i)
+    orientation (i) = i;
+  
+  Vector<double> vector (dof.n_dofs ());
+  
+  VectorTools::create_point_source_vector (dof, p, orientation, vector);
+
+  for (unsigned int i = 0; i < dof.n_dofs(); ++i)
+    deallog << vector (i) << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile ("create_point_source_hp/output");
+  deallog << std::setprecision (2);
+  deallog << std::fixed;  
+  deallog.attach(logfile);
+  deallog.depth_console (0);
+
+  deallog.push ("1d");
+  check<1> ();
+  deallog.pop ();
+  deallog.push ("2d");
+  check<2> ();
+  deallog.pop ();
+  deallog.push ("3d");
+  check<3> ();
+  deallog.pop ();
+}
diff --git a/tests/deal.II/create_point_source_hp/cmp/generic b/tests/deal.II/create_point_source_hp/cmp/generic
new file mode 100644 (file)
index 0000000..bdeed2a
--- /dev/null
@@ -0,0 +1,35 @@
+
+DEAL:1d::0.00
+DEAL:1d::0.00
+DEAL:2d::0.00
+DEAL:2d::0.25
+DEAL:2d::0.00
+DEAL:2d::0.25
+DEAL:2d::0.00
+DEAL:2d::0.25
+DEAL:2d::0.00
+DEAL:2d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25
+DEAL:3d::0.00
+DEAL:3d::0.12
+DEAL:3d::0.25

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.