feat(nonlinear-static-newton-raphson): step 6 - backend-neutral-tangent-solver

This commit is contained in:
KOKO\Mimi
2026-08-24 14:25:05 +09:00
parent 162f84e71b
commit 6c995e0ec8
7 changed files with 500 additions and 0 deletions
@@ -0,0 +1,32 @@
#ifndef FESA_SOLVERS_LINEAR_MKL_PARDISO_TANGENT_SOLVER_H_
#define FESA_SOLVERS_LINEAR_MKL_PARDISO_TANGENT_SOLVER_H_
#include <memory>
#include "fesa/solvers/linear/tangent_solver.h"
namespace fesa {
/// @brief Adapts full-CSR unsymmetric oneMKL PARDISO tangent solves.
class MklPardisoTangentSolver final : public TangentSolver {
public:
/// @brief Constructs an empty, unfactorized PARDISO tangent adapter.
MklPardisoTangentSolver();
/// @brief Releases retained PARDISO tangent backend state.
~MklPardisoTangentSolver() override;
/// @brief Validates and factorizes one fresh nonlinear tangent matrix.
Status FactorizeFresh(const SparseMatrix& matrix) override;
/// @brief Solves one correction without refactorizing the tangent.
Status SolveCorrection(const Vector& rhs, Vector& correction) const override;
private:
class Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace fesa
#endif // FESA_SOLVERS_LINEAR_MKL_PARDISO_TANGENT_SOLVER_H_
@@ -0,0 +1,31 @@
#ifndef FESA_SOLVERS_LINEAR_TANGENT_SOLVER_H_
#define FESA_SOLVERS_LINEAR_TANGENT_SOLVER_H_
#include "fesa/core/status.h"
namespace fesa {
class SparseMatrix;
class Vector;
/// @brief Factorizes one nonlinear tangent and solves its correction.
class TangentSolver {
public:
/// @brief Destroys a backend-neutral nonlinear tangent solver.
virtual ~TangentSolver() = default;
/// @brief Replaces any retained state with a fresh tangent factorization.
/// @return Success or a structured solver failure.
virtual Status FactorizeFresh(const SparseMatrix& matrix) = 0;
/// @brief Solves one correction using the current tangent factorization.
/// @param rhs Immutable free-DOF residual right-hand side.
/// @param correction Updated only after successful finite substitution.
/// @return Success or a structured solver failure.
virtual Status SolveCorrection(const Vector& rhs, Vector& correction) const =
0;
};
} // namespace fesa
#endif // FESA_SOLVERS_LINEAR_TANGENT_SOLVER_H_