From: Wolfgang Bangerth
Date: Wed, 17 Jun 2015 17:26:41 +0000 (-0500)
Subject: Match the template arguments of matrix and vector for MatrixCreator::create_mass_matr...
X-Git-Tag: v8.3.0-rc1~104^2~3
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9799f7361c06a610f72c14fc3ca4e724bd1b34a;p=dealii.git
Match the template arguments of matrix and vector for MatrixCreator::create_mass_matrix. This also allows us to re-enable the float-instantiations of this class, thereby fixing umfpack/umfpack_07.
---
diff --git a/doc/news/changes.h b/doc/news/changes.h
index e2f743a95d..3bd537bfe5 100644
--- a/doc/news/changes.h
+++ b/doc/news/changes.h
@@ -38,6 +38,14 @@ inconvenience this causes.
+ - Changed: MatrixCreator::create_mass_matrix() took matrix and vector
+ objects where the scalar type of the matrix was a template argument
+ but the scalar type of the vector was always
double
. This
+ has been changed so that the two always need to match.
+
+ (David Davydov, Wolfgang Bangerth, 2015/06/17)
+
+
- Changed: Functions such as FEValuesBase::get_function_values() that
extracted the values of functions at the quadrature points of a cell
implicitly always assumed that
double
is a reasonable
diff --git a/include/deal.II/numerics/matrix_tools.h b/include/deal.II/numerics/matrix_tools.h
index b72cc11c81..9daa1ebd2c 100644
--- a/include/deal.II/numerics/matrix_tools.h
+++ b/include/deal.II/numerics/matrix_tools.h
@@ -273,7 +273,7 @@ namespace MatrixCreator
const Quadrature &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const a = 0,
const ConstraintMatrix &constraints = ConstraintMatrix());
@@ -286,7 +286,7 @@ namespace MatrixCreator
const Quadrature &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const a = 0,
const ConstraintMatrix &constraints = ConstraintMatrix());
@@ -320,7 +320,7 @@ namespace MatrixCreator
const hp::QCollection &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const a = 0,
const ConstraintMatrix &constraints = ConstraintMatrix());
@@ -332,7 +332,7 @@ namespace MatrixCreator
const hp::QCollection &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const a = 0,
const ConstraintMatrix &constraints = ConstraintMatrix());
@@ -360,7 +360,6 @@ namespace MatrixCreator
* shape functions.
*/
template
-
void create_boundary_mass_matrix (const Mapping &mapping,
const DoFHandler &dof,
const Quadrature &q,
@@ -400,7 +399,6 @@ namespace MatrixCreator
* mapping=MappingQ1@().
*/
template
-
void create_boundary_mass_matrix (const DoFHandler &dof,
const Quadrature &q,
SparseMatrix &matrix,
@@ -414,7 +412,6 @@ namespace MatrixCreator
* Same function as above, but for hp objects.
*/
template
-
void create_boundary_mass_matrix (const hp::MappingCollection &mapping,
const hp::DoFHandler &dof,
const hp::QCollection &q,
@@ -442,7 +439,6 @@ namespace MatrixCreator
* Same function as above, but for hp objects.
*/
template
-
void create_boundary_mass_matrix (const hp::DoFHandler &dof,
const hp::QCollection &q,
SparseMatrix &matrix,
diff --git a/source/numerics/matrix_tools.cc b/source/numerics/matrix_tools.cc
index 8a385ed620..ef56f60fdb 100644
--- a/source/numerics/matrix_tools.cc
+++ b/source/numerics/matrix_tools.cc
@@ -201,11 +201,12 @@ namespace MatrixCreator
};
+ template
struct CopyData
{
std::vector dof_indices;
- FullMatrix cell_matrix;
- dealii::Vector cell_rhs;
+ FullMatrix cell_matrix;
+ dealii::Vector cell_rhs;
const ConstraintMatrix *constraints;
};
}
@@ -213,10 +214,11 @@ namespace MatrixCreator
template
+ typename CellIterator,
+ typename number>
void mass_assembler (const CellIterator &cell,
MatrixCreator::internal::AssemblerData::Scratch &data,
- MatrixCreator::internal::AssemblerData::CopyData ©_data)
+ MatrixCreator::internal::AssemblerData::CopyData ©_data)
{
data.x_fe_values.reinit (cell);
const FEValues &fe_values = data.x_fe_values.get_present_fe_values ();
@@ -397,7 +399,7 @@ namespace MatrixCreator
typename CellIterator>
void laplace_assembler (const CellIterator &cell,
MatrixCreator::internal::AssemblerData::Scratch &data,
- MatrixCreator::internal::AssemblerData::CopyData ©_data)
+ MatrixCreator::internal::AssemblerData::CopyData ©_data)
{
data.x_fe_values.reinit (cell);
const FEValues &fe_values = data.x_fe_values.get_present_fe_values ();
@@ -573,9 +575,10 @@ namespace MatrixCreator
- template
- void copy_local_to_global (const AssemblerData::CopyData &data,
+ void copy_local_to_global (const AssemblerData::CopyData &data,
MatrixType *matrix,
VectorType *right_hand_side)
{
@@ -666,7 +669,7 @@ namespace MatrixCreator
coefficient, /*rhs_function=*/0,
q_collection, mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -675,10 +678,10 @@ namespace MatrixCreator
WorkStream::run (dof.begin_active(),
static_cast::active_cell_iterator>(dof.end()),
- &MatrixCreator::internal::mass_assembler::active_cell_iterator>,
+ &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
- std_cxx11::_1, &matrix, (Vector *)0),
+ copy_local_to_global, Vector >,
+ std_cxx11::_1, &matrix, (Vector *)0),
assembler_data,
copy_data);
}
@@ -704,7 +707,7 @@ namespace MatrixCreator
const Quadrature &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const coefficient,
const ConstraintMatrix &constraints)
{
@@ -722,7 +725,7 @@ namespace MatrixCreator
update_JxW_values | update_quadrature_points,
coefficient, &rhs,
q_collection, mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -731,9 +734,9 @@ namespace MatrixCreator
WorkStream::run (dof.begin_active(),
static_cast::active_cell_iterator>(dof.end()),
- &MatrixCreator::internal::mass_assembler::active_cell_iterator>,
+ &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>,
std_cxx11::bind(&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1, &matrix, &rhs_vector),
assembler_data,
copy_data);
@@ -746,7 +749,7 @@ namespace MatrixCreator
const Quadrature &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const coefficient,
const ConstraintMatrix &constraints)
{
@@ -776,7 +779,7 @@ namespace MatrixCreator
(coefficient != 0 ? update_quadrature_points : UpdateFlags(0)),
coefficient, /*rhs_function=*/0,
q, mapping);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -785,10 +788,10 @@ namespace MatrixCreator
WorkStream::run (dof.begin_active(),
static_cast::active_cell_iterator>(dof.end()),
- &MatrixCreator::internal::mass_assembler::active_cell_iterator>,
+ &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
- std_cxx11::_1, &matrix, (Vector *)0),
+ copy_local_to_global, Vector >,
+ std_cxx11::_1, &matrix, (Vector *)0),
assembler_data,
copy_data);
}
@@ -814,7 +817,7 @@ namespace MatrixCreator
const hp::QCollection &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const coefficient,
const ConstraintMatrix &constraints)
{
@@ -829,7 +832,7 @@ namespace MatrixCreator
update_JxW_values | update_quadrature_points,
coefficient, &rhs,
q, mapping);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -838,9 +841,9 @@ namespace MatrixCreator
WorkStream::run (dof.begin_active(),
static_cast::active_cell_iterator>(dof.end()),
- &MatrixCreator::internal::mass_assembler::active_cell_iterator>,
+ &MatrixCreator::internal::mass_assembler::active_cell_iterator,number>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1, &matrix, &rhs_vector),
assembler_data,
copy_data);
@@ -853,7 +856,7 @@ namespace MatrixCreator
const hp::QCollection &q,
SparseMatrix &matrix,
const Function &rhs,
- Vector &rhs_vector,
+ Vector &rhs_vector,
const Function *const coefficient,
const ConstraintMatrix &constraints)
{
@@ -1678,7 +1681,7 @@ namespace MatrixCreator
(coefficient != 0 ? update_quadrature_points : UpdateFlags(0)),
coefficient, /*rhs_function=*/0,
q_collection, mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -1689,7 +1692,7 @@ namespace MatrixCreator
static_cast::active_cell_iterator>(dof.end()),
&MatrixCreator::internal::laplace_assembler::active_cell_iterator>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1,
&matrix,
(Vector *)NULL),
@@ -1735,7 +1738,7 @@ namespace MatrixCreator
update_JxW_values | update_quadrature_points,
coefficient, &rhs,
q_collection, mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -1746,7 +1749,7 @@ namespace MatrixCreator
static_cast::active_cell_iterator>(dof.end()),
&MatrixCreator::internal::laplace_assembler::active_cell_iterator>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1,
&matrix,
&rhs_vector),
@@ -1790,7 +1793,7 @@ namespace MatrixCreator
(coefficient != 0 ? update_quadrature_points : UpdateFlags(0)),
coefficient, /*rhs_function=*/0,
q, mapping);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -1801,7 +1804,7 @@ namespace MatrixCreator
static_cast::active_cell_iterator>(dof.end()),
&MatrixCreator::internal::laplace_assembler::active_cell_iterator>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1,
&matrix,
(Vector *)0),
@@ -1844,7 +1847,7 @@ namespace MatrixCreator
update_JxW_values | update_quadrature_points,
coefficient, &rhs,
q, mapping);
- MatrixCreator::internal::AssemblerData::CopyData copy_data;
+ MatrixCreator::internal::AssemblerData::CopyData copy_data;
copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
copy_data.cell_rhs.reinit (assembler_data.fe_collection.max_dofs_per_cell());
@@ -1855,7 +1858,7 @@ namespace MatrixCreator
static_cast::active_cell_iterator>(dof.end()),
&MatrixCreator::internal::laplace_assembler::active_cell_iterator>,
std_cxx11::bind (&MatrixCreator::internal::
- copy_local_to_global, Vector >,
+ copy_local_to_global, Vector >,
std_cxx11::_1,
&matrix,
&rhs_vector),
diff --git a/source/numerics/matrix_tools.inst.in b/source/numerics/matrix_tools.inst.in
index 1a787b7336..a2e9346dc5 100644
--- a/source/numerics/matrix_tools.inst.in
+++ b/source/numerics/matrix_tools.inst.in
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------
//
-// Copyright (C) 2010 - 2014 by the deal.II authors
+// Copyright (C) 2010 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
@@ -101,6 +101,42 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS
const Function * const,
std::vector);
+// same for float
+ template
+ void MatrixCreator::create_mass_matrix
+ (const Mapping &mapping,
+ const DoFHandler &dof,
+ const Quadrature &q,
+ SparseMatrix &matrix,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+ template
+ void MatrixCreator::create_mass_matrix
+ (const DoFHandler &dof,
+ const Quadrature &q,
+ SparseMatrix &matrix,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+ template
+ void MatrixCreator::create_mass_matrix
+ (const Mapping &mapping,
+ const DoFHandler &dof,
+ const Quadrature &q,
+ SparseMatrix &matrix,
+ const Function &rhs,
+ Vector &rhs_vector,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+ template
+ void MatrixCreator::create_mass_matrix
+ (const DoFHandler &dof,
+ const Quadrature &q,
+ SparseMatrix &matrix,
+ const Function &rhs,
+ Vector &rhs_vector,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+
#endif
}
@@ -109,8 +145,8 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS
// where applicable and move to codimension cases above also when applicable
for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
{
-#if deal_II_dimension <= deal_II_space_dimension
// hp versions of functions
+#if deal_II_dimension <= deal_II_space_dimension
template
void MatrixCreator::create_mass_matrix
(const hp::MappingCollection &mapping,
@@ -227,8 +263,56 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS
const Function * const coefficient,
const ConstraintMatrix &constraints);
+#endif
+
+// same for float
+#if deal_II_dimension <= deal_II_space_dimension
+
+ template
+ void MatrixCreator::create_mass_matrix
+ (const hp::MappingCollection &mapping,
+ const hp::DoFHandler &dof,
+ const hp::QCollection &q,
+ SparseMatrix &matrix,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+
+ template
+ void MatrixCreator::create_mass_matrix
+ (const hp::MappingCollection &mapping,
+ const hp::DoFHandler &dof,
+ const hp::QCollection &q,
+ SparseMatrix &matrix,
+ const Function &rhs,
+ Vector &rhs_vector,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
#endif
+
+#if deal_II_dimension == deal_II_space_dimension
+
+
+ template
+ void MatrixCreator::create_mass_matrix
+ (const hp::DoFHandler &dof,
+ const hp::QCollection &q,
+ SparseMatrix &matrix,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+
+ template
+ void MatrixCreator::create_mass_matrix
+ (const hp::DoFHandler &dof,
+ const hp::QCollection &q,
+ SparseMatrix &matrix,
+ const Function &rhs,
+ Vector &rhs_vector,
+ const Function * const coefficient,
+ const ConstraintMatrix &constraints);
+
+#endif
+
}