From 3b92f1a5d09a2a54889c30a7eed81f9b2b3dfa21 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 17 Nov 2016 23:40:09 +0100 Subject: [PATCH] Rename internal helper functions --- .../deal.II/numerics/vector_tools.templates.h | 131 +++++++++--------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 03266f2ac2..f10b5e810b 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -896,19 +896,19 @@ namespace VectorTools /* - * Generic implementation for project using a MatrixFree implementation - * with arbitrary number of components and degree of the FiniteElement. + * MatrixFree implementation of project() for an arbitrary number of + * components and arbitrary degree of the FiniteElement. */ template - void project_generic (const Mapping &mapping, - const DoFHandler &dof, - const ConstraintMatrix &constraints, - const Quadrature &quadrature, - const Function &function, - VectorType &vec_result, - const bool enforce_zero_boundary, - const Quadrature &q_boundary, - const bool project_to_boundary_first) + void project_matrix_free (const Mapping &mapping, + const DoFHandler &dof, + const ConstraintMatrix &constraints, + const Quadrature &quadrature, + const Function &function, + VectorType &vec_result, + const bool enforce_zero_boundary, + const Quadrature &q_boundary, + const bool project_to_boundary_first) { Assert (project_to_boundary_first == false, ExcNotImplemented()); Assert (enforce_zero_boundary == false, ExcNotImplemented()); @@ -981,72 +981,73 @@ namespace VectorTools /** * Helper interface. After figuring out the number of components - * in project_parallel, we determine the degree of the FiniteElement - * and call project_generic with the appropriate template arguments. + * in project_matrix_free_component, we determine the degree of the + * FiniteElement and call project_matrix_free with the appropriate + * template arguments. */ template - void project_parallel_helper (const Mapping &mapping, - const DoFHandler &dof, - const ConstraintMatrix &constraints, - const Quadrature &quadrature, - const Function &function, - VectorType &vec_result, - const bool enforce_zero_boundary, - const Quadrature &q_boundary, - const bool project_to_boundary_first) + void project_matrix_free_degree (const Mapping &mapping, + const DoFHandler &dof, + const ConstraintMatrix &constraints, + const Quadrature &quadrature, + const Function &function, + VectorType &vec_result, + const bool enforce_zero_boundary, + const Quadrature &q_boundary, + const bool project_to_boundary_first) { switch (dof.get_fe().degree) { case 1: - dealii::VectorTools::project_generic + VectorTools::project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 2: - dealii::VectorTools::project_generic + VectorTools::project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 3: - dealii::VectorTools::project_generic + VectorTools::project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 4: - dealii::VectorTools::project_generic + project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 5: - dealii::VectorTools::project_generic + project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 6: - dealii::VectorTools::project_generic + project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 7: - dealii::VectorTools::project_generic + project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 8: - dealii::VectorTools::project_generic + project_matrix_free (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; default: - Assert(false, ExcNotImplemented()); + Assert(false, ExcInternalError()); } } @@ -1055,59 +1056,64 @@ namespace VectorTools // Helper interface for the matrix-free implementation of project(). // Used to determine the number of components. template - void project_parallel (const Mapping &mapping, - const DoFHandler &dof, - const ConstraintMatrix &constraints, - const Quadrature &quadrature, - const Function &function, - VectorType &vec_result, - const bool enforce_zero_boundary, - const Quadrature &q_boundary, - const bool project_to_boundary_first) + void project_matrix_free_component (const Mapping &mapping, + const DoFHandler &dof, + const ConstraintMatrix &constraints, + const Quadrature &quadrature, + const Function &function, + VectorType &vec_result, + const bool enforce_zero_boundary, + const Quadrature &q_boundary, + const bool project_to_boundary_first) { switch (dof.get_fe().n_components()) { case 1: - project_parallel_helper<1> + project_matrix_free_degree<1> (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 2: - project_parallel_helper<2> + project_matrix_free_degree<2> (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 3: - project_parallel_helper<3> + project_matrix_free_degree<3> (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; case 4: - project_parallel_helper<4> + project_matrix_free_degree<4> (mapping, dof, constraints, quadrature, function, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); break; default: - Assert(false, ExcNotImplemented()); + Assert(false, ExcInternalError()); } } - template - void project_matrix_free (const Mapping &mapping, - const DoFHandler &dof, - const ConstraintMatrix &constraints, - const Quadrature &quadrature, - const Function &function, - VectorType &vec_result, - const bool enforce_zero_boundary, - const Quadrature &q_boundary, - const bool project_to_boundary_first) + /** + * Specialization of project() for the case dim==spacedim. + * Check if we can use the MatrixFree implementation or need + * to use the matrix based one. + */ + template + void project (const Mapping &mapping, + const DoFHandler &dof, + const ConstraintMatrix &constraints, + const Quadrature &quadrature, + const Function &function, + VectorType &vec_result, + const bool enforce_zero_boundary, + const Quadrature &q_boundary, + const bool project_to_boundary_first) { // If we can, use the matrix-free implementation bool use_matrix_free = true; @@ -1118,9 +1124,10 @@ namespace VectorTools else { // Find out if the FiniteElement is supported - // This is copied from matrix_free/shape_info.templates.h + // This is based on matrix_free/shape_info.templates.h // and matrix_free/matrix_free.templates.h - if (dof.get_fe().degree==0 || dof.get_fe().n_base_elements()!=1) + if (dof.get_fe().degree==0 || dof.get_fe().n_base_elements()!=1 + || dof.get_fe().degree>8 || dof.get_fe().n_components()>4) use_matrix_free = false; else { @@ -1139,10 +1146,10 @@ namespace VectorTools } if (use_matrix_free) - project_parallel (mapping, dof, constraints, quadrature, - function, vec_result, - enforce_zero_boundary, q_boundary, - project_to_boundary_first); + project_matrix_free_component (mapping, dof, constraints, quadrature, + function, vec_result, + enforce_zero_boundary, q_boundary, + project_to_boundary_first); else { Assert((dynamic_cast* > (&(dof.get_triangulation()))==0), @@ -1453,7 +1460,7 @@ namespace VectorTools = dynamic_cast*> (&function); Assert (mapping_ptr!=0, ExcInternalError()); Assert (dof_ptr!=0, ExcInternalError()); - project_matrix_free + project (*mapping_ptr, *dof_ptr, constraints, quadrature, *function_ptr, vec_result, enforce_zero_boundary, q_boundary, project_to_boundary_first); } -- 2.39.5