From ba28025b460bf1495beb17d62ec9a15e88cfe98c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 7 Mar 2023 14:40:11 -0700 Subject: [PATCH] Rename a variable in step-69 to make its purpose clearer. --- examples/step-69/step-69.cc | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index c013a95546..89784167e3 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -289,12 +289,12 @@ namespace Step69 class ProblemDescription { public: - static constexpr unsigned int problem_dimension = 2 + dim; + static constexpr unsigned int n_solution_variables = 2 + dim; - using state_type = Tensor<1, problem_dimension>; - using flux_type = Tensor<1, problem_dimension, Tensor<1, dim>>; + using state_type = Tensor<1, n_solution_variables>; + using flux_type = Tensor<1, n_solution_variables, Tensor<1, dim>>; - const static std::array component_names; + const static std::array component_names; static constexpr double gamma = 7. / 5.; @@ -381,14 +381,14 @@ namespace Step69 class TimeStepping : public ParameterAcceptor { public: - static constexpr unsigned int problem_dimension = - ProblemDescription::problem_dimension; + static constexpr unsigned int n_solution_variables = + ProblemDescription::n_solution_variables; using state_type = typename ProblemDescription::state_type; using flux_type = typename ProblemDescription::flux_type; - using vector_type = - std::array, problem_dimension>; + using vector_type = std::array, + n_solution_variables>; TimeStepping(const MPI_Comm mpi_communicator, TimerOutput & computing_timer, @@ -433,13 +433,13 @@ namespace Step69 class SchlierenPostprocessor : public ParameterAcceptor { public: - static constexpr unsigned int problem_dimension = - ProblemDescription::problem_dimension; + static constexpr unsigned int n_solution_variables = + ProblemDescription::n_solution_variables; using state_type = typename ProblemDescription::state_type; - using vector_type = - std::array, problem_dimension>; + using vector_type = std::array, + n_solution_variables>; SchlierenPostprocessor( const MPI_Comm mpi_communicator, @@ -944,7 +944,7 @@ namespace Step69 // gather() (second interface): this second function // signature having two input arguments will be used to gather the // state at a node i and return it as a - // Tensor<1,problem_dimension> for our convenience. + // Tensor<1,n_solution_variables> for our convenience. template DEAL_II_ALWAYS_INLINE inline Tensor<1, k> @@ -960,10 +960,10 @@ namespace Step69 // scatter(): this function has three input arguments, the // first one is meant to be a "global object" (say a locally owned or // locally relevant vector), the second argument which could be a - // Tensor<1,problem_dimension>, and the last argument + // Tensor<1,n_solution_variables>, and the last argument // which represents a index of the global object. This function will be // primarily used to write the updated nodal values, stored as - // Tensor<1,problem_dimension>, into the global objects. + // Tensor<1,n_solution_variables>, into the global objects. template DEAL_II_ALWAYS_INLINE inline void @@ -2021,7 +2021,7 @@ namespace Step69 const auto c_ij = gather_get_entry(cij_matrix, jt); const auto d_ij = get_entry(dij_matrix, jt); - for (unsigned int k = 0; k < problem_dimension; ++k) + for (unsigned int k = 0; k < n_solution_variables; ++k) { U_i_new[k] += tau_max / m_i * @@ -2630,8 +2630,8 @@ namespace Step69 for (auto &it : U) it.reinit(offline_data.partitioner); - constexpr auto problem_dimension = - ProblemDescription::problem_dimension; + constexpr auto n_solution_variables = + ProblemDescription::n_solution_variables; // The function signature of // InitialValues::initial_state is not quite right @@ -2640,7 +2640,7 @@ namespace Step69 // returns just the value of the ith component. This // lambda in turn is converted to a Function object with the help of // the ScalarFunctionFromFunctionObject wrapper. - for (unsigned int i = 0; i < problem_dimension; ++i) + for (unsigned int i = 0; i < n_solution_variables; ++i) VectorTools::interpolate(offline_data.dof_handler, ScalarFunctionFromFunctionObject( [&](const Point &x) { @@ -2729,8 +2729,8 @@ namespace Step69 background_thread_state.wait(); } - constexpr auto problem_dimension = - ProblemDescription::problem_dimension; + constexpr auto n_solution_variables = + ProblemDescription::n_solution_variables; // At this point we make a copy of the state vector, run the schlieren // postprocessor, and run DataOut::build_patches() The actual @@ -2742,7 +2742,7 @@ namespace Step69 // worker thread to ensure that once we exit this function and the // worker thread finishes the DataOut object gets destroyed again. - for (unsigned int i = 0; i < problem_dimension; ++i) + for (unsigned int i = 0; i < n_solution_variables; ++i) { output_vector[i] = U[i]; output_vector[i].update_ghost_values(); @@ -2756,7 +2756,7 @@ namespace Step69 const auto &component_names = ProblemDescription::component_names; - for (unsigned int i = 0; i < problem_dimension; ++i) + for (unsigned int i = 0; i < n_solution_variables; ++i) data_out->add_data_vector(output_vector[i], component_names[i]); data_out->add_data_vector(schlieren_postprocessor.schlieren, -- 2.39.5