Vector<float> h1_seminorm_error_per_cell, h1_error_per_cell;
cout << " Calculating L1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
l1_error_per_cell,
*quadrature, L1_norm);
l1_error.push_back (l1_error_per_cell.l1_norm());
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
l2_error_per_cell,
*quadrature, L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
linfty_error_per_cell,
*quadrature, Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1-seminorm error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
h1_seminorm_error_per_cell,
*quadrature, H1_seminorm);
h1_seminorm_error.push_back (h1_seminorm_error_per_cell.l2_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
h1_error_per_cell,
*quadrature, H1_norm);
// Vector<double> projected_solution;
// ConstraintMatrix constraints;
// constraints.close ();
-// VectorTools<dim>::project (*dof, constraints, *fe,
+// VectorTools::project (*dof, constraints, *fe,
// StraightBoundary<dim>(), *quadrature,
// sol, projected_solution, false,
// *boundary_quadrature);
// cout << " Calculating L2 error of projected solution... ";
-// VectorTools<dim>::integrate_difference (*dof_handler,
+// VectorTools::integrate_difference (*dof_handler,
// projected_solution, sol,
// l2_error_per_cell,
// *quadrature, *fe, L2_norm);
QGauss3<dim> q;
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
l2_error_per_cell, q,
L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
linfty_error_per_cell, q,
Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
h1_error_per_cell, q,
H1_norm);
for (FunctionMap::const_iterator bc=dirichlet_bc.begin();
bc != dirichlet_bc.end(); ++bc)
- VectorTools<dim>::interpolate_boundary_values (*dof,
+ VectorTools::interpolate_boundary_values (*dof,
bc->first,
*bc->second,
boundary_value_list);
Vector<float> h1_seminorm_error_per_cell, h1_error_per_cell;
cout << " Calculating L1 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
l1_error_per_cell,
*quadrature, L1_norm);
l1_error.push_back (l1_error_per_cell.l1_norm());
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
l2_error_per_cell,
*quadrature, L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
linfty_error_per_cell,
*quadrature, Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1-seminorm error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
h1_seminorm_error_per_cell,
*quadrature, H1_seminorm);
h1_seminorm_error.push_back (h1_seminorm_error_per_cell.l2_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
h1_error_per_cell,
*quadrature, H1_norm);
// Vector<double> projected_solution;
// ConstraintMatrix constraints;
// constraints.close ();
-// VectorTools<dim>::project (*dof, constraints, *fe,
+// VectorTools::project (*dof, constraints, *fe,
// StraightBoundary<dim>(), *quadrature,
// sol, projected_solution, false,
// *boundary_quadrature);
// cout << " Calculating L2 error of projected solution... ";
-// VectorTools<dim>::integrate_difference (*dof,
+// VectorTools::integrate_difference (*dof,
// projected_solution, sol,
// l2_error_per_cell,
// *quadrature, *fe, L2_norm);
*
* @author Wolfgang Bangerth, 1998
*/
-template <int dim>
class VectorTools
{
public:
- /**
- * Declare a data type which denotes a
- * mapping between a boundary indicator
- * and the function denoting the boundary
- * values on this part of the boundary.
- * Only one boundary function may be given
- * for each boundary indicator, which is
- * guaranteed by the #map# data type.
- *
- * See the general documentation of this
- * class for more detail.
- */
- typedef map<unsigned char,const Function<dim>*> FunctionMap;
-
/**
* Compute the interpolation of
* #function# at the support
* See the general documentation of this
* class for further information.
*/
+ template <int dim>
static void interpolate (const DoFHandler<dim> &dof,
const Function<dim> &function,
Vector<double> &vec);
* #transfer#. Curved boundaries
* are neglected so far.
*/
- static void interpolate(const DoFHandler<dim> &high_dof,
- const DoFHandler<dim> &low_dof,
- const FullMatrix<double> &transfer,
- const Vector<double> &high,
- Vector<double> &low);
+ template <int dim>
+ static void interpolate (const DoFHandler<dim> &high_dof,
+ const DoFHandler<dim> &low_dof,
+ const FullMatrix<double> &transfer,
+ const Vector<double> &high,
+ Vector<double> &low);
/**
* Compute the projection of
* See the general documentation of this
* class for further information.
*/
+ template <int dim>
static void project (const DoFHandler<dim> &dof,
const ConstraintMatrix &constraints,
const Quadrature<dim> &quadrature,
* See the general documentation of this
* class for further information.
*/
+ template <int dim>
static void create_right_hand_side (const DoFHandler<dim> &dof,
const Quadrature<dim> &q,
const Function<dim> &rhs,
* See the general doc for more
* information.
*/
+ template <int dim>
static void interpolate_boundary_values (const DoFHandler<dim> &dof,
const unsigned char boundary_component,
const Function<dim> &boundary_function,
* See the general documentation of this
* class for further information.
*/
+ template <int dim>
static void project_boundary_values (const DoFHandler<dim> &dof,
- const FunctionMap &boundary_function,
+ const map<unsigned char,const Function<dim>*> &boundary_function,
const Quadrature<dim-1>&q,
map<int,double> &boundary_values);
* See the general documentation of this
* class for more information.
*/
+ template <int dim>
static void integrate_difference (const DoFHandler<dim> &dof,
const Vector<double> &fe_function,
const Function<dim> &exact_solution,
for (FunctionMap::const_iterator dirichlet = dirichlet_bc.begin() ;
dirichlet != dirichlet_bc.end() ; ++dirichlet)
- VectorTools<dim>::interpolate_boundary_values (*dof_handler,
- dirichlet->first,
- *(dirichlet->second),
- boundary_value_list);
+ VectorTools::interpolate_boundary_values (*dof_handler,
+ dirichlet->first,
+ *(dirichlet->second),
+ boundary_value_list);
MatrixTools<dim>::apply_boundary_values (boundary_value_list,
system_matrix, solution,
right_hand_side);
template <int dim>
-void VectorTools<dim>::interpolate (const DoFHandler<dim> &dof,
- const Function<dim> &function,
- Vector<double> &vec)
+void VectorTools::interpolate (const DoFHandler<dim> &dof,
+ const Function<dim> &function,
+ Vector<double> &vec)
{
Assert (dof.get_fe().n_components() == function.n_components,
ExcComponentMismatch());
template <int dim> void
-VectorTools<dim>::interpolate(const DoFHandler<dim> &high_dof,
- const DoFHandler<dim> &low_dof,
- const FullMatrix<double> &transfer,
- const Vector<double> &high,
- Vector<double> &low)
+VectorTools::interpolate(const DoFHandler<dim> &high_dof,
+ const DoFHandler<dim> &low_dof,
+ const FullMatrix<double> &transfer,
+ const Vector<double> &high,
+ Vector<double> &low)
{
Vector<double> cell_high(high_dof.get_fe().dofs_per_cell);
Vector<double> cell_low(low_dof.get_fe().dofs_per_cell);
#if deal_II_dimension == 1
template <>
-void VectorTools<1>::project (const DoFHandler<1> &,
- const ConstraintMatrix &,
- const Quadrature<1> &,
- const Function<1> &,
- Vector<double> &,
- const bool ,
- const Quadrature<0> &,
- const bool ) {
+void VectorTools::project (const DoFHandler<1> &,
+ const ConstraintMatrix &,
+ const Quadrature<1> &,
+ const Function<1> &,
+ Vector<double> &,
+ const bool ,
+ const Quadrature<0> &,
+ const bool ) {
// this function should easily be implemented
// using the template below. However some
// changes have to be made since faces don't
template <int dim>
-void VectorTools<dim>::project (const DoFHandler<dim> &dof,
- const ConstraintMatrix &constraints,
- const Quadrature<dim> &quadrature,
- const Function<dim> &function,
- Vector<double> &vec,
- const bool enforce_zero_boundary,
- const Quadrature<dim-1> &q_boundary,
- const bool project_to_boundary_first)
+void VectorTools::project (const DoFHandler<dim> &dof,
+ const ConstraintMatrix &constraints,
+ const Quadrature<dim> &quadrature,
+ const Function<dim> &function,
+ Vector<double> &vec,
+ const bool enforce_zero_boundary,
+ const Quadrature<dim-1> &q_boundary,
+ const bool project_to_boundary_first)
{
Assert (dof.get_fe().n_components() == function.n_components,
ExcInvalidFE());
// the different boundary parts. We want the
// #function# to hold on all parts of the
// boundary
- FunctionMap boundary_functions;
+ map<unsigned char,const Function<dim>*> boundary_functions;
for (unsigned char c=0; c<255; ++c)
boundary_functions[c] = &function;
project_boundary_values (dof, boundary_functions, q_boundary,
MatrixCreator<dim>::create_mass_matrix (dof, quadrature, mass_matrix);
};
- VectorTools<dim>::create_right_hand_side (dof, quadrature, function, tmp);
+ VectorTools::create_right_hand_side (dof, quadrature, function, tmp);
constraints.condense (mass_matrix);
constraints.condense (tmp);
template <int dim>
-void VectorTools<dim>::create_right_hand_side (const DoFHandler<dim> &dof,
- const Quadrature<dim> &quadrature,
- const Function<dim> &rhs,
- Vector<double> &rhs_vector)
+void VectorTools::create_right_hand_side (const DoFHandler<dim> &dof,
+ const Quadrature<dim> &quadrature,
+ const Function<dim> &rhs,
+ Vector<double> &rhs_vector)
{
Assert (dof.get_fe().n_components() == rhs.n_components,
ExcComponentMismatch());
template <>
void
-VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof,
- const unsigned char boundary_component,
- const Function<1> &boundary_function,
- map<int,double> &boundary_values,
- const vector<bool> &component_mask_)
+VectorTools::interpolate_boundary_values (const DoFHandler<1> &dof,
+ const unsigned char boundary_component,
+ const Function<1> &boundary_function,
+ map<int,double> &boundary_values,
+ const vector<bool> &component_mask_)
{
Assert (boundary_component != 255,
ExcInvalidBoundaryIndicator());
template <int dim>
void
-VectorTools<dim>::interpolate_boundary_values (const DoFHandler<dim> &dof,
- const unsigned char boundary_component,
- const Function<dim> &boundary_function,
- map<int,double> &boundary_values,
- const vector<bool> &component_mask_)
+VectorTools::interpolate_boundary_values (const DoFHandler<dim> &dof,
+ const unsigned char boundary_component,
+ const Function<dim> &boundary_function,
+ map<int,double> &boundary_values,
+ const vector<bool> &component_mask_)
{
Assert (boundary_component != 255,
ExcInvalidBoundaryIndicator());
template <int dim>
void
-VectorTools<dim>::project_boundary_values (const DoFHandler<dim> &dof,
- const FunctionMap &boundary_functions,
- const Quadrature<dim-1> &q,
- map<int,double> &boundary_values)
+VectorTools::project_boundary_values (const DoFHandler<dim> &dof,
+ const map<unsigned char,const Function<dim>*> &boundary_functions,
+ const Quadrature<dim-1> &q,
+ map<int,double> &boundary_values)
{
Assert (dof.get_fe().n_components() == boundary_functions.begin()->second->n_components,
ExcComponentMismatch());
template <int dim>
void
-VectorTools<dim>::integrate_difference (const DoFHandler<dim> &dof,
- const Vector<double> &fe_function,
- const Function<dim> &exact_solution,
- Vector<float> &difference,
- const Quadrature<dim> &q,
- const NormType &norm,
- const Function<dim> *weight)
+VectorTools::integrate_difference (const DoFHandler<dim> &dof,
+ const Vector<double> &fe_function,
+ const Function<dim> &exact_solution,
+ Vector<float> &difference,
+ const Quadrature<dim> &q,
+ const NormType &norm,
+ const Function<dim> *weight)
{
const unsigned int n_q_points = q.n_quadrature_points;
const FiniteElement<dim> &fe = dof.get_fe();
-template<int dim>
void
-VectorTools<dim>::subtract_mean_value(Vector<double> &v,
- const vector<bool> &p_select)
+VectorTools::subtract_mean_value(Vector<double> &v,
+ const vector<bool> &p_select)
{
unsigned int n = v.size();
Assert(n == p_select.size(), ExcDimensionMismatch(n, p_select.size()));
// explicit instantiations
-template VectorTools<deal_II_dimension>;
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+ const Vector<double> &,
+ const Function<deal_II_dimension> &,
+ Vector<float> &,
+ const Quadrature<deal_II_dimension> &,
+ const NormType &,
+ const Function<deal_II_dimension> *);
+template
+void VectorTools::project_boundary_values (const DoFHandler<deal_II_dimension> &,
+ const map<unsigned char,const Function<deal_II_dimension>*>&,
+ const Quadrature<deal_II_dimension-1>&,
+ map<int,double> &);
+template
+void VectorTools::interpolate_boundary_values (const DoFHandler<deal_II_dimension> &,
+ const unsigned char,
+ const Function<deal_II_dimension> &,
+ map<int,double> &,
+ const vector<bool> &);
+template
+void VectorTools::create_right_hand_side (const DoFHandler<deal_II_dimension> &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension> &,
+ Vector<double> &);
+template
+void VectorTools::project (const DoFHandler<deal_II_dimension> &,
+ const ConstraintMatrix &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension> &,
+ Vector<double> &,
+ const bool,
+ const Quadrature<deal_II_dimension-1> &,
+ const bool);
+template
+void VectorTools::interpolate(const DoFHandler<deal_II_dimension> &,
+ const DoFHandler<deal_II_dimension> &,
+ const FullMatrix<double> &,
+ const Vector<double> &,
+ Vector<double> &);
+template
+void VectorTools::interpolate (const DoFHandler<deal_II_dimension> &,
+ const Function<deal_II_dimension> &,
+ Vector<double> &);
Vector<float> h1_seminorm_error_per_cell, h1_error_per_cell;
cout << " Calculating L1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
l1_error_per_cell,
*quadrature, L1_norm);
l1_error.push_back (l1_error_per_cell.l1_norm());
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
l2_error_per_cell,
*quadrature, L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
linfty_error_per_cell,
*quadrature, Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1-seminorm error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
h1_seminorm_error_per_cell,
*quadrature, H1_seminorm);
h1_seminorm_error.push_back (h1_seminorm_error_per_cell.l2_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, sol,
h1_error_per_cell,
*quadrature, H1_norm);
// Vector<double> projected_solution;
// ConstraintMatrix constraints;
// constraints.close ();
-// VectorTools<dim>::project (*dof, constraints, *fe,
+// VectorTools::project (*dof, constraints, *fe,
// StraightBoundary<dim>(), *quadrature,
// sol, projected_solution, false,
// *boundary_quadrature);
// cout << " Calculating L2 error of projected solution... ";
-// VectorTools<dim>::integrate_difference (*dof_handler,
+// VectorTools::integrate_difference (*dof_handler,
// projected_solution, sol,
// l2_error_per_cell,
// *quadrature, *fe, L2_norm);
QGauss3<dim> q;
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
l2_error_per_cell, q,
L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
linfty_error_per_cell, q,
Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof_handler,
+ VectorTools::integrate_difference (*dof_handler,
solution, *solution_function,
h1_error_per_cell, q,
H1_norm);
for (FunctionMap::const_iterator bc=dirichlet_bc.begin();
bc != dirichlet_bc.end(); ++bc)
- VectorTools<dim>::interpolate_boundary_values (*dof,
+ VectorTools::interpolate_boundary_values (*dof,
bc->first,
*bc->second,
boundary_value_list);
Vector<float> h1_seminorm_error_per_cell, h1_error_per_cell;
cout << " Calculating L1 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
l1_error_per_cell,
*quadrature, L1_norm);
l1_error.push_back (l1_error_per_cell.l1_norm());
cout << " Calculating L2 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
l2_error_per_cell,
*quadrature, L2_norm);
l2_error.push_back (l2_error_per_cell.l2_norm());
cout << " Calculating L-infinity error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
linfty_error_per_cell,
*quadrature, Linfty_norm);
linfty_error.push_back (linfty_error_per_cell.linfty_norm());
cout << " Calculating H1-seminorm error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
h1_seminorm_error_per_cell,
*quadrature, H1_seminorm);
h1_seminorm_error.push_back (h1_seminorm_error_per_cell.l2_norm());
cout << " Calculating H1 error... ";
- VectorTools<dim>::integrate_difference (*dof,
+ VectorTools::integrate_difference (*dof,
solution, sol,
h1_error_per_cell,
*quadrature, H1_norm);
// Vector<double> projected_solution;
// ConstraintMatrix constraints;
// constraints.close ();
-// VectorTools<dim>::project (*dof, constraints, *fe,
+// VectorTools::project (*dof, constraints, *fe,
// StraightBoundary<dim>(), *quadrature,
// sol, projected_solution, false,
// *boundary_quadrature);
// cout << " Calculating L2 error of projected solution... ";
-// VectorTools<dim>::integrate_difference (*dof,
+// VectorTools::integrate_difference (*dof,
// projected_solution, sol,
// l2_error_per_cell,
// *quadrature, *fe, L2_norm);
{
static const ZeroFunction<dim> boundary_values;
- VectorTools<dim>::interpolate_boundary_values (*dof_handler, 0, boundary_values,
+ VectorTools::interpolate_boundary_values (*dof_handler, 0, boundary_values,
boundary_value_list);
MatrixTools<dim>::apply_boundary_values (boundary_value_list,
system_matrix, v,
// use L2-projection for u0 and v0
#if 2 == 1
- VectorTools<dim>::interpolate (*dof_handler, *parameters.initial_u, u);
- VectorTools<dim>::interpolate (*dof_handler, *parameters.initial_v, v);
+ VectorTools::interpolate (*dof_handler, *parameters.initial_u, u);
+ VectorTools::interpolate (*dof_handler, *parameters.initial_v, v);
#else
- VectorTools<dim>::project (*dof_handler, constraints,
+ VectorTools::project (*dof_handler, constraints,
quadrature, *parameters.initial_u, u,
false, quadrature_face, (dim==2 ? true : false));
- VectorTools<dim>::project (*dof_handler, constraints,
+ VectorTools::project (*dof_handler, constraints,
quadrature, *parameters.initial_v, v,
false, quadrature_face, (dim==2 ? true : false));
#endif
parameters.boundary_values_v->set_time (time);
map<int,double> boundary_value_list;
- VectorTools<dim>::interpolate_boundary_values (*dof_handler, 0,
+ VectorTools::interpolate_boundary_values (*dof_handler, 0,
*(parameters.boundary_values_u),
boundary_value_list);
MatrixTools<dim>::apply_boundary_values (boundary_value_list,
if (dim != 1)
{
map<int,double> boundary_value_list;
- VectorTools<dim>::interpolate_boundary_values (*dof_handler, 0,
+ VectorTools::interpolate_boundary_values (*dof_handler, 0,
*(parameters.boundary_values_v),
boundary_value_list);
MatrixTools<dim>::apply_boundary_values (boundary_value_list,