Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
IInternalLinearSolverT.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#pragma once
8
9#include <arccore/message_passing/MessagePassingGlobal.h>
10#include <alien/utils/Precomp.h>
11#include <memory>
12
13/*---------------------------------------------------------------------------*/
14/*---------------------------------------------------------------------------*/
15
16namespace Alien
17{
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22class ILinearAlgebra;
23class SolverStat;
24struct SolverStatus;
25
26/*!
27 * \ingroup core
28 * \brief Internal linear solver interface
29 *
30 * Internal interface for all linear solver package
31 *
32 * \tparam Matrix The type of matrix used
33 * \tparam Vector The type of vector used
34 */
35template <class Matrix, class Vector>
37{
38 public:
39 //! Free resources
41
42 /*!
43 * \brief Update parallel manager
44 *
45 * Allows to change parallel manager in cases where it changes, like solves in a
46 * redistributed environment
47 *
48 * \param[in] pm The new parallel manager
49 */
50 virtual void updateParallelMng([[maybe_unused]] Arccore::MessagePassing::IMessagePassingMng* pm) {}
51
52 //! Initialize the linear solver
53 virtual void init() {}
54
55 //! Finalize the linear solver
56 virtual void end() {}
57
58 /*!
59 * \brief Solve the linear system A * x = b
60 * \param[in] A The matrix to invert
61 * \param[in] b The right hand side
62 * \param[in,out] x The solution
63 * \returns Solver success or failure
64 */
65 virtual bool solve(const Matrix& A, const Vector& b, Vector& x) = 0;
66
67 /*!
68 * \brief Get statistics on the solve phase
69 *
70 * Get statistics on the solver phase, such as iteration count, initialization time,
71 * solve time, etc.
72 *
73 * \return Solver statistics
74 */
75 virtual SolverStat const& getSolverStat() const = 0;
76
77 /*!
78 * \brief Get statistics on the solve phase
79 *
80 * Get statistics on the solver phase, such as iteration count, initialization time,
81 * solve time, etc.
82 *
83 * \return Solver statistics
84 */
85 virtual SolverStat& getSolverStat() = 0;
86
87 /*!
88 * \brief Indicates if the kernel is parallel
89 * \returns Parallel support capability
90 */
91 virtual bool hasParallelSupport() const = 0;
92
93 /*!
94 * \brief Get solver resolution status
95 * \returns The solver status
96 */
97 virtual const SolverStatus& getStatus() const = 0;
98
99 /*!
100 * \brief Get compatible linear algebra
101 * \returns Linear algebra pointer
102 */
103 virtual std::shared_ptr<ILinearAlgebra> algebra() const
104 {
105 return std::shared_ptr<ILinearAlgebra>();
106 }
107};
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
111
112} // namespace Alien
113
114/*---------------------------------------------------------------------------*/
115/*---------------------------------------------------------------------------*/
Internal linear solver interface.
virtual void end()
Finalize the linear solver.
virtual void updateParallelMng(Arccore::MessagePassing::IMessagePassingMng *pm)
Update parallel manager.
virtual SolverStat const & getSolverStat() const =0
Get statistics on the solve phase.
virtual SolverStat & getSolverStat()=0
Get statistics on the solve phase.
virtual ~IInternalLinearSolver()
Free resources.
virtual const SolverStatus & getStatus() const =0
Get solver resolution status.
virtual void init()
Initialize the linear solver.
virtual bool hasParallelSupport() const =0
Indicates if the kernel is parallel.
virtual std::shared_ptr< ILinearAlgebra > algebra() const
Get compatible linear algebra.
virtual bool solve(const Matrix &A, const Vector &b, Vector &x)=0
Solve the linear system A * x = b.
Interface for linear algebra.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17
Structure to store a solver status.