From 76cf508f884101726ad280a080adad15b08b29e1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 19 Apr 2015 16:06:11 -0500 Subject: [PATCH] Swap order of constructor arguments to make their connection to each other clearer. This closes #755. --- include/deal.II/fe/mapping_q_eulerian.h | 43 ++++++++++++++++--------- source/fe/mapping_q_eulerian.cc | 19 ++++++++++- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/include/deal.II/fe/mapping_q_eulerian.h b/include/deal.II/fe/mapping_q_eulerian.h index c21599f0f7..3881b292ad 100644 --- a/include/deal.II/fe/mapping_q_eulerian.h +++ b/include/deal.II/fe/mapping_q_eulerian.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2001 - 2014 by the deal.II authors +// Copyright (C) 2001 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -61,8 +61,9 @@ DEAL_II_NAMESPACE_OPEN * FESystem fe(FE_Q(2), dim, FE_Q(1), 1); * DoFHandler dof_handler(triangulation); * dof_handler.distribute_dofs(fe); - * Vector soln_vector(dof_handler.n_dofs()); - * MappingQEulerian q2_mapping(2,soln_vector,dof_handler); + * Vector displacement_field(dof_handler.n_dofs()); + * // ... compute displacement field somehow... + * MappingQEulerian q2_mapping(2, dof_handler, displacement_field); * @endcode * * In this example, our element consists of (dim+1) components. Only @@ -91,20 +92,32 @@ class MappingQEulerian : public MappingQ { public: /** - * Constructor. The first argument is the polynomical degree of the desired - * Qp mapping. It then takes a Vector & to specify the - * transformation of the domain from the reference to the current - * configuration. The organization of the elements in the @p Vector must - * follow the concept how deal.II stores solutions that are associated to a - * triangulation. This is automatically the case if the @p Vector - * represents the solution of the previous step of a nonlinear problem. - * Alternatively, the @p Vector can be initialized by - * DoFAccessor::set_dof_values(). + * Constructor. + * + * @param[in] degree The polynomical degree of the desired + * $Q_p$ mapping. + * @param[in] euler_dof_handler A DoFHandler object that defines a + * finite element space. This space needs to have at least dim + * components and the first dim components of the space will + * be considered displacements relative to the original positions + * of the cells of the triangulation. + * @param[in] euler_vector A finite element function in the + * space defined by the second argument. The first dim components + * of this function will be interpreted as the displacement we + * use in definining the mapping, relative to the location of cells + * of the underlying triangulation. */ + MappingQEulerian (const unsigned int degree, + const DoFHandler &euler_dof_handler, + const VECTOR &euler_vector); - MappingQEulerian (const unsigned int degree, - const VECTOR &euler_vector, - const DoFHandler &euler_dof_handler); + /** + * @deprecated Use the constructor with the reverse order of + * second and third argument. + */ + MappingQEulerian (const unsigned int degree, + const VECTOR &euler_vector, + const DoFHandler &euler_dof_handler) DEAL_II_DEPRECATED; /** * Return a pointer to a copy of the present object. The caller of this copy diff --git a/source/fe/mapping_q_eulerian.cc b/source/fe/mapping_q_eulerian.cc index 9e0afc39e3..6082fa9157 100644 --- a/source/fe/mapping_q_eulerian.cc +++ b/source/fe/mapping_q_eulerian.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2001 - 2014 by the deal.II authors +// Copyright (C) 2001 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -50,6 +50,23 @@ MappingQEulerian (const unsigned int degree, +template +MappingQEulerian:: +MappingQEulerian (const unsigned int degree, + const DoFHandler &euler_dof_handler, + const EulerVectorType &euler_vector) + : + MappingQ(degree, true), + euler_vector(&euler_vector), + euler_dof_handler(&euler_dof_handler), + support_quadrature(degree), + fe_values(euler_dof_handler.get_fe(), + support_quadrature, + update_values | update_q_points) +{ } + + + template Mapping * MappingQEulerian::clone () const -- 2.39.5