From f2f8f3e0c8e9037041b3159aa4f2acae35639e95 Mon Sep 17 00:00:00 2001 From: Lei Qiao Date: Mon, 20 Apr 2015 11:37:37 -0500 Subject: [PATCH] remove redundant template parameter 'Number' --- examples/step-33/step-33.cc | 38 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/examples/step-33/step-33.cc b/examples/step-33/step-33.cc index cf38767ffe..bbe74f4719 100644 --- a/examples/step-33/step-33.cc +++ b/examples/step-33/step-33.cc @@ -186,12 +186,12 @@ namespace Step33 // to the ith element, and then dereference it. This works // for both kinds of vectors -- not the prettiest solution, but one that // works. - template + template static - Number + typename InputVector::value_type compute_kinetic_energy (const InputVector &W) { - Number kinetic_energy = 0; + typename InputVector::value_type kinetic_energy = 0; for (unsigned int d=0; d + template static - Number + typename InputVector::value_type compute_pressure (const InputVector &W) { return ((gas_gamma-1.0) * (*(W.begin() + energy_component) - - compute_kinetic_energy(W))); + compute_kinetic_energy(W))); } @@ -228,15 +228,17 @@ namespace Step33 // use the automatic differentiation type here. Similarly, we will call // the function with different input vector data types, so we templatize // on it as well: - template + template static void compute_flux_matrix (const InputVector &W, - std_cxx11::array , EulerEquations::n_components > &flux) + std_cxx11::array , + EulerEquations::n_components > &flux) { // First compute the pressure that appears in the flux matrix, and then // compute the first dim columns of the matrix that // correspond to the momentum terms: - const Number pressure = compute_pressure (W); + const typename InputVector::value_type pressure = compute_pressure(W); for (unsigned int d=0; d + template static void numerical_normal_flux (const Point &normal, const InputVector &Wplus, const InputVector &Wminus, const double alpha, - std_cxx11::array < Number, n_components> &normal_flux) + std_cxx11::array + + &normal_flux) { - std_cxx11::array , EulerEquations::n_components > iflux, oflux; + std_cxx11::array + , + EulerEquations::n_components > iflux, oflux; compute_flux_matrix (Wplus, iflux); compute_flux_matrix (Wminus, oflux); @@ -300,10 +306,12 @@ namespace Step33 // \right)^T$, shown here for the 3d case. More specifically, we will // consider only $\mathbf g=(0,0,-1)^T$ in 3d, or $\mathbf g=(0,-1)^T$ in // 2d. This naturally leads to the following function: - template + template static void compute_forcing_vector (const InputVector &W, - std_cxx11::array < Number, n_components> &forcing) + std_cxx11::array + + &forcing) { const double gravity = -1.0; @@ -642,7 +650,7 @@ namespace Step33 computed_quantities[q](d) = uh[q](first_momentum_component+d) / density; - computed_quantities[q](dim) = compute_pressure (uh[q]); + computed_quantities[q](dim) = compute_pressure (uh[q]); if (do_schlieren_plot == true) computed_quantities[q](dim+1) = duh[q][density_component] * -- 2.39.5