From: Peter Munch Date: Mon, 24 Jan 2022 13:01:27 +0000 (+0100) Subject: SparseMatrix: rename om to omega X-Git-Tag: v9.4.0-rc1~573^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13283%2Fhead;p=dealii.git SparseMatrix: rename om to omega --- diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index 2cd998e33c..d2c5f619b0 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -1385,7 +1385,7 @@ public: void precondition_SOR(Vector & dst, const Vector &src, - const number om = 1.) const; + const number omega = 1.) const; /** * Apply transpose SOR preconditioning matrix to src. @@ -1394,7 +1394,7 @@ public: void precondition_TSOR(Vector & dst, const Vector &src, - const number om = 1.) const; + const number omega = 1.) const; /** * Perform SSOR preconditioning in-place. Apply the preconditioner matrix @@ -1411,7 +1411,7 @@ public: */ template void - SOR(Vector &v, const number om = 1.) const; + SOR(Vector &v, const number omega = 1.) const; /** * Perform a transpose SOR preconditioning in-place. omega is the @@ -1419,7 +1419,7 @@ public: */ template void - TSOR(Vector &v, const number om = 1.) const; + TSOR(Vector &v, const number omega = 1.) const; /** * Perform a permuted SOR preconditioning in-place. @@ -1436,7 +1436,7 @@ public: PSOR(Vector & v, const std::vector &permutation, const std::vector &inverse_permutation, - const number om = 1.) const; + const number omega = 1.) const; /** * Perform a transposed permuted SOR preconditioning in-place. @@ -1453,7 +1453,7 @@ public: TPSOR(Vector & v, const std::vector &permutation, const std::vector &inverse_permutation, - const number om = 1.) const; + const number omega = 1.) const; /** * Do one Jacobi step on v. Performs a direct Jacobi step with @@ -1464,7 +1464,7 @@ public: void Jacobi_step(Vector & v, const Vector &b, - const number om = 1.) const; + const number omega = 1.) const; /** * Do one SOR step on v. Performs a direct SOR step with right @@ -1474,7 +1474,7 @@ public: void SOR_step(Vector & v, const Vector &b, - const number om = 1.) const; + const number omega = 1.) const; /** * Do one adjoint SOR step on v. Performs a direct TSOR step with @@ -1484,7 +1484,7 @@ public: void TSOR_step(Vector & v, const Vector &b, - const number om = 1.) const; + const number omega = 1.) const; /** * Do one SSOR step on v. Performs a direct SSOR step with right @@ -1494,7 +1494,7 @@ public: void SSOR_step(Vector & v, const Vector &b, - const number om = 1.) const; + const number omega = 1.) const; //@} /** * @name Iterators diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 9e62e33f9c..74fba0265f 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1398,7 +1398,7 @@ template void SparseMatrix::precondition_Jacobi(Vector & dst, const Vector &src, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1424,9 +1424,9 @@ SparseMatrix::precondition_Jacobi(Vector & dst, // in each row, i.e. at index // rowstart[i]. and we do have a // square matrix by above assertion - if (om != number(1.)) + if (omega != number(1.)) for (size_type i = 0; i < n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) - *dst_ptr = somenumber(om) * *src_ptr / somenumber(val[*rowstart_ptr]); + *dst_ptr = somenumber(omega) * *src_ptr / somenumber(val[*rowstart_ptr]); else for (size_type i = 0; i < n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) *dst_ptr = *src_ptr / somenumber(val[*rowstart_ptr]); @@ -1440,7 +1440,7 @@ void SparseMatrix::precondition_SSOR( Vector & dst, const Vector & src, - const number om, + const number omega, const std::vector &pos_right_of_diagonal) const { // to understand how this function works @@ -1482,15 +1482,15 @@ SparseMatrix::precondition_SSOR( s += val[j] * number(dst(cols->colnums[j])); // divide by diagonal element - *dst_ptr -= s * om; + *dst_ptr -= s * omega; *dst_ptr /= val[*rowstart_ptr]; } rowstart_ptr = cols->rowstart.get(); dst_ptr = &dst(0); for (; rowstart_ptr != &cols->rowstart[n]; ++rowstart_ptr, ++dst_ptr) - *dst_ptr *= - somenumber(om * (number(2.) - om)) * somenumber(val[*rowstart_ptr]); + *dst_ptr *= somenumber(omega * (number(2.) - omega)) * + somenumber(val[*rowstart_ptr]); // backward sweep rowstart_ptr = &cols->rowstart[n - 1]; @@ -1504,7 +1504,7 @@ SparseMatrix::precondition_SSOR( for (size_type j = first_right_of_diagonal_index; j < end_row; ++j) s += val[j] * number(dst(cols->colnums[j])); - *dst_ptr -= s * om; + *dst_ptr -= s * omega; *dst_ptr /= val[*rowstart_ptr]; }; return; @@ -1536,7 +1536,7 @@ SparseMatrix::precondition_SSOR( s += val[j] * number(dst(cols->colnums[j])); // divide by diagonal element - *dst_ptr -= s * om; + *dst_ptr -= s * omega; Assert(val[*rowstart_ptr] != number(), ExcDivideByZero()); *dst_ptr /= val[*rowstart_ptr]; }; @@ -1544,7 +1544,8 @@ SparseMatrix::precondition_SSOR( rowstart_ptr = cols->rowstart.get(); dst_ptr = &dst(0); for (size_type row = 0; row < n; ++row, ++rowstart_ptr, ++dst_ptr) - *dst_ptr *= somenumber((number(2.) - om)) * somenumber(val[*rowstart_ptr]); + *dst_ptr *= + somenumber((number(2.) - omega)) * somenumber(val[*rowstart_ptr]); // backward sweep rowstart_ptr = &cols->rowstart[n - 1]; @@ -1560,7 +1561,7 @@ SparseMatrix::precondition_SSOR( number s = 0; for (size_type j = first_right_of_diagonal_index; j < end_row; ++j) s += val[j] * number(dst(cols->colnums[j])); - *dst_ptr -= s * om; + *dst_ptr -= s * omega; Assert(val[*rowstart_ptr] != number(), ExcDivideByZero()); *dst_ptr /= val[*rowstart_ptr]; }; @@ -1572,13 +1573,13 @@ template void SparseMatrix::precondition_SOR(Vector & dst, const Vector &src, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); dst = src; - SOR(dst, om); + SOR(dst, omega); } @@ -1587,20 +1588,20 @@ template void SparseMatrix::precondition_TSOR(Vector & dst, const Vector &src, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); dst = src; - TSOR(dst, om); + TSOR(dst, omega); } template template void -SparseMatrix::SOR(Vector &dst, const number om) const +SparseMatrix::SOR(Vector &dst, const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1619,7 +1620,7 @@ SparseMatrix::SOR(Vector &dst, const number om) const s -= somenumber(val[j]) * dst(col); } - dst(row) = s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + dst(row) = s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); } } @@ -1627,7 +1628,7 @@ SparseMatrix::SOR(Vector &dst, const number om) const template template void -SparseMatrix::TSOR(Vector &dst, const number om) const +SparseMatrix::TSOR(Vector &dst, const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1644,7 +1645,7 @@ SparseMatrix::TSOR(Vector &dst, const number om) const if (cols->colnums[j] > row) s -= somenumber(val[j]) * dst(cols->colnums[j]); - dst(row) = s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + dst(row) = s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); if (row == 0) break; @@ -1660,7 +1661,7 @@ void SparseMatrix::PSOR(Vector & dst, const std::vector &permutation, const std::vector &inverse_permutation, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1688,7 +1689,7 @@ SparseMatrix::PSOR(Vector & dst, } } - dst(row) = s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + dst(row) = s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); } } @@ -1699,7 +1700,7 @@ void SparseMatrix::TPSOR(Vector & dst, const std::vector &permutation, const std::vector &inverse_permutation, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1725,7 +1726,7 @@ SparseMatrix::TPSOR(Vector & dst, s -= somenumber(val[j]) * dst(col); } - dst(row) = s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + dst(row) = s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); } } @@ -1736,7 +1737,7 @@ template void SparseMatrix::Jacobi_step(Vector & v, const Vector &b, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1756,7 +1757,7 @@ SparseMatrix::Jacobi_step(Vector & v, } else w->equ(-1., b); - precondition_Jacobi(*w, *w, om); + precondition_Jacobi(*w, *w, omega); v -= *w; } @@ -1767,7 +1768,7 @@ template void SparseMatrix::SOR_step(Vector & v, const Vector &b, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1784,7 +1785,7 @@ SparseMatrix::SOR_step(Vector & v, { s -= somenumber(val[j]) * v(cols->colnums[j]); } - v(row) += s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + v(row) += s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); } } @@ -1795,7 +1796,7 @@ template void SparseMatrix::TSOR_step(Vector & v, const Vector &b, - const number om) const + const number omega) const { Assert(cols != nullptr, ExcNeedsSparsityPattern()); Assert(val != nullptr, ExcNotInitialized()); @@ -1812,7 +1813,7 @@ SparseMatrix::TSOR_step(Vector & v, { s -= somenumber(val[j]) * v(cols->colnums[j]); } - v(row) += s * somenumber(om) / somenumber(val[cols->rowstart[row]]); + v(row) += s * somenumber(omega) / somenumber(val[cols->rowstart[row]]); } } @@ -1823,10 +1824,10 @@ template void SparseMatrix::SSOR_step(Vector & v, const Vector &b, - const number om) const + const number omega) const { - SOR_step(v, b, om); - TSOR_step(v, b, om); + SOR_step(v, b, omega); + TSOR_step(v, b, omega); } @@ -1834,10 +1835,10 @@ SparseMatrix::SSOR_step(Vector & v, template template void -SparseMatrix::SSOR(Vector &dst, const number om) const +SparseMatrix::SSOR(Vector &dst, const number omega) const { - // TODO: Is this called anywhere? If so, multiplication with om(2-om)D is - // missing + // TODO: Is this called anywhere? If so, multiplication with omega(2-omega)D + // is missing Assert(false, ExcNotImplemented()); Assert(cols != nullptr, ExcNeedsSparsityPattern()); @@ -1863,7 +1864,7 @@ SparseMatrix::SSOR(Vector &dst, const number om) const s += somenumber(val[j]) * dst(p); } } - dst(i) -= s * somenumber(om); + dst(i) -= s * somenumber(omega); dst(i) /= somenumber(val[cols->rowstart[i]]); } @@ -1880,7 +1881,7 @@ SparseMatrix::SSOR(Vector &dst, const number om) const s += somenumber(val[j]) * dst(p); } } - dst(i) -= s * somenumber(om) / somenumber(val[cols->rowstart[i]]); + dst(i) -= s * somenumber(omega) / somenumber(val[cols->rowstart[i]]); } }