From: David Wells Date: Mon, 30 Jun 2025 14:26:25 +0000 (-0400) Subject: step-20: clean up whitespace in code samples. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=059aa60fde8e7ec38c110de34a78f212a5ec1d56;p=dealii.git step-20: clean up whitespace in code samples. This makes the style closer to what clang-format does. --- diff --git a/examples/step-20/doc/intro.dox b/examples/step-20/doc/intro.dox index fea025dac1..5e4582d8f6 100644 --- a/examples/step-20/doc/intro.dox +++ b/examples/step-20/doc/intro.dox @@ -274,26 +274,26 @@ components. For example, in 2d, the first term could be rewritten like this If we implemented this, we would get code like this: @code - for (unsigned int q=0; q phi_i_u = fe_values[velocities].value (i, q); - const double div_phi_i_u = fe_values[velocities].divergence (i, q); - const double phi_i_p = fe_values[pressure].value (i, q); + const Tensor<1,dim> phi_i_u = fe_values[velocities].value(i, q); + const double div_phi_i_u = fe_values[velocities].divergence(i, q); + const double phi_i_p = fe_values[pressure].value(i, q); - for (unsigned int j=0; j phi_j_u = fe_values[velocities].value (j, q); - const double div_phi_j_u = fe_values[velocities].divergence (j, q); - const double phi_j_p = fe_values[pressure].value (j, q); - - local_matrix(i,j) += (phi_i_u * k_inverse_values[q] * phi_j_u - - div_phi_i_u * phi_j_p - - phi_i_p * div_phi_j_u) * - fe_values.JxW(q); + const Tensor<1,dim> phi_j_u = fe_values[velocities].value(j, q); + const double div_phi_j_u = fe_values[velocities].divergence(j, q); + const double phi_j_p = fe_values[pressure].value(j, q); + + local_matrix(i, j) += (phi_i_u * k_inverse_values[q] * phi_j_u + - div_phi_i_u * phi_j_p + - phi_i_p * div_phi_j_u) * + fe_values.JxW(q); } local_rhs(i) += -phi_i_p * @@ -616,12 +616,12 @@ class SchurComplement // ... - void SchurComplement::vmult (Vector &dst, - const Vector &src) const + void SchurComplement::vmult(Vector &dst, + const Vector &src) const { - B.vmult (tmp1, src); + B.vmult(tmp1, src); solver_M(M, tmp2, tmp1, preconditioner_M); - B.Tvmult (dst, tmp2); + B.Tvmult(dst, tmp2); } }; @endcode @@ -644,10 +644,10 @@ complement matrix and the mass matrix, respectively. For example the right hand side of the first equation reads $B^TM^{-1}F-G$. This could be implemented as follows: @code - Vector schur_rhs (P.size()); - Vector tmp (U.size()); - op_M_inv.vmult (tmp, F); - transpose_operator(op_B).vmult (schur_rhs, tmp); + Vector schur_rhs(P.size()); + Vector tmp(U.size()); + op_M_inv.vmult(tmp, F); + transpose_operator(op_B).vmult(schur_rhs, tmp); schur_rhs -= G; @endcode Again, this is a perfectly valid approach, but the fact that deal.II diff --git a/examples/step-20/doc/results.dox b/examples/step-20/doc/results.dox index 470b9ff8b9..70c3cb151d 100644 --- a/examples/step-20/doc/results.dox +++ b/examples/step-20/doc/results.dox @@ -176,25 +176,25 @@ this: @code template void -KInverse::value_list (const std::vector > &points, - std::vector > &values) const +KInverse::value_list(const std::vector> &points, + std::vector> &values) const { - AssertDimension (points.size(), values.size()); + AssertDimension(points.size(), values.size()); - for (unsigned int p=0; p -class KInverse : public TensorFunction<2,dim> +class KInverse : public TensorFunction<2, dim> { public: - KInverse (); + KInverse(); - virtual void value_list (const std::vector > &points, - std::vector > &values) const; + virtual void + value_list(const std::vector> &points, + std::vector> &values) const; private: - std::vector > centers; + std::vector> centers; }; template -KInverse::KInverse () +KInverse::KInverse() { const unsigned int N = 40; - centers.resize (N); - for (unsigned int i=0; i void -KInverse::value_list (const std::vector > &points, - std::vector > &values) const +KInverse::value_list(const std::vector> &points, + std::vector> &values) const { - AssertDimension (points.size(), values.size()); + AssertDimension(points.size(), values.size()); - for (unsigned int p=0; p