![]() |
|
|||
File indexing completed on 2025-09-17 08:54:08
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file corecel/math/TridiagonalSolver.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <vector> 0010 0011 #include "corecel/Assert.hh" 0012 #include "corecel/Macros.hh" 0013 #include "corecel/Types.hh" 0014 #include "corecel/cont/Span.hh" 0015 0016 namespace celeritas 0017 { 0018 //---------------------------------------------------------------------------// 0019 /*! 0020 * Solve a tridiagonal system of equations using the Thomas algorithm. 0021 * 0022 * This is a simplified form of Gaussian elimination that can solve a 0023 * tridiagonal system \f$ \mathbf{T} \mathbf{x} = \mathbf{b} \f$ in O(n) time. 0024 */ 0025 class TridiagonalSolver 0026 { 0027 public: 0028 //!@{ 0029 //! \name Type aliases 0030 using Real3 = Array<real_type, 3>; 0031 using Coeffs = std::vector<Real3>; 0032 using SpanConstReal = Span<real_type const>; 0033 using SpanReal = Span<real_type>; 0034 //!@} 0035 0036 public: 0037 // Construct with coefficients 0038 explicit TridiagonalSolver(Coeffs&& tridiag); 0039 0040 // Solve the tridiagonal system 0041 void operator()(SpanConstReal rhs, SpanReal x) const; 0042 0043 private: 0044 Coeffs tridiag_; 0045 }; 0046 0047 //---------------------------------------------------------------------------// 0048 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |