clang format

This commit is contained in:
Ethan Peterson 2026-06-29 13:13:10 -04:00
parent d6e4ce34f8
commit fd361c3f1c
4 changed files with 17 additions and 24 deletions

View file

@ -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<double> solve(
const CSCMatrix& A, const vector<double>& n0, double dt,
int substeps = 1) = 0;
virtual vector<double> solve(const CSCMatrix& A, const vector<double>& 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<double> solve(
const CSCMatrix& A, const vector<double>& n0, double dt,
vector<double> solve(const CSCMatrix& A, const vector<double>& 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<double>* alpha_; //!< Residues [n_poles]
const std::complex<double>* theta_; //!< Poles [n_poles]
double alpha0_; //!< Limit at infinity
int n_poles_; //!< Number of poles (k/2)
const std::complex<double>* alpha_; //!< Residues [n_poles]
const std::complex<double>* theta_; //!< Poles [n_poles]
double alpha0_; //!< Limit at infinity
};
} // namespace openmc

View file

@ -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];

View file

@ -58,8 +58,8 @@ CSCMatrix::CSCMatrix(
{
if (static_cast<int>(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())};
}
}

View file

@ -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")