FullMatrix<number> cell_matrix;
dealii::Vector<number> cell_rhs;
const AffineConstraints<number> * constraints;
+ bool is_locally_owned;
};
} // namespace AssemblerData
& data,
MatrixCreator::internal::AssemblerData::CopyData<number> ©_data)
{
+ copy_data.is_locally_owned = cell->is_locally_owned();
+ if (copy_data.is_locally_owned == false)
+ return;
+
data.x_fe_values.reinit(cell);
const FEValues<dim, spacedim> &fe_values =
data.x_fe_values.get_present_fe_values();
- template <int dim, int spacedim, typename CellIterator>
+ template <int dim, int spacedim, typename CellIterator, typename Number>
void
laplace_assembler(
const CellIterator &cell,
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
+ MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, Number>
& data,
- MatrixCreator::internal::AssemblerData::CopyData<double> ©_data)
+ MatrixCreator::internal::AssemblerData::CopyData<Number> ©_data)
{
+ copy_data.is_locally_owned = cell->is_locally_owned();
+ if (copy_data.is_locally_owned == false)
+ return;
+
data.x_fe_values.reinit(cell);
const FEValues<dim, spacedim> &fe_values =
data.x_fe_values.get_present_fe_values();
else
{
data.rhs_vector_values.resize(
- n_q_points, dealii::Vector<double>(n_components));
+ n_q_points, dealii::Vector<Number>(n_components));
data.rhs_function->vector_value_list(
fe_values.get_quadrature_points(), data.rhs_vector_values);
}
else
{
data.coefficient_vector_values.resize(
- n_q_points, dealii::Vector<double>(n_components));
+ n_q_points, dealii::Vector<Number>(n_components));
data.coefficient->vector_value_list(
fe_values.get_quadrature_points(),
data.coefficient_vector_values);
const std::vector<double> &JxW = fe_values.get_JxW_values();
- double add_data;
+ Number add_data;
for (unsigned int i = 0; i < dofs_per_cell; ++i)
if (fe.is_primitive())
{
MatrixType * matrix,
VectorType * right_hand_side)
{
+ if (data.is_locally_owned == false)
+ return;
+
const unsigned int dofs_per_cell = data.dof_indices.size();
(void)dofs_per_cell;
namespace MatrixCreator
{
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
const auto & fe_collection = dof.get_fe_collection();
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(fe_collection,
- update_values | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points :
- UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q_collection,
- mapping_collection);
-
- MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(fe_collection,
+ update_values | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q_collection,
+ mapping_collection);
+
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
dim,
spacedim,
typename DoFHandler<dim, spacedim>::active_cell_iterator,
- number>,
- [&matrix](const internal::AssemblerData::CopyData<number> &data) {
+ typename SparseMatrixType::value_type>,
+ [&matrix](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(
- data, &matrix, static_cast<Vector<number> *>(nullptr));
+ data,
+ &matrix,
+ static_cast<Vector<typename SparseMatrixType::value_type> *>(
+ nullptr));
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()),
dof,
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
const auto & fe_collection = dof.get_fe_collection();
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(fe_collection,
- update_values | update_JxW_values |
- update_quadrature_points,
- coefficient,
- &rhs,
- q_collection,
- mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(fe_collection,
+ update_values | update_JxW_values |
+ update_quadrature_points,
+ coefficient,
+ &rhs,
+ q_collection,
+ mapping_collection);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
dim,
spacedim,
typename DoFHandler<dim, spacedim>::active_cell_iterator,
- number>,
- [&matrix,
- &rhs_vector](const internal::AssemblerData::CopyData<number> &data) {
+ typename SparseMatrixType::value_type>,
+ [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(data,
&matrix,
&rhs_vector);
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()),
dof,
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const hp::MappingCollection<dim, spacedim> &mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
Assert(matrix.n() == dof.n_dofs(),
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(dof.get_fe_collection(),
- update_values | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points :
- UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q,
- mapping);
- MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(dof.get_fe_collection(),
+ update_values | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q,
+ mapping);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
dim,
spacedim,
typename DoFHandler<dim, spacedim>::active_cell_iterator,
- number>,
- [&matrix](const internal::AssemblerData::CopyData<number> &data) {
+ typename SparseMatrixType::value_type>,
+ [&matrix](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(
- data, &matrix, static_cast<Vector<number> *>(nullptr));
+ data,
+ &matrix,
+ static_cast<Vector<typename SparseMatrixType::value_type> *>(
+ nullptr));
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const DoFHandler<dim, spacedim> &dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_mass_matrix(hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
dof,
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const hp::MappingCollection<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
Assert(matrix.n() == dof.n_dofs(),
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(dof.get_fe_collection(),
- update_values | update_JxW_values |
- update_quadrature_points,
- coefficient,
- &rhs,
- q,
- mapping);
- MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(dof.get_fe_collection(),
+ update_values | update_JxW_values |
+ update_quadrature_points,
+ coefficient,
+ &rhs,
+ q,
+ mapping);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
dim,
spacedim,
typename DoFHandler<dim, spacedim>::active_cell_iterator,
- number>,
- [&matrix,
- &rhs_vector](const internal::AssemblerData::CopyData<number> &data) {
+ typename SparseMatrixType::value_type>,
+ [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(data,
&matrix,
&rhs_vector);
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_mass_matrix(const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const coefficient,
- const AffineConstraints<number> & constraints)
+ create_mass_matrix(
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_mass_matrix(hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
dof,
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
const auto & fe_collection = dof.get_fe_collection();
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(fe_collection,
- update_gradients | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points :
- UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q_collection,
- mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(fe_collection,
+ update_gradients | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q_collection,
+ mapping_collection);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
&MatrixCreator::internal::laplace_assembler<
dim,
spacedim,
- typename DoFHandler<dim, spacedim>::active_cell_iterator>,
- [&matrix](const internal::AssemblerData::CopyData<double> &data) {
+ typename DoFHandler<dim, spacedim>::active_cell_iterator,
+ typename SparseMatrixType::value_type>,
+ [&matrix](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(
- data, &matrix, static_cast<Vector<double> *>(nullptr));
+ data,
+ &matrix,
+ static_cast<Vector<typename SparseMatrixType::value_type> *>(
+ nullptr));
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()),
dof,
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
const auto & fe_collection = dof.get_fe_collection();
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(fe_collection,
- update_gradients | update_values | update_JxW_values |
- update_quadrature_points,
- coefficient,
- &rhs,
- q_collection,
- mapping_collection);
- MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(fe_collection,
+ update_gradients | update_values | update_JxW_values |
+ update_quadrature_points,
+ coefficient,
+ &rhs,
+ q_collection,
+ mapping_collection);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
&MatrixCreator::internal::laplace_assembler<
dim,
spacedim,
- typename DoFHandler<dim, spacedim>::active_cell_iterator>,
- [&matrix,
- &rhs_vector](const internal::AssemblerData::CopyData<double> &data) {
+ typename DoFHandler<dim, spacedim>::active_cell_iterator,
+ typename SparseMatrixType::value_type>,
+ [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(data,
&matrix,
&rhs_vector);
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()),
dof,
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> & constraints)
+ create_laplace_matrix(
+ const hp::MappingCollection<dim, spacedim> &mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
Assert(matrix.n() == dof.n_dofs(),
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(dof.get_fe_collection(),
- update_gradients | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points :
- UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q,
- mapping);
- MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(dof.get_fe_collection(),
+ update_gradients | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q,
+ mapping);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
&MatrixCreator::internal::laplace_assembler<
dim,
spacedim,
- typename DoFHandler<dim, spacedim>::active_cell_iterator>,
- [&matrix](const internal::AssemblerData::CopyData<double> &data) {
+ typename DoFHandler<dim, spacedim>::active_cell_iterator,
+ typename SparseMatrixType::value_type>,
+ [&matrix](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(
- data, &matrix, static_cast<Vector<double> *>(nullptr));
+ data,
+ &matrix,
+ static_cast<Vector<typename SparseMatrixType::value_type> *>(
+ nullptr));
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const DoFHandler<dim, spacedim> &dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const DoFHandler<dim, spacedim> &dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_laplace_matrix(
hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> & constraints)
+ create_laplace_matrix(
+ const hp::MappingCollection<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
Assert(matrix.m() == dof.n_dofs(),
ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
Assert(matrix.n() == dof.n_dofs(),
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
- MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(dof.get_fe_collection(),
- update_gradients | update_values | update_JxW_values |
- update_quadrature_points,
- coefficient,
- &rhs,
- q,
- mapping);
- MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
+ MatrixCreator::internal::AssemblerData::
+ Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+ assembler_data(dof.get_fe_collection(),
+ update_gradients | update_values | update_JxW_values |
+ update_quadrature_points,
+ coefficient,
+ &rhs,
+ q,
+ mapping);
+ MatrixCreator::internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type>
+ copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
assembler_data.fe_collection.max_dofs_per_cell());
&MatrixCreator::internal::laplace_assembler<
dim,
spacedim,
- typename DoFHandler<dim, spacedim>::active_cell_iterator>,
- [&matrix,
- &rhs_vector](const internal::AssemblerData::CopyData<double> &data) {
+ typename DoFHandler<dim, spacedim>::active_cell_iterator,
+ typename SparseMatrixType::value_type>,
+ [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
+ typename SparseMatrixType::value_type> &data) {
MatrixCreator::internal::copy_local_to_global(data,
&matrix,
&rhs_vector);
},
assembler_data,
copy_data);
+
+ matrix.compress(VectorOperation::add);
}
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
- create_laplace_matrix(const DoFHandler<dim, spacedim> &dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const coefficient,
- const AffineConstraints<double> &constraints)
+ create_laplace_matrix(
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type>
+ *const coefficient,
+ const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
{
create_laplace_matrix(
hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
*
* See the general documentation of this namespace for more information.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Call the create_mass_matrix() function, see above, with
* <tt>mapping=MappingQ@<dim@>(1)</tt>.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const DoFHandler<dim, spacedim> &dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Assemble the mass matrix and a right hand side vector. If no coefficient
*
* See the general documentation of this namespace for more information.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Call the create_mass_matrix() function, see above, with
* <tt>mapping=MappingQ@<dim@>(1)</tt>.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const DoFHandler<dim, spacedim> & dof,
- const Quadrature<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Same function as above, but for hp-objects.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
const hp::MappingCollection<dim, spacedim> &mapping,
const DoFHandler<dim, spacedim> & dof,
const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Same function as above, but for hp-objects.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const DoFHandler<dim, spacedim> &dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Same function as above, but for hp-objects.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const hp::MappingCollection<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Same function as above, but for hp-objects.
*/
- template <int dim, int spacedim, typename number>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_mass_matrix(
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<number> & matrix,
- const Function<spacedim, number> & rhs,
- Vector<number> & rhs_vector,
- const Function<spacedim, number> *const a = nullptr,
- const AffineConstraints<number> &constraints = AffineConstraints<number>());
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
*
* See the general documentation of this namespace for more information.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
const Mapping<dim, spacedim> & mapping,
const DoFHandler<dim, spacedim> &dof,
const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Call the create_laplace_matrix() function, see above, with
* <tt>mapping=MappingQ@<dim@>(1)</tt>.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
const DoFHandler<dim, spacedim> &dof,
const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Assemble the Laplace matrix and a right hand side vector. If no
*
* See the general documentation of this namespace for more information.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
- const Mapping<dim, spacedim> & mapping,
- const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ const Mapping<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Call the create_laplace_matrix() function, see above, with
* <tt>mapping=MappingQ@<dim@>(1)</tt>.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
- const DoFHandler<dim, spacedim> &dof,
- const Quadrature<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ const DoFHandler<dim, spacedim> & dof,
+ const Quadrature<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Like the functions above, but for hp-objects.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
const hp::MappingCollection<dim, spacedim> &mapping,
const DoFHandler<dim, spacedim> & dof,
const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Like the functions above, but for hp-objects.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
const DoFHandler<dim, spacedim> &dof,
const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Like the functions above, but for hp-objects.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
- const hp::MappingCollection<dim, spacedim> &mapping,
- const DoFHandler<dim, spacedim> & dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ const hp::MappingCollection<dim, spacedim> & mapping,
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Like the functions above, but for hp-objects.
*/
- template <int dim, int spacedim>
+ template <int dim, int spacedim, typename SparseMatrixType>
void
create_laplace_matrix(
- const DoFHandler<dim, spacedim> &dof,
- const hp::QCollection<dim> & q,
- SparseMatrix<double> & matrix,
- const Function<spacedim> & rhs,
- Vector<double> & rhs_vector,
- const Function<spacedim> *const a = nullptr,
- const AffineConstraints<double> &constraints = AffineConstraints<double>());
+ const DoFHandler<dim, spacedim> & dof,
+ const hp::QCollection<dim> & q,
+ SparseMatrixType & matrix,
+ const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
+ Vector<typename SparseMatrixType::value_type> & rhs_vector,
+ const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+ nullptr,
+ const AffineConstraints<typename SparseMatrixType::value_type> &
+ constraints = AffineConstraints<typename SparseMatrixType::value_type>());
/**
* Exception
// MatrixCreator::create_mass_matrix for the matrix only --> only real-valued
// scalars
-for (scalar : REAL_SCALARS; deal_II_dimension : DIMENSIONS;
+for (deal_II_sparse_matrix_type : SPARSE_MATRICES;
+ deal_II_dimension : DIMENSIONS;
deal_II_space_dimension : SPACE_DIMENSIONS)
{
#if deal_II_dimension <= deal_II_space_dimension
// non-hp-version of create_mass_matrix
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
// hp-versions of functions
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
- & mapping,
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
+ & mapping,
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
#endif
}
{
#if deal_II_dimension <= deal_II_space_dimension
// non-hp-version of create_mass_matrix
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> & rhs,
- Vector<scalar> & rhs_vector,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> & rhs,
- Vector<scalar> & rhs_vector,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ SparseMatrix<scalar>>(
+ const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const Quadrature<deal_II_dimension> & q,
+ SparseMatrix<scalar> & matrix,
+ const Function<deal_II_space_dimension, scalar> & rhs,
+ Vector<scalar> & rhs_vector,
+ const Function<deal_II_space_dimension, scalar> *const coefficient,
+ const AffineConstraints<scalar> &constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ SparseMatrix<scalar>>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const Quadrature<deal_II_dimension> & q,
+ SparseMatrix<scalar> & matrix,
+ const Function<deal_II_space_dimension, scalar> & rhs,
+ Vector<scalar> & rhs_vector,
+ const Function<deal_II_space_dimension, scalar> *const coefficient,
+ const AffineConstraints<scalar> &constraints);
// hp-version
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
- & mapping,
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> & rhs,
- Vector<scalar> & rhs_vector,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ SparseMatrix<scalar>>(
+ const hp::MappingCollection<deal_II_dimension, deal_II_space_dimension>
+ & mapping,
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ SparseMatrix<scalar> & matrix,
+ const Function<deal_II_space_dimension, scalar> & rhs,
+ Vector<scalar> & rhs_vector,
+ const Function<deal_II_space_dimension, scalar> *const coefficient,
+ const AffineConstraints<scalar> &constraints);
- template void MatrixCreator::
- create_mass_matrix<deal_II_dimension, deal_II_space_dimension, scalar>(
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<scalar> & matrix,
- const Function<deal_II_space_dimension, scalar> & rhs,
- Vector<scalar> & rhs_vector,
- const Function<deal_II_space_dimension, scalar> *const coefficient,
- const AffineConstraints<scalar> & constraints);
+ template void MatrixCreator::create_mass_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ SparseMatrix<scalar>>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ SparseMatrix<scalar> & matrix,
+ const Function<deal_II_space_dimension, scalar> & rhs,
+ Vector<scalar> & rhs_vector,
+ const Function<deal_II_space_dimension, scalar> *const coefficient,
+ const AffineConstraints<scalar> &constraints);
#endif
}
-for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
+for (deal_II_sparse_matrix_type : SPARSE_MATRICES;
+ deal_II_dimension : DIMENSIONS;
+ deal_II_space_dimension : SPACE_DIMENSIONS)
{
#if deal_II_dimension == deal_II_space_dimension
// non-hp-versions of create_laplace_matrix
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const DoFHandler<deal_II_dimension> & dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const Mapping<deal_II_dimension> & mapping,
- const DoFHandler<deal_II_dimension> & dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const Mapping<deal_II_dimension> & mapping,
- const DoFHandler<deal_II_dimension> & dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const DoFHandler<deal_II_dimension> & dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension> &dof,
+ const Quadrature<deal_II_dimension> &q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const Mapping<deal_II_dimension> & mapping,
+ const DoFHandler<deal_II_dimension> &dof,
+ const Quadrature<deal_II_dimension> &q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const Mapping<deal_II_dimension> & mapping,
+ const DoFHandler<deal_II_dimension> & dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension> & dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
// hp-versions of create_laplace_matrix
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
const DoFHandler<deal_II_dimension> & dof,
const hp::QCollection<deal_II_dimension> &q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const hp::MappingCollection<deal_II_dimension> &mapping,
- const DoFHandler<deal_II_dimension> & dof,
- const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
const hp::MappingCollection<deal_II_dimension> &mapping,
const DoFHandler<deal_II_dimension> & dof,
const hp::QCollection<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension>(
- const DoFHandler<deal_II_dimension> & dof,
- const hp::QCollection<deal_II_dimension> &q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_dimension> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_dimension> *const coefficient,
- const AffineConstraints<double> & constraints);
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const hp::MappingCollection<deal_II_dimension> & mapping,
+ const DoFHandler<deal_II_dimension> & dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension> & dof,
+ const hp::QCollection<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
#endif
}
-for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
+for (deal_II_sparse_matrix_type : SPARSE_MATRICES;
+ deal_II_dimension : DIMENSIONS;
+ deal_II_space_dimension : SPACE_DIMENSIONS)
{
#if deal_II_dimension < deal_II_space_dimension
// non-hp-version of create_laplace_matrix
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension,
- deal_II_space_dimension>(
- const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_space_dimension, double> *const coefficient,
- const AffineConstraints<double> &constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension,
- deal_II_space_dimension>(
- const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
- const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_space_dimension, double> *const coefficient,
- const AffineConstraints<double> &constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension,
- deal_II_space_dimension>(
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_space_dimension, double> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_space_dimension, double> *const coefficient,
- const AffineConstraints<double> &constraints);
- template void MatrixCreator::create_laplace_matrix<deal_II_dimension,
- deal_II_space_dimension>(
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
const DoFHandler<deal_II_dimension, deal_II_space_dimension> &dof,
const Quadrature<deal_II_dimension> & q,
- SparseMatrix<double> & matrix,
- const Function<deal_II_space_dimension, double> & rhs,
- Vector<double> & rhs_vector,
- const Function<deal_II_space_dimension, double> *const coefficient,
- const AffineConstraints<double> &constraints);
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const Mapping<deal_II_dimension, deal_II_space_dimension> & mapping,
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> & dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
+ template void
+ MatrixCreator::create_laplace_matrix<deal_II_dimension,
+ deal_II_space_dimension,
+ deal_II_sparse_matrix_type>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> & dof,
+ const Quadrature<deal_II_dimension> & q,
+ deal_II_sparse_matrix_type & matrix,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type> &rhs,
+ Vector<typename deal_II_sparse_matrix_type::value_type> &rhs_vector,
+ const Function<deal_II_space_dimension,
+ typename deal_II_sparse_matrix_type::value_type>
+ *const coefficient,
+ const AffineConstraints<typename deal_II_sparse_matrix_type::value_type>
+ &constraints);
#endif
}
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2021 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Test MatrixCreator::create_mass_matrix() and
+// MatrixCreator::create_laplace_matrix() for Trilinos and PETSc matrices in
+// parallel.
+
+#include <deal.II/base/mpi.h>
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/dofs/dof_tools.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/lac/generic_linear_algebra.h>
+#include <deal.II/lac/sparsity_tools.h>
+
+#include <deal.II/numerics/matrix_tools.h>
+
+#include "../tests.h"
+
+using namespace dealii;
+
+template <int dim, typename MatrixType>
+void
+test()
+{
+ parallel::distributed::Triangulation<dim> tria(MPI_COMM_WORLD);
+ GridGenerator::hyper_cube(tria);
+ tria.refine_global(2);
+
+ FE_Q<dim> fe(2);
+ QGauss<dim> quad(3);
+
+ DoFHandler<dim> dof_handler(tria);
+ dof_handler.distribute_dofs(fe);
+
+ const auto mpi_comm = dof_handler.get_communicator();
+ const IndexSet &owned_dofs = dof_handler.locally_owned_dofs();
+
+ IndexSet relevant_dofs;
+ DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_dofs);
+
+ AffineConstraints<typename MatrixType::value_type> constraints;
+
+ DynamicSparsityPattern sparsity_pattern(relevant_dofs);
+ DoFTools::make_sparsity_pattern(dof_handler, sparsity_pattern, constraints);
+ SparsityTools::distribute_sparsity_pattern(sparsity_pattern,
+ owned_dofs,
+ mpi_comm,
+ relevant_dofs);
+
+ MatrixType matrix;
+ matrix.reinit(owned_dofs, owned_dofs, sparsity_pattern, mpi_comm);
+
+ MatrixCreator::create_laplace_matrix(dof_handler, quad, matrix);
+ deallog << "Laplace matrix: " << matrix.frobenius_norm() << std::endl;
+
+ matrix = 0.0;
+ MatrixCreator::create_mass_matrix(dof_handler, quad, matrix);
+ deallog << "Mass matrix: " << matrix.frobenius_norm() << std::endl;
+}
+
+int
+main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ mpi_initlog();
+
+ {
+ deallog.push("Trilinos");
+ test<2, TrilinosWrappers::SparseMatrix>();
+ deallog.pop();
+ }
+ {
+ deallog.push("PETSc");
+ test<2, PETScWrappers::MPI::SparseMatrix>();
+ deallog.pop();
+ }
+}
--- /dev/null
+
+DEAL:Trilinos::Laplace matrix: 34.9481
+DEAL:Trilinos::Mass matrix: 0.0916667
+DEAL:PETSc::Laplace matrix: 34.9481
+DEAL:PETSc::Mass matrix: 0.0916667
--- /dev/null
+
+DEAL:Trilinos::Laplace matrix: 34.9481
+DEAL:Trilinos::Mass matrix: 0.0916667
+DEAL:PETSc::Laplace matrix: 34.9481
+DEAL:PETSc::Mass matrix: 0.0916667