From fd361c3f1c0fb2123cfa1a07992530e216379fb5 Mon Sep 17 00:00:00 2001 From: Ethan Peterson Date: Mon, 29 Jun 2026 13:13:10 -0400 Subject: [PATCH] clang format --- include/openmc/bateman_solvers.h | 16 +++++++--------- src/bateman_solvers.cpp | 3 ++- src/sparse_matrix.cpp | 4 ++-- tests/cpp_unit_tests/test_sparse_matrix.cpp | 18 ++++++------------ 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/include/openmc/bateman_solvers.h b/include/openmc/bateman_solvers.h index fdddaf4ccb..79b6901797 100644 --- a/include/openmc/bateman_solvers.h +++ b/include/openmc/bateman_solvers.h @@ -55,9 +55,8 @@ public: //! \param dt Time interval [s] //! \param substeps Number of substeps to use within dt //! \return Final atom densities [n] - virtual vector solve( - const CSCMatrix& A, const vector& n0, double dt, - int substeps = 1) = 0; + virtual vector solve(const CSCMatrix& A, const vector& n0, + double dt, int substeps = 1) = 0; }; //============================================================================== @@ -87,16 +86,15 @@ public: explicit IPFCramSolver(int order = 48); //! Solve using full LU factorization (general transmutation matrix). - vector solve( - const CSCMatrix& A, const vector& n0, double dt, + vector solve(const CSCMatrix& A, const vector& n0, double dt, int substeps = 1) override; private: // --- CRAM coefficients (non-owning views of the static tables) --- - int n_poles_; //!< Number of poles (k/2) - const std::complex* alpha_; //!< Residues [n_poles] - const std::complex* theta_; //!< Poles [n_poles] - double alpha0_; //!< Limit at infinity + int n_poles_; //!< Number of poles (k/2) + const std::complex* alpha_; //!< Residues [n_poles] + const std::complex* theta_; //!< Poles [n_poles] + double alpha0_; //!< Limit at infinity }; } // namespace openmc diff --git a/src/bateman_solvers.cpp b/src/bateman_solvers.cpp index 98a7ff9eea..504caa1f23 100644 --- a/src/bateman_solvers.cpp +++ b/src/bateman_solvers.cpp @@ -62,7 +62,8 @@ void numeric_factorize_cram(const CSCMatrix& A, double dt, for (int j = 0; j < n; ++j) { - // Scatter the shifted operator column: M[:, j] = dt * A[:, j] - theta * I[:, j] + // Scatter the shifted operator column: M[:, j] = dt * A[:, j] - theta * + // I[:, j] { int a_pos = a_indptr[j]; int a_end = a_indptr[j + 1]; diff --git a/src/sparse_matrix.cpp b/src/sparse_matrix.cpp index 7810dca239..0983e63719 100644 --- a/src/sparse_matrix.cpp +++ b/src/sparse_matrix.cpp @@ -58,8 +58,8 @@ CSCMatrix::CSCMatrix( { if (static_cast(data_.size()) != pattern_.nnz()) { throw std::invalid_argument { - fmt::format("CSCMatrix: data size ({}) != pattern nnz ({})", - data_.size(), pattern_.nnz())}; + fmt::format("CSCMatrix: data size ({}) != pattern nnz ({})", data_.size(), + pattern_.nnz())}; } } diff --git a/tests/cpp_unit_tests/test_sparse_matrix.cpp b/tests/cpp_unit_tests/test_sparse_matrix.cpp index 0f70650676..d1ec07496f 100644 --- a/tests/cpp_unit_tests/test_sparse_matrix.cpp +++ b/tests/cpp_unit_tests/test_sparse_matrix.cpp @@ -140,28 +140,22 @@ TEST_CASE("CSCMatrix default constructor") TEST_CASE("CSCPattern rejects malformed inputs") { // indptr size mismatch (n=3 requires 4 entries) - CHECK_THROWS_AS( - CSCPattern(3, {0, 1, 2}, {0, 1}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(3, {0, 1, 2}, {0, 1}), std::invalid_argument); // indptr[0] must be 0 - CHECK_THROWS_AS( - CSCPattern(2, {1, 1, 2}, {0, 1}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(2, {1, 1, 2}, {0, 1}), std::invalid_argument); // indptr[n] must equal nnz - CHECK_THROWS_AS( - CSCPattern(2, {0, 1, 3}, {0, 1}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(2, {0, 1, 3}, {0, 1}), std::invalid_argument); // Row index out of bounds - CHECK_THROWS_AS( - CSCPattern(2, {0, 1, 2}, {0, 5}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(2, {0, 1, 2}, {0, 5}), std::invalid_argument); // Unsorted row indices within a column - CHECK_THROWS_AS( - CSCPattern(3, {0, 2, 2, 2}, {2, 0}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(3, {0, 2, 2, 2}, {2, 0}), std::invalid_argument); // Duplicate row indices within a column (not strictly ascending) - CHECK_THROWS_AS( - CSCPattern(3, {0, 2, 2, 2}, {1, 1}), std::invalid_argument); + CHECK_THROWS_AS(CSCPattern(3, {0, 2, 2, 2}, {1, 1}), std::invalid_argument); } TEST_CASE("CSCMatrix rejects data/nnz size mismatch")