]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Initialize some FEValuesExtractors where it is easiest to read (step-44). 18000/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 15 Jan 2025 18:30:47 +0000 (11:30 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 15 Jan 2025 18:30:47 +0000 (11:30 -0700)
examples/step-44/step-44.cc

index 9ca6c994b59ca6c336ce1c52e75eb37d2ed91d6b..98c0de99ad1cef73eeca2d7b047c730bb408be74 100644 (file)
@@ -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<dim>              fe;
-    DoFHandler<dim>                  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<dim> fe;
+    DoFHandler<dim>     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<dim>(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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.