From: Wolfgang Bangerth Date: Wed, 15 Jan 2025 18:30:47 +0000 (-0700) Subject: Initialize some FEValuesExtractors where it is easiest to read (step-44). X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18000%2Fhead;p=dealii.git Initialize some FEValuesExtractors where it is easiest to read (step-44). --- diff --git a/examples/step-44/step-44.cc b/examples/step-44/step-44.cc index 9ca6c994b5..98c0de99ad 100644 --- a/examples/step-44/step-44.cc +++ b/examples/step-44/step-44.cc @@ -922,22 +922,26 @@ namespace Step44 // polynomial degree, the degree-of-freedom handler, number of DoFs per // cell and the extractor objects used to retrieve information from the // solution vectors: - const unsigned int degree; - const FESystem fe; - DoFHandler dof_handler; - const unsigned int dofs_per_cell; - const FEValuesExtractors::Vector u_fe; - const FEValuesExtractors::Scalar p_fe; - const FEValuesExtractors::Scalar J_fe; + const unsigned int degree; + const FESystem fe; + DoFHandler dof_handler; + const unsigned int dofs_per_cell; // Description of how the block-system is arranged. There are 3 blocks, // the first contains a vector DOF $\mathbf{u}$ while the other two // describe scalar DOFs, $\widetilde{p}$ and $\widetilde{J}$. - static const unsigned int n_blocks = 3; - static const unsigned int n_components = dim + 2; - static const unsigned int first_u_component = 0; - static const unsigned int p_component = dim; - static const unsigned int J_component = dim + 1; + static constexpr unsigned int n_blocks = 3; + static constexpr unsigned int n_components = dim + 2; + static constexpr unsigned int first_u_component = 0; + static constexpr unsigned int p_component = dim; + static constexpr unsigned int J_component = dim + 1; + + static constexpr FEValuesExtractors::Vector u_fe = + FEValuesExtractors::Vector(first_u_component); + static constexpr FEValuesExtractors::Scalar p_fe = + FEValuesExtractors::Scalar(p_component); + static constexpr FEValuesExtractors::Scalar J_fe = + FEValuesExtractors::Scalar(J_component); enum { @@ -1048,9 +1052,6 @@ namespace Step44 FE_DGP(parameters.poly_degree - 1)) // dilatation , dof_handler(triangulation) , dofs_per_cell(fe.n_dofs_per_cell()) - , u_fe(first_u_component) - , p_fe(p_component) - , J_fe(J_component) , dofs_per_block(n_blocks) , qf_cell(parameters.quad_order) , qf_face(parameters.quad_order)