From 7bd1893bd9084308c2fb9e51aef8cfa2641617e7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 10 Aug 2017 08:00:28 +0200 Subject: [PATCH] Allow the create_* functions to be called with nullptr coefficients --- .../numerics/matrix_creator.templates.h | 40 +++++++++---------- include/deal.II/numerics/matrix_tools.h | 40 +++++++++---------- .../create_laplace_matrix_constraints_01.cc | 3 +- .../create_laplace_matrix_constraints_02.cc | 3 +- .../create_laplace_matrix_constraints_02b.cc | 3 +- .../create_mass_matrix_constraints_01.cc | 3 +- .../create_mass_matrix_constraints_02.cc | 3 +- .../create_mass_matrix_constraints_02b.cc | 3 +- 8 files changed, 46 insertions(+), 52 deletions(-) diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index b3c56d19ae..4c1fd44d2c 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -671,7 +671,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -712,7 +712,7 @@ namespace MatrixCreator void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { create_mass_matrix(StaticMappingQ1::mapping, dof, @@ -728,7 +728,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -770,7 +770,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { create_mass_matrix(StaticMappingQ1::mapping, @@ -785,7 +785,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -822,7 +822,7 @@ namespace MatrixCreator void create_mass_matrix (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { create_mass_matrix(hp::StaticMappingQ1::mapping_collection, @@ -838,7 +838,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -877,7 +877,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, const ConstraintMatrix &constraints) { create_mass_matrix(hp::StaticMappingQ1::mapping_collection, dof, q, @@ -1198,7 +1198,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, std::vector component_mapping) { // what would that be in 1d? the @@ -1597,7 +1597,7 @@ namespace MatrixCreator const std::map*> &rhs, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const a, + const Function::value, typename identity::type> *const a, std::vector component_mapping) { create_boundary_mass_matrix(StaticMappingQ1::mapping, dof, q, @@ -1615,7 +1615,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const coefficient, + const Function::value, typename identity::type> *const coefficient, std::vector component_mapping) { // what would that be in 1d? the @@ -1684,7 +1684,7 @@ namespace MatrixCreator const std::map*> &rhs, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const a, + const Function::value, typename identity::type> *const a, std::vector component_mapping) { create_boundary_mass_matrix(hp::StaticMappingQ1::mapping_collection, dof, q, @@ -1698,7 +1698,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -1740,7 +1740,7 @@ namespace MatrixCreator void create_laplace_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { create_laplace_matrix(StaticMappingQ1::mapping, @@ -1756,7 +1756,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -1800,7 +1800,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { create_laplace_matrix(StaticMappingQ1::mapping, dof, q, @@ -1814,7 +1814,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -1853,7 +1853,7 @@ namespace MatrixCreator void create_laplace_matrix (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { create_laplace_matrix(hp::StaticMappingQ1::mapping_collection, dof, q, @@ -1869,7 +1869,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { Assert (matrix.m() == dof.n_dofs(), @@ -1910,7 +1910,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const coefficient, + const Function::value> *const coefficient, const ConstraintMatrix &constraints) { create_laplace_matrix(hp::StaticMappingQ1::mapping_collection, dof, q, diff --git a/include/deal.II/numerics/matrix_tools.h b/include/deal.II/numerics/matrix_tools.h index a2377cbd4a..070502d158 100644 --- a/include/deal.II/numerics/matrix_tools.h +++ b/include/deal.II/numerics/matrix_tools.h @@ -237,7 +237,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -248,7 +248,7 @@ namespace MatrixCreator void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -274,7 +274,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -287,7 +287,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -298,7 +298,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -308,7 +308,7 @@ namespace MatrixCreator void create_mass_matrix (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -321,7 +321,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -333,7 +333,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); @@ -367,7 +367,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const weight = 0, + const Function::value, typename identity::type> *const weight = nullptr, std::vector component_mapping = std::vector()); @@ -382,7 +382,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, std::vector component_mapping = std::vector()); /** @@ -396,7 +396,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, std::vector component_mapping = std::vector()); /** @@ -409,7 +409,7 @@ namespace MatrixCreator const std::map*> &boundary_functions, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, - const Function *const a = 0, + const Function::value, typename identity::type> *const a = nullptr, std::vector component_mapping = std::vector()); /** @@ -433,7 +433,7 @@ namespace MatrixCreator const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -444,7 +444,7 @@ namespace MatrixCreator void create_laplace_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -469,7 +469,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -482,7 +482,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -494,7 +494,7 @@ namespace MatrixCreator const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -505,7 +505,7 @@ namespace MatrixCreator void create_laplace_matrix (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -519,7 +519,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** @@ -532,7 +532,7 @@ namespace MatrixCreator SparseMatrix &matrix, const Function &rhs, Vector &rhs_vector, - const Function *const a = nullptr, + const Function::value> *const a = nullptr, const ConstraintMatrix &constraints = ConstraintMatrix()); /** diff --git a/tests/numerics/create_laplace_matrix_constraints_01.cc b/tests/numerics/create_laplace_matrix_constraints_01.cc index 7174673bc8..419cbad0c6 100644 --- a/tests/numerics/create_laplace_matrix_constraints_01.cc +++ b/tests/numerics/create_laplace_matrix_constraints_01.cc @@ -104,9 +104,8 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, - rhs_function, rhs, dummy, constraints); + rhs_function, rhs, nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values diff --git a/tests/numerics/create_laplace_matrix_constraints_02.cc b/tests/numerics/create_laplace_matrix_constraints_02.cc index 2faf7d23b7..e7710f6d30 100644 --- a/tests/numerics/create_laplace_matrix_constraints_02.cc +++ b/tests/numerics/create_laplace_matrix_constraints_02.cc @@ -108,9 +108,8 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, - rhs_function, rhs, dummy, constraints); + rhs_function, rhs, nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values diff --git a/tests/numerics/create_laplace_matrix_constraints_02b.cc b/tests/numerics/create_laplace_matrix_constraints_02b.cc index a2b2de1c93..cac865044b 100644 --- a/tests/numerics/create_laplace_matrix_constraints_02b.cc +++ b/tests/numerics/create_laplace_matrix_constraints_02b.cc @@ -104,9 +104,8 @@ check () quadrature, matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = nullptr; MatrixTools::create_laplace_matrix (mapping, dof, quadrature, matrix, - dummy, constraints); + nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values diff --git a/tests/numerics/create_mass_matrix_constraints_01.cc b/tests/numerics/create_mass_matrix_constraints_01.cc index eb904bf6a6..3fb936e83f 100644 --- a/tests/numerics/create_mass_matrix_constraints_01.cc +++ b/tests/numerics/create_mass_matrix_constraints_01.cc @@ -104,9 +104,8 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, - rhs_function, rhs, dummy, constraints); + rhs_function, rhs, nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values diff --git a/tests/numerics/create_mass_matrix_constraints_02.cc b/tests/numerics/create_mass_matrix_constraints_02.cc index 4063c20664..92140878a3 100644 --- a/tests/numerics/create_mass_matrix_constraints_02.cc +++ b/tests/numerics/create_mass_matrix_constraints_02.cc @@ -108,9 +108,8 @@ check () rhs_function, rhs_ref); constraints.condense(matrix_ref, rhs_ref); - const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, - rhs_function, rhs, dummy, constraints); + rhs_function, rhs, nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values diff --git a/tests/numerics/create_mass_matrix_constraints_02b.cc b/tests/numerics/create_mass_matrix_constraints_02b.cc index b9985b73c6..385309be71 100644 --- a/tests/numerics/create_mass_matrix_constraints_02b.cc +++ b/tests/numerics/create_mass_matrix_constraints_02b.cc @@ -104,9 +104,8 @@ check () quadrature, matrix_ref); constraints.condense(matrix_ref); - const Function *const dummy = nullptr; MatrixTools::create_mass_matrix (mapping, dof, quadrature, matrix, - dummy, constraints); + nullptr, constraints); // compute reference: need to cancel constrained entries as these will in // general get different values -- 2.39.5