//----------------------------------------------------------------------
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out.h>
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out.h>
// make sure that the result is the same
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out.h>
// files with vector components in them
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out.h>
// more than one vector field
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out.h>
--- /dev/null
+//---------------------------- dof_tools_common.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2003, 2004, 2005, 2008, 2010 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.
+//
+//---------------------------- dof_tools_common.cc ---------------------------
+
+
+// common framework for the various dof_tools_*.cc tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/vector.h>
+#include <lac/block_vector.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_dgp.h>
+#include <fe/fe_nedelec.h>
+#include <fe/fe_system.h>
+
+#include <fstream>
+#include <iomanip>
+#include <iomanip>
+#include <string>
+
+
+// forward declaration of the function that must be provided in the
+// .cc files
+template <int dim>
+void
+check_this (const DoFHandler<dim> &dof_handler,
+ const Vector<double> &v_node,
+ const Vector<double> &v_cell);
+
+// forward declaration of a variable with the name of the output file
+extern std::string output_file_name;
+
+
+// take a vector, and make a block vector out of it
+void
+make_block_vector (const Vector<double> &in,
+ BlockVector<double> &out)
+{
+ std::vector<unsigned int> block_sizes(2);
+ block_sizes[0] = in.size() / 2;
+ block_sizes[1] = in.size() - block_sizes[0];
+
+ out.reinit (block_sizes);
+ std::copy (in.begin(), in.end(), out.begin());
+}
+
+
+
+
+template <int dim>
+void
+check (const FiniteElement<dim> &fe,
+ const std::string &name)
+{
+ deallog << "Checking " << name
+ << " in " << dim << "d:"
+ << std::endl;
+
+ // create tria and dofhandler
+ // objects. set different boundary
+ // and sub-domain ids
+ Triangulation<dim> tria;
+ GridGenerator::hyper_cube(tria, 0., 1.);
+ tria.refine_global (1);
+ tria.begin_active()->set_refine_flag();
+ tria.execute_coarsening_and_refinement ();
+
+ DoFHandler<dim> dof_handler (tria);
+ dof_handler.distribute_dofs (fe);
+
+ Vector<double> v_node (dof_handler.n_dofs());
+ for (unsigned int i=0; i<v_node.size(); ++i) v_node(i) = i;
+
+ Vector<double> v_cell (dof_handler.get_tria().n_active_cells());
+ for (unsigned int i=0; i<v_cell.size(); ++i) v_cell(i) = i;
+
+ // call main function in .cc files
+ check_this (dof_handler, v_node, v_cell);
+}
+
+
+
+
+
+#define CHECK(EL,deg,dim)\
+ { FE_ ## EL<dim> EL(deg); \
+ check(EL, #EL #deg); }
+
+#define CHECK_ALL(EL,deg)\
+ { CHECK(EL,deg,1); \
+ CHECK(EL,deg,2); \
+ CHECK(EL,deg,3); \
+ }
+
+
+int
+main()
+{
+ try
+ {
+ std::ofstream logfile(output_file_name.c_str());
+ deallog << std::setprecision (2);
+ logfile << std::setprecision (2);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ CHECK_ALL(Q,1);
+ CHECK_ALL(Q,2);
+ CHECK_ALL(Q,3);
+
+ CHECK_ALL(DGQ,0);
+ CHECK_ALL(DGQ,1);
+ CHECK_ALL(DGQ,2);
+
+ CHECK(Nedelec, 0, 2);
+ CHECK(Nedelec, 0, 3);
+
+ return 0;
+ }
+ catch (std::exception &exc)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Exception on processing: " << std::endl
+ << exc.what() << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ }
+ catch (...)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Unknown exception!" << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ };
+}
+
//---------------------------- data_out_faces_01.cc ---------------------------
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_faces.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
// same as the the test with number _01, but check for block vectors
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_faces.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
// make sure that the result is the same
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_faces.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
// files with vector components in them
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_faces.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- data_out_rotation_01.cc ---------------------------
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_rotation.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_rotation.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
// make sure that the result is the same
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_rotation.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
// files with vector components in them
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_rotation.h>
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in data_out_common.cc), we
+ // declared in data_out_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- data_out_stack_01.cc ---------------------------
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_stack.h>
// on some it failed linking in the past due to non-existence of weak symbols
#include "../tests.h"
-#include "data_out_common.cc"
+#include "data_out_common.h"
#include <lac/sparsity_pattern.h>
#include <numerics/data_out_stack.h>
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_2a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//----------------------------------------------------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- dof_tools_2b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
//---------------------------- dof_tools_2b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
//---------------------------- dof_tools_2c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_2d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_2d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_3.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/constraint_matrix.h>
#include <lac/vector.h>
//---------------------------- dof_tools_4.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::extract_hanging_node_constraints
//---------------------------- dof_tools_5.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::extract_boundary_dofs
//---------------------------- dof_tools_6.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::extract_subdomain_dofs
//---------------------------- dof_tools_7.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::count_dofs_per_component
//---------------------------- dof_tools_8.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::map_dof_to_boundary_indices(const DoFHandler<int> &,
//---------------------------- dof_tools_9.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::map_dof_to_boundary_indices(const DoFHandler<int> &,
//---------------------------- dof_tools_10.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <fe/mapping_q.h>
// check
//---------------------------- dof_tools_11.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <fe/mapping_q.h>
// check
//---------------------------- dof_tools_12.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::extract_dofs
//---------------------------- dof_tools_13.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/vector.h>
// check
//---------------------------- dof_tools_13a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/vector.h>
// check
//---------------------------- dof_tools_14.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/vector.h>
// check
//---------------------------- dof_tools_1a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
//---------------------------- dof_tools_1a.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_1b.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/compressed_set_sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_1c.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_1d.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/block_sparsity_pattern.h>
// check
{
// since we can't forward declare
// check_this in this file (it is forward
- // declared in dof_tools_common.cc), we
+ // declared in dof_tools_common.h), we
// also can't make the driver file aware of
// the overload for 1d. to avoid linker
// errors, we can consequently not overload
//---------------------------- dof_tools_19.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
#include <lac/constraint_matrix.h>
#include <base/function.h>
#include <base/quadrature_lib.h>
//---------------------------- dof_tools_5.cc ---------------------------
#include "../tests.h"
-#include "dof_tools_common.cc"
+#include "dof_tools_common.h"
// check
// DoFTools::extract_dofs_with_support_on_boundary
--- /dev/null
+//---------------------------- dof_tools_common.h ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 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.
+//
+//---------------------------- dof_tools_common.h ---------------------------
+
+
+// common framework for the various dof_tools_*.cc tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_dgp.h>
+#include <fe/fe_nedelec.h>
+#include <fe/fe_raviart_thomas.h>
+#include <fe/fe_system.h>
+
+#include <fstream>
+#include <iomanip>
+#include <iomanip>
+#include <string>
+
+
+// forward declaration of the function that must be provided in the
+// .cc files
+template <int dim>
+void
+check_this (const DoFHandler<dim> &dof_handler);
+
+// forward declaration of a variable with the name of the output file
+extern std::string output_file_name;
+
+
+void
+output_bool_vector (std::vector<bool> &v)
+{
+for (unsigned int i=0; i<v.size(); ++i)
+ deallog << (v[i] ? '1' : '0');
+ deallog << std::endl;
+}
+
+
+
+template <int dim>
+void
+set_boundary_ids (Triangulation<dim> &tria)
+{
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ tria.begin_active()->face(f)->set_boundary_indicator (f);
+}
+
+
+void
+set_boundary_ids (Triangulation<1> &)
+{}
+
+
+
+template <int dim>
+void
+check (const FiniteElement<dim> &fe,
+ const std::string &name)
+{
+ deallog << "Checking " << name
+ << " in " << dim << "d:"
+ << std::endl;
+
+ // create tria and dofhandler
+ // objects. set different boundary
+ // and sub-domain ids
+ Triangulation<dim> tria;
+ GridGenerator::hyper_cube(tria, 0., 1.);
+ set_boundary_ids (tria);
+ tria.refine_global (1);
+ for (int i=0; i<2; ++i)
+ {
+ tria.begin_active()->set_refine_flag();
+ tria.execute_coarsening_and_refinement ();
+ }
+ for (typename Triangulation<dim>::active_cell_iterator
+ cell=tria.begin_active();
+ cell!=tria.end(); ++cell)
+ cell->set_subdomain_id (cell->level());
+ DoFHandler<dim> dof_handler (tria);
+ dof_handler.distribute_dofs (fe);
+
+ // call main function in .cc files
+ check_this (dof_handler);
+}
+
+
+
+
+
+#define CHECK(EL,deg,dim)\
+ { FE_ ## EL<dim> EL(deg); \
+ check(EL, #EL #deg); }
+
+#define CHECK_SYS1(sub1,N1,dim) \
+ { FESystem<dim> q(sub1, N1); \
+ check(q, #sub1 #N1); }
+
+#define CHECK_SYS2(sub1,N1,sub2,N2,dim) \
+ { FESystem<dim> q(sub1, N1, sub2, N2); \
+ check(q, #sub1 #N1 #sub2 #N2); }
+
+#define CHECK_SYS3(sub1,N1,sub2,N2,sub3,N3,dim) \
+ { FESystem<dim> q(sub1, N1, sub2, N2, sub3, N3); \
+ check(q, #sub1 #N1 #sub2 #N2 #sub3 #N3); }
+
+
+#define CHECK_ALL(EL,deg)\
+ { CHECK(EL,deg,1); \
+ CHECK(EL,deg,2); \
+ CHECK(EL,deg,3); \
+ }
+
+
+int
+main()
+{
+ try
+ {
+ std::ofstream logfile(output_file_name.c_str());
+ logfile << std::setprecision (2);
+ deallog << std::setprecision (2);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ CHECK_ALL(Q,1);
+ CHECK_ALL(Q,2);
+ CHECK_ALL(Q,3);
+
+ CHECK_ALL(DGQ,0);
+ CHECK_ALL(DGQ,1);
+ CHECK_ALL(DGQ,3);
+
+ CHECK_ALL(DGP,0);
+ CHECK_ALL(DGP,1);
+ CHECK_ALL(DGP,3);
+
+ CHECK(Nedelec, 0, 2);
+ CHECK(Nedelec, 0, 3);
+
+ CHECK(RaviartThomas, 0, 2);
+ CHECK(RaviartThomas, 1, 2);
+ CHECK(RaviartThomas, 2, 2);
+
+ CHECK(RaviartThomasNodal, 0, 2);
+ CHECK(RaviartThomasNodal, 1, 2);
+ CHECK(RaviartThomasNodal, 2, 2);
+ CHECK(RaviartThomasNodal, 0, 3);
+ CHECK(RaviartThomasNodal, 1, 3);
+ CHECK(RaviartThomasNodal, 2, 3);
+
+ CHECK_SYS1(FE_Q<1>(1), 3,1);
+ CHECK_SYS1(FE_DGQ<1>(2),2,1);
+ CHECK_SYS1(FE_DGP<1>(3),1,1);
+
+ CHECK_SYS1(FE_Q<2>(1), 3,2);
+ CHECK_SYS1(FE_DGQ<2>(2),2,2);
+ CHECK_SYS1(FE_DGP<2>(3),1,2);
+
+ CHECK_SYS1(FE_Q<3>(1), 3,3);
+ CHECK_SYS1(FE_DGQ<3>(2),2,3);
+ CHECK_SYS1(FE_DGP<3>(3),1,3);
+
+
+ CHECK_SYS2(FE_Q<1>(1), 3,FE_DGQ<1>(2),2,1);
+ CHECK_SYS2(FE_DGQ<1>(2),2,FE_DGP<1>(3),1,1);
+ CHECK_SYS2(FE_DGP<1>(3),1,FE_DGQ<1>(2),2,1);
+
+ CHECK_SYS2(FE_Q<2>(1), 3,FE_DGQ<2>(2),2,2);
+ CHECK_SYS2(FE_DGQ<2>(2),2,FE_DGP<2>(3),1,2);
+ CHECK_SYS2(FE_DGP<2>(3),1,FE_DGQ<2>(2),2,2);
+
+ CHECK_SYS3(FE_Q<1>(1), 3,FE_DGP<1>(3),1,FE_Q<1>(1),3,1);
+ CHECK_SYS3(FE_DGQ<1>(2),2,FE_DGQ<1>(2),2,FE_Q<1>(3),3,1);
+ CHECK_SYS3(FE_DGP<1>(3),1,FE_DGP<1>(3),1,FE_Q<1>(2),3,1);
+
+ CHECK_SYS3(FE_Q<2>(1), 3,FE_DGP<2>(3),1,FE_Q<2>(1),3,2);
+ CHECK_SYS3(FE_DGQ<2>(2),2,FE_DGQ<2>(2),2,FE_Q<2>(3),3,2);
+ CHECK_SYS3(FE_DGP<2>(3),1,FE_DGP<2>(3),1,FE_Q<2>(2),3,2);
+
+ CHECK_SYS3(FE_DGQ<3>(1), 3,FE_DGP<3>(3),1,FE_Q<3>(1),3,3);
+
+ // systems of systems
+ CHECK_SYS3((FESystem<2>(FE_Q<2>(1),3)), 3,
+ FE_DGQ<2>(0), 1,
+ FE_Q<2>(1), 3,
+ 2);
+ CHECK_SYS3(FE_DGQ<2>(3), 1,
+ FESystem<2>(FE_DGQ<2>(0),3), 1,
+ FESystem<2>(FE_Q<2>(2),1,
+ FE_DGQ<2>(0),1),2,
+ 2);
+
+ // systems with Nedelec elements
+ CHECK_SYS2 (FE_DGQ<2>(3), 1,
+ FE_Nedelec<2>(0), 2,
+ 2);
+ CHECK_SYS3(FE_Nedelec<2>(0), 1,
+ FESystem<2>(FE_DGQ<2>(1),2), 1,
+ FESystem<2>(FE_Q<2>(2),1,
+ FE_Nedelec<2>(0),2),2,
+ 2);
+
+ return 0;
+ }
+ catch (std::exception &exc)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Exception on processing: " << std::endl
+ << exc.what() << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ }
+ catch (...)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Unknown exception!" << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ };
+}
+
//---------------------------- fe_tools_02.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_03.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_04.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_05.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_06.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_07.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_08.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_09.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_10.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_11.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <lac/sparsity_pattern.h>
// check
//---------------------------- fe_tools_12.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
// check
// FETools::get_projection_matrix
//---------------------------- fe_tools_13.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
// check
// FE::face_to_equivalent_cell_index
//---------------------------- fe_tools_14.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
// check
// FE::hp_constraints_are_implemented ()
--- /dev/null
+//---------------------------- fe_tools_common.h ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 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.
+//
+//---------------------------- fe_tools_common.h ---------------------------
+
+
+// common framework for the various fe_tools_*.cc tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_tools.h>
+#include <lac/constraint_matrix.h>
+#include <lac/vector.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_dgp.h>
+#include <fe/fe_nedelec.h>
+#include <fe/fe_system.h>
+#include <fe/fe_tools.h>
+
+#include <fstream>
+#include <iomanip>
+#include <iomanip>
+#include <string>
+#include <memory>
+
+
+// forward declaration of the function that must be provided in the
+// .cc files
+template <int dim>
+void
+check_this (const FiniteElement<dim> &fe1,
+ const FiniteElement<dim> &fe2);
+
+// forward declaration of a variable with the name of the output file
+extern std::string output_file_name;
+
+
+
+// output some indicators for a given matrix. we don't write out the
+// entire matrix since this would blow up our output files beyond
+// reasonable limits
+void
+output_matrix (const FullMatrix<double> &m)
+{
+ if ((m.m() == 0) || (m.n() == 0))
+ {
+ deallog << "(Empty matrix)" << std::endl;
+ return;
+ }
+
+ deallog << m.l1_norm() << ' ' << m.linfty_norm()
+ << std::endl;
+ if (m.m() == m.n())
+ deallog << m.frobenius_norm() << std::endl;
+
+ for (unsigned int i=0; i<std::min(m.m(),m.n()); ++i)
+ deallog << m(i,i) << ' ' << m(i,std::min(m.m(),m.n())-i-1) << ' ';
+ deallog << std::endl;
+}
+
+
+// output some indicators for a given vector
+template <class VECTOR>
+void
+output_vector (const VECTOR &v)
+{
+ deallog << v.l1_norm() << ' ' << v.l2_norm() << ' ' << v.linfty_norm()
+ << std::endl;
+
+ // write out at most 20 equispaced
+ // elements of the vector
+ for (unsigned int i=0; i<v.size(); i+=std::max(1U,v.size()/20))
+ deallog << v(i) << ' ';
+ deallog << std::endl;
+}
+
+
+
+
+template <int dim>
+Triangulation<dim> * make_tria ()
+{
+ Triangulation<dim> *tria = new Triangulation<dim>();
+ GridGenerator::hyper_cube(*tria, 0., 1.);
+ tria->refine_global (1);
+ for (int i=0; i<2; ++i)
+ {
+ tria->begin_active()->set_refine_flag();
+ tria->execute_coarsening_and_refinement ();
+ }
+ return tria;
+}
+
+
+
+template <int dim>
+DoFHandler<dim> * make_dof_handler (const Triangulation<dim> &tria,
+ const FiniteElement<dim> &fe)
+{
+ DoFHandler<dim> *dof_handler = new DoFHandler<dim>(tria);
+ dof_handler->distribute_dofs (fe);
+ return dof_handler;
+}
+
+
+
+template <int dim>
+void
+check (const FiniteElement<dim> &fe1,
+ const FiniteElement<dim> &fe2,
+ const std::string &name)
+{
+ deallog << "Checking " << name
+ << " in " << dim << "d:"
+ << std::endl;
+
+ // call main function in .cc files
+ check_this (fe1, fe2);
+}
+
+
+
+
+
+#define CHECK(EL1,deg1,EL2,deg2,dim)\
+ { FE_ ## EL1<dim> fe1(deg1); \
+ FE_ ## EL2<dim> fe2(deg2); \
+ check(fe1, fe2, #EL1 #deg1 " against " #EL2 #deg2); \
+ check(fe2, fe1, #EL2 #deg2 " against " #EL1 #deg1); \
+ }
+
+#define CHECK_SYS1(sub1_1,N1_1,sub2_1,N2_1,dim) \
+ { FESystem<dim> fe1(sub1_1, N1_1); \
+ FESystem<dim> fe2(sub2_1, N2_1); \
+ check(fe1, fe2, #sub1_1 #N1_1 " against " #sub2_1 #N2_1); \
+ check(fe2, fe1, #sub2_1 #N2_1 " against " #sub1_1 #N1_1); \
+ }
+
+/*
+#define CHECK_SYS2(sub1,N1,sub2,N2,dim) \
+ { FESystem<dim> q(sub1, N1, sub2, N2); \
+ check(q, #sub1 #N1 #sub2 #N2); }
+
+#define CHECK_SYS3(sub1,N1,sub2,N2,sub3,N3,dim) \
+ { FESystem<dim> q(sub1, N1, sub2, N2, sub3, N3); \
+ check(q, #sub1 #N1 #sub2 #N2 #sub3 #N3); }
+
+*/
+#define CHECK_ALL(EL1,deg1,EL2,deg2)\
+ { CHECK(EL1,deg1,EL2,deg2,1); \
+ CHECK(EL1,deg1,EL2,deg2,2); \
+ CHECK(EL1,deg1,EL2,deg2,3); \
+ }
+
+
+int
+main()
+{
+ try
+ {
+ std::ofstream logfile(output_file_name.c_str());
+ deallog << std::setprecision (2);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ CHECK_ALL(Q,1,Q,1);
+ CHECK_ALL(Q,1,Q,2);
+ CHECK_ALL(Q,1,Q,3);
+ CHECK_ALL(Q,2,Q,2);
+ CHECK_ALL(Q,2,Q,3);
+ CHECK_ALL(Q,3,Q,3);
+
+ CHECK_ALL(DGQ,0,DGQ,0);
+ CHECK_ALL(DGQ,0,DGQ,1);
+ CHECK_ALL(DGQ,0,DGQ,2);
+ CHECK_ALL(DGQ,0,DGQ,4);
+ CHECK_ALL(DGQ,1,DGQ,1);
+ CHECK_ALL(DGQ,1,DGQ,3);
+ CHECK_ALL(DGQ,2,DGQ,2);
+ CHECK_ALL(DGQ,2,DGQ,2);
+ CHECK_ALL(DGQ,2,DGQ,4);
+ CHECK_ALL(DGQ,3,DGQ,3);
+
+ CHECK_ALL(DGP,0,DGP,0);
+ CHECK_ALL(DGP,0,DGP,1);
+ CHECK_ALL(DGP,0,DGP,2);
+ CHECK_ALL(DGP,0,DGP,4);
+ CHECK_ALL(DGP,1,DGP,1);
+ CHECK_ALL(DGP,1,DGP,3);
+ CHECK_ALL(DGP,2,DGP,2);
+ CHECK_ALL(DGP,2,DGP,2);
+ CHECK_ALL(DGP,2,DGP,4);
+ CHECK_ALL(DGP,3,DGP,3);
+
+ CHECK(Nedelec, 0, Nedelec, 0, 2);
+ CHECK(Nedelec, 0, Nedelec, 0, 3);
+
+
+ CHECK_SYS1(FE_Q<1>(1), 3,
+ FE_Q<1>(2), 3,
+ 1);
+ CHECK_SYS1(FE_DGQ<1>(2),2,
+ FE_DGQ<1>(3),2,
+ 1);
+ CHECK_SYS1(FE_DGP<1>(3),1,
+ FE_DGP<1>(1),1,
+ 1);
+
+ CHECK_SYS1(FE_Q<2>(1), 3,
+ FE_Q<2>(2), 3,
+ 2);
+ CHECK_SYS1(FE_DGQ<2>(2),2,
+ FE_DGQ<2>(3),2,
+ 2);
+ CHECK_SYS1(FE_DGP<2>(3),1,
+ FE_DGP<2>(1),1,
+ 2);
+
+ CHECK_SYS1(FE_Q<3>(1), 3,
+ FE_Q<3>(2), 3,
+ 3);
+ CHECK_SYS1(FE_DGQ<3>(2),2,
+ FE_DGQ<3>(3),2,
+ 3);
+ CHECK_SYS1(FE_DGP<3>(3),1,
+ FE_DGP<3>(1),1,
+ 3);
+
+
+/*
+ CHECK_SYS2(FE_Q<1>(1), 3,FE_DGQ<1>(2),2,1);
+ CHECK_SYS2(FE_DGQ<1>(2),2,FE_DGP<1>(3),1,1);
+ CHECK_SYS2(FE_DGP<1>(3),1,FE_DGQ<1>(2),2,1);
+
+ CHECK_SYS2(FE_Q<2>(1), 3,FE_DGQ<2>(2),2,2);
+ CHECK_SYS2(FE_DGQ<2>(2),2,FE_DGP<2>(3),1,2);
+ CHECK_SYS2(FE_DGP<2>(3),1,FE_DGQ<2>(2),2,2);
+
+ CHECK_SYS2(FE_Q<3>(1) ,3,FE_DGQ<3>(2),2,3);
+ CHECK_SYS2(FE_DGQ<3>(2),2,FE_DGP<3>(3),1,3);
+ CHECK_SYS2(FE_DGP<3>(3),1,FE_DGQ<3>(2),2,3);
+
+
+ CHECK_SYS3(FE_Q<1>(1), 3,FE_DGP<1>(3),1,FE_Q<1>(1),3,1);
+ CHECK_SYS3(FE_DGQ<1>(2),2,FE_DGQ<1>(2),2,FE_Q<1>(3),3,1);
+ CHECK_SYS3(FE_DGP<1>(3),1,FE_DGP<1>(3),1,FE_Q<1>(2),3,1);
+
+ CHECK_SYS3(FE_Q<2>(1), 3,FE_DGP<2>(3),1,FE_Q<2>(1),3,2);
+ CHECK_SYS3(FE_DGQ<2>(2),2,FE_DGQ<2>(2),2,FE_Q<2>(3),3,2);
+ CHECK_SYS3(FE_DGP<2>(3),1,FE_DGP<2>(3),1,FE_Q<2>(2),3,2);
+
+ CHECK_SYS3(FE_Q<3>(1), 3,FE_DGP<3>(3),1,FE_Q<3>(1),3,3);
+ CHECK_SYS3(FE_DGQ<3>(2),2,FE_DGQ<3>(2),2,FE_Q<3>(3),3,3);
+ CHECK_SYS3(FE_DGP<3>(3),1,FE_DGP<3>(3),1,FE_Q<3>(2),3,3);
+
+ // systems of systems
+ CHECK_SYS3((FESystem<2>(FE_Q<2>(1),3)), 3,
+ FE_DGQ<2>(3), 1,
+ FE_Q<2>(1), 3,
+ 2);
+ CHECK_SYS3(FE_DGQ<2>(3), 1,
+ FESystem<2>(FE_DGQ<2>(3),3), 1,
+ FESystem<2>(FE_Q<2>(2),3,
+ FE_DGQ<2>(0),1),2,
+ 2);
+
+ // systems with Nedelec elements
+ CHECK_SYS2 (FE_DGQ<2>(3), 1,
+ FE_Nedelec<2>(0), 2,
+ 2);
+ CHECK_SYS3(FE_Nedelec<2>(0), 1,
+ FESystem<2>(FE_DGQ<2>(3),3), 1,
+ FESystem<2>(FE_Q<2>(2),3,
+ FE_Nedelec<2>(0),2),2,
+ 2);
+*/
+ return 0;
+ }
+ catch (std::exception &exc)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Exception on processing: " << std::endl
+ << exc.what() << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ }
+ catch (...)
+ {
+ deallog << std::endl << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ deallog << "Unknown exception!" << std::endl
+ << "Aborting!" << std::endl
+ << "----------------------------------------------------"
+ << std::endl;
+ return 1;
+ };
+}
+
//---------------------------- fe_tools_cpfqpm_01.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <base/quadrature_lib.h>
// check
//---------------------------- fe_tools_cpfqpm_02.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <base/quadrature_lib.h>
// check
//---------------------------- fe_tools_cpfqpm_03.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <base/quadrature_lib.h>
// check
//---------------------------- fe_tools_cpfqpm_04.cc ---------------------------
#include "../tests.h"
-#include "fe_tools_common.cc"
+#include "fe_tools_common.h"
#include <base/quadrature_lib.h>
// check