From 4e2015d90d8718942d3af8868521fa829b552c2b Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 10 Feb 2024 12:48:15 +0100 Subject: [PATCH] Enable MatrixCreator functions also for FullMatrix --- include/deal.II/numerics/matrix_creator.h | 234 +++++------ .../numerics/matrix_creator.templates.h | 381 ++++++++++-------- source/numerics/solution_transfer.cc | 11 +- 3 files changed, 337 insertions(+), 289 deletions(-) diff --git a/include/deal.II/numerics/matrix_creator.h b/include/deal.II/numerics/matrix_creator.h index bf9e6ec86f..8717d5c235 100644 --- a/include/deal.II/numerics/matrix_creator.h +++ b/include/deal.II/numerics/matrix_creator.h @@ -75,7 +75,7 @@ namespace hp * mapping than a (bi-/tri-)linear one, then you need to call the functions * with mapping argument should be used. * - * All functions take a sparse matrix object to hold the matrix to be created. + * All functions take a matrix object to hold the matrix to be created. * The functions assume that the matrix is initialized with a sparsity pattern * (SparsityPattern) corresponding to the given degree of freedom handler, * i.e. the sparsity structure is already as needed. You can do this by @@ -213,32 +213,32 @@ namespace MatrixCreator * * See the general documentation of this namespace for more information. */ - template + template void create_mass_matrix( - const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function *const a = + const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Call the create_mass_matrix() function, see above, with * mapping=MappingQ@(1). */ - template + template void create_mass_matrix( - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function *const a = + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Assemble the @ref GlossMassMatrix "mass matrix" and a right hand side vector. If no coefficient @@ -259,98 +259,98 @@ namespace MatrixCreator * * See the general documentation of this namespace for more information. */ - template + template void create_mass_matrix( const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Call the create_mass_matrix() function, see above, with * mapping=MappingQ@(1). */ - template + template void create_mass_matrix( const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Same function as above, but for hp-objects. */ - template + template void create_mass_matrix( - const hp::MappingCollection &mapping, - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function *const a = + const hp::MappingCollection &mapping, + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Same function as above, but for hp-objects. */ - template + template void create_mass_matrix( - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function *const a = + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Same function as above, but for hp-objects. */ - template + template void create_mass_matrix( const hp::MappingCollection &mapping, const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Same function as above, but for hp-objects. */ - template + template void create_mass_matrix( const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** @@ -462,32 +462,32 @@ namespace MatrixCreator * * See the general documentation of this namespace for more information. */ - template + template void create_laplace_matrix( - const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function *const a = + const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Call the create_laplace_matrix() function, see above, with * mapping=MappingQ@(1). */ - template + template void create_laplace_matrix( - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function *const a = + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Assemble the Laplace matrix and a right hand side vector. If no @@ -507,98 +507,98 @@ namespace MatrixCreator * * See the general documentation of this namespace for more information. */ - template + template void create_laplace_matrix( const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Call the create_laplace_matrix() function, see above, with * mapping=MappingQ@(1). */ - template + template void create_laplace_matrix( const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Like the functions above, but for hp-objects. */ - template + template void create_laplace_matrix( - const hp::MappingCollection &mapping, - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function *const a = + const hp::MappingCollection &mapping, + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Like the functions above, but for hp-objects. */ - template + template void create_laplace_matrix( - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function *const a = + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Like the functions above, but for hp-objects. */ - template + template void create_laplace_matrix( const hp::MappingCollection &mapping, const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Like the functions above, but for hp-objects. */ - template + template void create_laplace_matrix( const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const a = + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function *const a = nullptr, - const AffineConstraints & - constraints = AffineConstraints()); + const AffineConstraints &constraints = + AffineConstraints()); /** * Exception diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index d50a9026af..fecebdea7e 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -631,22 +631,57 @@ namespace MatrixCreator } // namespace AssemblerBoundary - } // namespace internal + + + + template + using compress_t = decltype(std::declval().compress( + std::declval())); + + + + template + constexpr bool has_compress = + dealii::internal::is_supported_operation; + + + + template < + typename MatrixType, + std::enable_if_t, MatrixType> * = nullptr> + void + compress(MatrixType &A, const VectorOperation::values operation) + { + A.compress(operation); + } + + + + template < + typename MatrixType, + std::enable_if_t, MatrixType> * = nullptr> + void + compress(MatrixType &, const VectorOperation::values) + { + // nothing to do + } + + } // namespace internal } // namespace MatrixCreator namespace MatrixCreator { - template + template void create_mass_matrix( const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -657,7 +692,7 @@ namespace MatrixCreator hp::QCollection q_collection(q); hp::MappingCollection mapping_collection(mapping); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(fe_collection, update_values | update_JxW_values | (coefficient != nullptr ? update_quadrature_points : @@ -668,7 +703,7 @@ namespace MatrixCreator mapping_collection); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -686,32 +721,32 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global( data, &matrix, - static_cast *>( - nullptr)); + static_cast *>(nullptr)); }, assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_mass_matrix( const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()), dof, @@ -723,18 +758,18 @@ namespace MatrixCreator - template + template void create_mass_matrix( - const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -745,7 +780,7 @@ namespace MatrixCreator hp::QCollection q_collection(q); hp::MappingCollection mapping_collection(mapping); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(fe_collection, update_values | update_JxW_values | update_quadrature_points, @@ -754,7 +789,7 @@ namespace MatrixCreator q_collection, mapping_collection); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -772,9 +807,10 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix, &rhs_vector](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix, &rhs_vector]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global(data, &matrix, &rhs_vector); @@ -782,22 +818,22 @@ namespace MatrixCreator assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_mass_matrix( - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()), dof, @@ -811,16 +847,16 @@ namespace MatrixCreator - template + template void create_mass_matrix( const hp::MappingCollection &mapping, const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -828,7 +864,7 @@ namespace MatrixCreator ExcDimensionMismatch(matrix.n(), dof.n_dofs())); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(dof.get_fe_collection(), update_values | update_JxW_values | (coefficient != nullptr ? update_quadrature_points : @@ -838,7 +874,7 @@ namespace MatrixCreator q, mapping); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -856,32 +892,32 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global( data, &matrix, - static_cast *>( - nullptr)); + static_cast *>(nullptr)); }, assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_mass_matrix( const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_mass_matrix(hp::StaticMappingQ1::mapping_collection, dof, @@ -893,18 +929,18 @@ namespace MatrixCreator - template + template void create_mass_matrix( - const hp::MappingCollection &mapping, - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const hp::MappingCollection &mapping, + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -912,7 +948,7 @@ namespace MatrixCreator ExcDimensionMismatch(matrix.n(), dof.n_dofs())); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(dof.get_fe_collection(), update_values | update_JxW_values | update_quadrature_points, @@ -921,7 +957,7 @@ namespace MatrixCreator q, mapping); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -939,9 +975,10 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix, &rhs_vector](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix, &rhs_vector]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global(data, &matrix, &rhs_vector); @@ -949,22 +986,22 @@ namespace MatrixCreator assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_mass_matrix( - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_mass_matrix(hp::StaticMappingQ1::mapping_collection, dof, @@ -1920,16 +1957,16 @@ namespace MatrixCreator - template + template void create_laplace_matrix( const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -1940,7 +1977,7 @@ namespace MatrixCreator hp::QCollection q_collection(q); hp::MappingCollection mapping_collection(mapping); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(fe_collection, update_gradients | update_JxW_values | (coefficient != nullptr ? update_quadrature_points : @@ -1950,7 +1987,7 @@ namespace MatrixCreator q_collection, mapping_collection); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -1968,32 +2005,32 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global( data, &matrix, - static_cast *>( - nullptr)); + static_cast *>(nullptr)); }, assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_laplace_matrix( const DoFHandler &dof, const Quadrature &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()), dof, @@ -2005,18 +2042,18 @@ namespace MatrixCreator - template + template void create_laplace_matrix( - const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -2027,7 +2064,7 @@ namespace MatrixCreator hp::QCollection q_collection(q); hp::MappingCollection mapping_collection(mapping); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(fe_collection, update_gradients | update_values | update_JxW_values | update_quadrature_points, @@ -2036,7 +2073,7 @@ namespace MatrixCreator q_collection, mapping_collection); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -2054,9 +2091,10 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix, &rhs_vector](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix, &rhs_vector]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global(data, &matrix, &rhs_vector); @@ -2064,22 +2102,22 @@ namespace MatrixCreator assembler_data, copy_data); - matrix.compress(VectorOperation::add); + internal::compress(matrix, VectorOperation::add); } - template + template void create_laplace_matrix( - const DoFHandler &dof, - const Quadrature &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const DoFHandler &dof, + const Quadrature &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()), dof, @@ -2093,16 +2131,16 @@ namespace MatrixCreator - template + template void create_laplace_matrix( const hp::MappingCollection &mapping, const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -2110,7 +2148,7 @@ namespace MatrixCreator ExcDimensionMismatch(matrix.n(), dof.n_dofs())); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(dof.get_fe_collection(), update_gradients | update_JxW_values | (coefficient != nullptr ? update_quadrature_points : @@ -2120,7 +2158,7 @@ namespace MatrixCreator q, mapping); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -2138,14 +2176,14 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global( data, &matrix, - static_cast *>( - nullptr)); + static_cast *>(nullptr)); }, assembler_data, copy_data); @@ -2155,15 +2193,15 @@ namespace MatrixCreator - template + template void create_laplace_matrix( const DoFHandler &dof, const hp::QCollection &q, - SparseMatrixType &matrix, - const Function - *const coefficient, - const AffineConstraints &constraints) + MatrixType &matrix, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_laplace_matrix( hp::StaticMappingQ1::mapping_collection, @@ -2176,18 +2214,18 @@ namespace MatrixCreator - template + template void create_laplace_matrix( - const hp::MappingCollection &mapping, - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const hp::MappingCollection &mapping, + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { Assert(matrix.m() == dof.n_dofs(), ExcDimensionMismatch(matrix.m(), dof.n_dofs())); @@ -2195,7 +2233,7 @@ namespace MatrixCreator ExcDimensionMismatch(matrix.n(), dof.n_dofs())); MatrixCreator::internal::AssemblerData:: - Scratch + Scratch assembler_data(dof.get_fe_collection(), update_gradients | update_values | update_JxW_values | update_quadrature_points, @@ -2204,7 +2242,7 @@ namespace MatrixCreator q, mapping); MatrixCreator::internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> + typename MatrixType::value_type> copy_data; copy_data.cell_matrix.reinit( assembler_data.fe_collection.max_dofs_per_cell(), @@ -2222,9 +2260,10 @@ namespace MatrixCreator dim, spacedim, typename DoFHandler::active_cell_iterator, - typename SparseMatrixType::value_type>, - [&matrix, &rhs_vector](const internal::AssemblerData::CopyData< - typename SparseMatrixType::value_type> &data) { + typename MatrixType::value_type>, + [&matrix, &rhs_vector]( + const internal::AssemblerData::CopyData + &data) { MatrixCreator::internal::copy_local_to_global(data, &matrix, &rhs_vector); @@ -2237,17 +2276,17 @@ namespace MatrixCreator - template + template void create_laplace_matrix( - const DoFHandler &dof, - const hp::QCollection &q, - SparseMatrixType &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function - *const coefficient, - const AffineConstraints &constraints) + const DoFHandler &dof, + const hp::QCollection &q, + MatrixType &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function + *const coefficient, + const AffineConstraints &constraints) { create_laplace_matrix( hp::StaticMappingQ1::mapping_collection, diff --git a/source/numerics/solution_transfer.cc b/source/numerics/solution_transfer.cc index 81c87c503e..9ddf9c72c4 100644 --- a/source/numerics/solution_transfer.cc +++ b/source/numerics/solution_transfer.cc @@ -585,7 +585,16 @@ SolutionTransfer::interpolate( // We have written into the output vectors. If this was a PETSc vector, for // example, then we need to compress these to make future operations safe: for (auto &vec : all_out) - vec.compress(VectorOperation::insert); + { + if constexpr (std::is_same>::value) + for (unsigned int i = 0; i < vec.size(); ++i) + std::cout << vec[i] << " "; + std::cout << std::endl; + + vec.compress(VectorOperation::insert); + } } -- 2.39.5