--- /dev/null
+
+//---------------------------- template.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 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.
+//
+//---------------------------- template.cc ---------------------------
+
+
+// test VectorTools::interpolate_boundary_values for codim=1. like
+// _01_vector_valued, but for vector-valued functions
+
+#include "../tests.h"
+#include <fstream>
+#include <base/logstream.h>
+#include <base/function_lib.h>
+#include <grid/tria.h>
+#include <grid/grid_in.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <numerics/vectors.h>
+
+#include <string>
+
+std::ofstream logfile("interpolate_boundary_values_01_vector_valued/output");
+
+template <int dim>
+class X : public Function<dim>
+{
+ public:
+ X() : Function<dim>(dim) {}
+
+ double value (const Point<dim> &p,
+ const unsigned int component) const
+ {
+ return p[component];
+ }
+};
+
+
+template <int dim, int spacedim>
+void test(std::string filename) {
+ Triangulation<dim, spacedim> tria;
+ GridIn<dim, spacedim> gi;
+ gi.attach_triangulation (tria);
+ std::ifstream in (filename.c_str());
+ gi.read_ucd (in);
+
+ deallog << tria.n_active_cells() << " active cells" << std::endl;
+
+ FESystem<dim,spacedim> fe(FE_Q<dim,spacedim> (2), spacedim);
+ DoFHandler<dim,spacedim> dof_handler (tria);
+ dof_handler.distribute_dofs (fe);
+
+ deallog << dof_handler.n_dofs() << " degrees of freedom" << std::endl;
+
+ std::map<unsigned int, double> bv;
+ VectorTools::interpolate_boundary_values (dof_handler,
+ 0,
+ X<spacedim>(),
+ bv);
+ deallog << bv.size() << " boundary degrees of freedom" << std::endl;
+
+ for (std::map<unsigned int, double>::const_iterator i = bv.begin();
+ i != bv.end(); ++i)
+ deallog << i->first << ' ' << i->second << std::endl;
+
+ for (typename DoFHandler<dim,spacedim>::active_cell_iterator
+ cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell)
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ if (cell->at_boundary(f))
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ for (unsigned int i=0; i<fe.dofs_per_vertex; ++i)
+ {
+ Assert (bv.find(cell->face(f)->vertex_dof_index(v,i))
+ != bv.end(),
+ ExcInternalError());
+ Assert (bv[cell->face(f)->vertex_dof_index(v,i)]
+ ==
+ X<spacedim>()
+ .value(cell->face(f)->vertex(v),i),
+ ExcInternalError());
+ }
+}
+
+
+
+int main ()
+{
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test<2,3>("grids/square.inp");
+ test<2,3>("grids/sphere_1.inp");
+
+ return 0;
+}
+
--- /dev/null
+
+DEAL::4 active cells
+DEAL::75 degrees of freedom
+DEAL::48 boundary degrees of freedom
+DEAL::3 0
+DEAL::4 1.00000
+DEAL::5 0
+DEAL::6 1.00000
+DEAL::7 0
+DEAL::8 0
+DEAL::9 0
+DEAL::10 0
+DEAL::11 0
+DEAL::15 0
+DEAL::16 0.500000
+DEAL::17 0
+DEAL::21 0.500000
+DEAL::22 0
+DEAL::23 0
+DEAL::27 2.00000
+DEAL::28 1.00000
+DEAL::29 0
+DEAL::30 2.00000
+DEAL::31 0
+DEAL::32 0
+DEAL::33 2.00000
+DEAL::34 0.500000
+DEAL::35 0
+DEAL::39 1.50000
+DEAL::40 0
+DEAL::41 0
+DEAL::45 2.00000
+DEAL::46 2.00000
+DEAL::47 0
+DEAL::48 1.00000
+DEAL::49 2.00000
+DEAL::50 0
+DEAL::51 2.00000
+DEAL::52 1.50000
+DEAL::53 0
+DEAL::57 1.50000
+DEAL::58 2.00000
+DEAL::59 0
+DEAL::63 0
+DEAL::64 2.00000
+DEAL::65 0
+DEAL::66 0
+DEAL::67 1.50000
+DEAL::68 0
+DEAL::69 0.500000
+DEAL::70 2.00000
+DEAL::71 0
+DEAL::106 active cells
+DEAL::1278 degrees of freedom
+DEAL::0 boundary degrees of freedom
--- /dev/null
+
+DEAL::1 active cells
+DEAL::3 degrees of freedom
+DEAL::1 boundary degrees of freedom
+DEAL::0 0
+DEAL::1 boundary degrees of freedom
+DEAL::1 1.00000
--- /dev/null
+
+//---------------------------- template.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 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.
+//
+//---------------------------- template.cc ---------------------------
+
+
+// test VectorTools::interpolate_boundary_values for codim=1. like _02
+// but for vector-valued elements
+
+#include "../tests.h"
+#include <fstream>
+#include <base/logstream.h>
+#include <base/function_lib.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <numerics/vectors.h>
+
+#include <string>
+
+std::ofstream logfile("interpolate_boundary_values_02_vector_valued/output");
+
+template <int dim>
+class X : public Function<dim>
+{
+ public:
+ X() : Function<dim>(dim) {}
+
+ double value (const Point<dim> &p,
+ const unsigned int component) const
+ {
+ return p[component];
+ }
+};
+
+void test() {
+ const int dim = 1;
+ const int spacedim = 2;
+
+ Triangulation<dim, spacedim> tria;
+ GridGenerator::hyper_cube (tria);
+ deallog << tria.n_active_cells() << " active cells" << std::endl;
+
+ FESystem<dim,spacedim> fe(FE_Q<dim,spacedim>(2), spacedim);
+ DoFHandler<dim,spacedim> dof_handler (tria);
+ dof_handler.distribute_dofs (fe);
+
+ deallog << dof_handler.n_dofs() << " degrees of freedom" << std::endl;
+
+ // test left and right boundary
+ // separatel
+ for (unsigned int boundary_id=0; boundary_id<2; ++boundary_id)
+ {
+ std::map<unsigned int, double> bv;
+ VectorTools::interpolate_boundary_values (dof_handler,
+ boundary_id,
+ X<spacedim>(),
+ bv);
+ deallog << bv.size() << " boundary degrees of freedom" << std::endl;
+
+ for (std::map<unsigned int, double>::const_iterator i = bv.begin();
+ i != bv.end(); ++i)
+ deallog << i->first << ' ' << i->second << std::endl;
+
+ for (DoFHandler<dim,spacedim>::active_cell_iterator
+ cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell)
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ if (cell->at_boundary(f) &&
+ (cell->face(f)->boundary_indicator() == boundary_id))
+ for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
+ for (unsigned int i=0; i<fe.dofs_per_vertex; ++i)
+ {
+ Assert (bv.find(cell->face(f)->vertex_dof_index(v,i))
+ != bv.end(),
+ ExcInternalError());
+ Assert (bv[cell->face(f)->vertex_dof_index(v,i)]
+ ==
+ X<spacedim>()
+ .value(cell->face(f)->vertex(v),i),
+ ExcInternalError());
+ }
+ }
+}
+
+
+
+int main ()
+{
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test();
+
+ return 0;
+}
+
--- /dev/null
+
+DEAL::1 active cells
+DEAL::6 degrees of freedom
+DEAL::2 boundary degrees of freedom
+DEAL::0 0
+DEAL::1 0
+DEAL::2 boundary degrees of freedom
+DEAL::2 1.00000
+DEAL::3 0