From: buerg Date: Sun, 6 May 2012 10:08:41 +0000 (+0000) Subject: Add tests for VectorTools::create_point_source_vector. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37fbdfb7967a6bd1ac8235ac1286716374824c86;p=dealii-svn.git Add tests for VectorTools::create_point_source_vector. git-svn-id: https://svn.dealii.org/trunk@25498 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/create_point_source.cc b/tests/deal.II/create_point_source.cc new file mode 100644 index 0000000000..23149c69c2 --- /dev/null +++ b/tests/deal.II/create_point_source.cc @@ -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 +#include +#include +#include +#include +#include + +#include + + + + +template +void +check () +{ + Triangulation tria; + GridGenerator::hyper_cube (tria); + FESystem fe (FE_Q (2), dim); + DoFHandler dof (tria); + dof.distribute_dofs (fe); + Point orientation; + Point p (tria.begin_active ()->center ()); + + for (unsigned int i = 0; i < dim; ++i) + orientation (i) = i; + + Vector 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 index 0000000000..9360d5a51e --- /dev/null +++ b/tests/deal.II/create_point_source/cmp/generic @@ -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 index 0000000000..de95c4a324 --- /dev/null +++ b/tests/deal.II/create_point_source_hp.cc @@ -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 +#include +#include +#include +#include +#include +#include + +#include + + + + +template +void +check () +{ + Triangulation tria; + GridGenerator::hyper_cube (tria); + hp::FECollection fe_collection; + + for (unsigned int i = 1; i <= tria.n_active_cells (); ++i) + fe_collection.push_back (FESystem (FE_Q (i), dim)); + + hp::DoFHandler dof (tria); + dof.distribute_dofs (fe_collection); + Point orientation; + Point p (tria.begin_active ()->center ()); + + for (unsigned int i = 0; i < dim; ++i) + orientation (i) = i; + + Vector 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 index 0000000000..bdeed2ab4d --- /dev/null +++ b/tests/deal.II/create_point_source_hp/cmp/generic @@ -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