12#ifndef ARCCORE_ALINA_ALINALIB_H
13#define ARCCORE_ALINA_ALINALIB_H
26#include "arccore/alina/AlinaGlobal.h"
36namespace Arcane::AlinaLib
46 double residual = 0.0;
67enum class eAlinaSolverType
75enum class eAlinaPreconditionerType
88class ARCCORE_ALINA_EXPORT AlinaParameters
90 friend AlinaPreconditioner;
91 friend AlinaSequentialSolver;
92 friend AlinaDistributedSolver;
93 friend AlinaSequentialSolverImpl;
94 friend AlinaDistributedSolverImpl;
112 void setString(
const char* name,
const char* value);
119 std::shared_ptr<AlinaParametersImpl> m_p;
132 friend AlinaSequentialSolverImpl;
133 friend AlinaDistributedSolverImpl;
161 void setString(
const char* name,
const char* value);
169 void setSolverAbsoluteTolerance(
Real value);
170 void setSolverRelativeTolerance(
Real value);
171 void setSolverMaxIteration(
Int32 value);
172 void setSolverVerbosity(
Int32 value);
174 void setSolverPreconditioner(eAlinaPreconditionerType v);
175 void setSolverType(eAlinaSolverType v);
183 std::shared_ptr<AlinaSolverParametersImpl> m_p;
191class ARCCORE_ALINA_EXPORT AlinaCSRMatrixView
195 AlinaCSRMatrixView(
Int32 nb_row,
const Int32* row_indexes,
const Int32* columns,
const double* values)
197 , m_row_indexes(row_indexes, nb_row + 1)
198 , m_columns(columns, row_indexes[nb_row])
199 , m_values(values, row_indexes[nb_row])
203 : m_nb_row(row_indexes.size() - 1)
204 , m_row_indexes(row_indexes)
211 constexpr Int32 nbRow()
const {
return m_nb_row; }
218 void dump(std::ostream& o)
const;
245class ARCCORE_ALINA_EXPORT AlinaPreconditioner
249 AlinaPreconditioner(
int n,
258 void apply(
const double* rhs,
double* x);
265 std::shared_ptr<AlinaPreconditionerImpl> m_p;
304 std::shared_ptr<IAlinaSolverImpl> m_p;
General declarations for the 'message_passing' component.
Types and functions associated with the classes SpanImpl, SmallSpan and Span.
CSR Matrix view used in AlinaLib.
void checkSizes() const
Check that sizes are valid:
Implementation for a distributed solver.
Handle parameters for Alina.
void setInt64(const char *name, Int64 value)
Set Int64 parameter in the parameter list.
void setString(const char *name, const char *value)
Set floating point parameter in the parameter list.
void setInt32(const char *name, Int32 value)
Set Int32 parameter in the parameter list.
void readFromJSON(const char *fname)
Read parameters from a JSON file.
void setReal(const char *name, Real value)
Set floating point parameter in the parameter list.
Handle preconditioner for a solver.
void report()
Printout preconditioner structure.
void apply(const double *rhs, double *x)
Apply AMG preconditioner (x = M^(-1) * rhs).
Implementation for a sequential solver.
Handle parameters for solvers.
void readFromJSON(const char *fname)
Read parameters from a JSON file.
void setString(const char *name, const char *value)
Set floating point parameter in the parameter list.
void setInt32(const char *name, Int32 value)
Set Int32 parameter in the parameter list.
void setReal(const char *name, Real value)
Set floating point parameter in the parameter list.
void setInt64(const char *name, Int64 value)
Set Int64 parameter in the parameter list.
AlinaSolverParameters()
Create a sequential solver.
AlinaSolver(const AlinaSolverParameters ¶ms, const AlinaCSRMatrixView &matrix_view)
Create a solver.
void report()
Printout solver structure.
AlinaConvergenceInfo solveMatrix(const AlinaCSRMatrixView &matrix_view, SmallSpan< const double > rhs, SmallSpan< double > x)
Solve the problem for the given matrix and the right-hand side.
AlinaConvergenceInfo solve(SmallSpan< const double > rhs, SmallSpan< double > x)
Find solution for the given RHS.
Interface of the message passing manager.
View of an array of elements of type T.
std::int64_t Int64
Signed integer type of 64 bits.
double Real
Type representing a real number.
std::int32_t Int32
Signed integer type of 32 bits.