Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
ILinearSolver.h
Go to the documentation of this file.
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
12
13#pragma once
14
15#include <arccore/message_passing/MessagePassingGlobal.h>
16#include <alien/utils/Precomp.h>
17
18#include <memory>
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Alien
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29class ILinearAlgebra;
30class Space;
31class SolverStat;
32class VectorData;
33class IMatrix;
34class IVector;
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
44{
47 : succeeded(false)
48 , residual(0)
50 , error(0)
51 {}
52
56 Arccore::Real residual;
58 Arccore::Integer iteration_count;
60 Arccore::Integer error;
61};
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
71{
72 public:
78
79 public:
82
84 virtual ~ILinearSolver() {}
85
86 public:
87 /*
88 * \brief Get the back end name
89 * \returns The back end name
90 */
91 virtual Arccore::String getBackEndName() const = 0;
92
94 virtual void init() = 0;
95
97 virtual void end() = 0;
98
103 virtual void updateParallelMng(Arccore::MessagePassing::IMessagePassingMng* pm) = 0;
104
112 virtual bool solve(const IMatrix& A, const IVector& b, IVector& x) = 0;
113
114 /*
115 * \brief Get statistics on the solve process
116 * \returns Statistics on the solve process
117 */
118 virtual SolverStat const& getSolverStat() const = 0;
119
124 virtual std::shared_ptr<ILinearAlgebra> algebra() const = 0;
125
130 virtual bool hasParallelSupport() const = 0;
131
136 virtual const SolverStatus& getStatus() const = 0;
137
147 virtual void setNullSpaceConstantOption(bool flag) = 0;
148
149#ifdef USE_MULTI_SOLVER_INSTANCE
155 virtual ILinearSolver* create() const { return NULL; }
156#endif /* USE_MULTI_SOLVER_INSTANCE */
157
158};
159
161{
162 public:
163
166
169
170 virtual void setDiagScaling(const IMatrix& matrix) = 0 ;
171
172} ;
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
176} // namespace Alien
177
178/*---------------------------------------------------------------------------*/
179/*---------------------------------------------------------------------------*/
Interface for linear algebra.
virtual ~ILinearSolverWithDiagScaling()
Free resources.
virtual void updateParallelMng(Arccore::MessagePassing::IMessagePassingMng *pm)=0
update parallel_mng, required for redistribution
SolverStatus Status
Type of the solver status.
virtual void init()=0
Initialization.
virtual ~ILinearSolver()
Free resources.
ILinearSolver()
Constructor.
virtual void end()=0
Finalization.
virtual bool solve(const IMatrix &A, const IVector &b, IVector &x)=0
Solves a linear system.
virtual std::shared_ptr< ILinearAlgebra > algebra() const =0
Get a compatible linear algebra, i.e. a linear algebra matching the solver kernel.
virtual bool hasParallelSupport() const =0
Whether or not the solver support parallel solve.
virtual void setNullSpaceConstantOption(bool flag)=0
Option to add an extra-equation.
virtual const SolverStatus & getStatus() const =0
Get resolution information.
Interface for all matrices.
Definition IMatrix.h:51
Interface for all vectors.
Definition IVector.h:51
Implementation of an algebraic space.
Definition Space.h:47
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17
Structure to store a solver status.
Arccore::Integer iteration_count
The number of iterations.
Arccore::Real residual
The residual.
bool succeeded
Whether or not the solver succeeded.
SolverStatus()
Constructor.
Arccore::Integer error
The error.