32#include "../CConfig.hpp"
33#include "../geometry/CGeometry.hpp"
47template <
class ScalarType,
class Apply>
49#ifdef SU2_ENABLE_CUDA_KERNELS
50 if constexpr (su2_gpu_capable_v<ScalarType>) {
74template <
class ScalarType,
class Apply>
77#ifdef SU2_ENABLE_CUDA_KERNELS
78 if constexpr (su2_gpu_capable_v<ScalarType>) {
102template <
class ScalarType>
131template <
class ScalarType>
141template <
class ScalarType>
162template <
class ScalarType>
177 : sparse_matrix(matrix_ref) {
178 if ((geometry_ref ==
nullptr) || (config_ref ==
nullptr))
180 geometry = geometry_ref;
210template <
class ScalarType>
225 : sparse_matrix(matrix_ref) {
226 if ((geometry_ref ==
nullptr) || (config_ref ==
nullptr))
228 geometry = geometry_ref;
257template <
class ScalarType>
272 : sparse_matrix(matrix_ref) {
273 if ((geometry_ref ==
nullptr) || (config_ref ==
nullptr))
275 geometry = geometry_ref;
303template <
class ScalarType>
318 : sparse_matrix(matrix_ref) {
319 if ((geometry_ref ==
nullptr) || (config_ref ==
nullptr))
321 geometry = geometry_ref;
349template <
class ScalarType>
355 unsigned short kind_fact;
366 unsigned short kind_factorization)
367 : sparse_matrix(matrix_ref) {
368 if ((geometry_ref ==
nullptr) || (config_ref ==
nullptr))
370 geometry = geometry_ref;
372 kind_fact = kind_factorization;
400template <
class ScalarType>
414template <
class ScalarType>
Declaration of the block-sparse matrix class. The implemtation is in CSysMatrix.cpp.
Declararion and inlines of the vector class used in the solution of large, distributed,...
#define SU2_DEVICE_REGION(...)
Brackets device work so that it is issued by a single thread with the whole team synchronized before ...
Definition CSysVector.hpp:100
Applies a std::function as the preconditioning operation.
Definition CPreconditioner.hpp:401
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
Definition CPreconditioner.hpp:411
CAbstractPreconditioner(const F &function)
Definition CPreconditioner.hpp:409
CAbstractPreconditioner()=delete
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:211
CILUPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:224
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:242
void Build() override
Definition CPreconditioner.hpp:250
CILUPreconditioner()=delete
No-op preconditioner used when Krylov solvers run without preconditioning.
Definition CPreconditioner.hpp:142
bool IsIdentity() const override
Return true to identify the identity preconditioner, may allow some solvers to be more efficient.
Definition CPreconditioner.hpp:153
void Build() override
Generic "preprocessing" hook derived classes may implement to build the preconditioner.
Definition CPreconditioner.hpp:155
CIdentityPreconditioner()=delete
CIdentityPreconditioner(CSysMatrix< ScalarType > &matrix_ref)
Definition CPreconditioner.hpp:147
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
Definition CPreconditioner.hpp:151
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:163
void Build() override
Definition CPreconditioner.hpp:203
CJacobiPreconditioner()=delete
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
operator that defines the preconditioner operation
Definition CPreconditioner.hpp:194
CJacobiPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:176
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:258
CLU_SGSPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:271
CLU_SGSPreconditioner()=delete
void Build() override
Definition CPreconditioner.hpp:296
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:289
Specialization of preconditioner that uses CSysMatrix class.
Definition CPreconditioner.hpp:304
void Build() override
Definition CPreconditioner.hpp:342
CLineletPreconditioner()=delete
CLineletPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref)
Constructor of the class.
Definition CPreconditioner.hpp:317
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:335
Specialization of preconditioner that uses PaStiX to factorize a CSysMatrix.
Definition CPreconditioner.hpp:350
void Build() override
Definition CPreconditioner.hpp:392
CPastixPreconditioner(CSysMatrix< ScalarType > &matrix_ref, CGeometry *geometry_ref, const CConfig *config_ref, unsigned short kind_factorization)
Constructor of the class.
Definition CPreconditioner.hpp:365
void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const override
Operator that defines the preconditioner operation.
Definition CPreconditioner.hpp:385
CPastixPreconditioner()=delete
Abstract base class for defining a preconditioning operation.
Definition CPreconditioner.hpp:103
virtual void Build()
Generic "preprocessing" hook derived classes may implement to build the preconditioner.
Definition CPreconditioner.hpp:118
virtual void operator()(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v) const =0
Overload of operator (), applies the preconditioner to "u" storing the result in "v".
virtual bool IsIdentity() const
Return true to identify the identity preconditioner, may allow some solvers to be more efficient.
Definition CPreconditioner.hpp:123
Main class for defining block-compressed-row-storage sparse matrices.
Definition CSysMatrix.hpp:256
void ComputeLineletPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1484
void BuildLineletPreconditioner(const CGeometry *geometry, const CConfig *config)
Build the Linelet preconditioner.
Definition CSysMatrix.cpp:1454
void BuildILUPreconditioner()
Build the ILU preconditioner.
Definition CSysMatrix.cpp:1064
void ComputeILUPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1207
void ComputePastixPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Apply the PaStiX factorization to CSysVec.
Definition CSysMatrix.cpp:1831
void BuildLU_SGSPreconditioner()
Build the LU-SGS preconditioner.
Definition CSysMatrix.cpp:1302
void BuildJacobiPreconditioner()
Build the Jacobi preconditioner.
Definition CSysMatrix.cpp:1004
void BuildPastixPreconditioner(CGeometry *geometry, const CConfig *config, unsigned short kind_fact)
Factorize matrix using PaStiX.
Definition CSysMatrix.cpp:1815
void ComputeLU_SGSPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1324
void QuantizeDiagonalBlocks()
Compresses off-diagonal blocks into quantized form for use with USE_QUANTIZATION.
Definition CSysMatrix.cpp:779
void ComputeJacobiPreconditioner(const CSysVector< ScalarType > &vec, CSysVector< ScalarType > &prod, CGeometry *geometry, const CConfig *config) const
Multiply CSysVector by the preconditioner.
Definition CSysMatrix.cpp:1033
Class for holding and manipulating vectors needed by linear solvers.
Definition CSysVector.hpp:195
void DtHTransfer(bool trigger=true) const
Performs the memory copy from device to host.
Definition CSysVectorGPU.cu:200
void HtDTransfer(bool trigger=true) const
Performs the memory copy from host to device.
Definition CSysVectorGPU.cu:193
static CPreconditioner * Create(ENUM_LINEAR_SOLVER_PREC kind, CSysMatrix< ScalarType > &jacobian, CGeometry *geometry, const CConfig *config)
Factory method.
Definition CPreconditioner.hpp:415
void ApplyPreconditionerOnHost(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v, Apply &&apply)
Applies a preconditioner that only has a host implementation to vectors that live on the device: brin...
Definition CPreconditioner.hpp:48
virtual ~CPreconditioner()=0
Destructor of the class.
Definition CPreconditioner.hpp:132
void ApplyPreconditionerOnDevice(const CSysVector< ScalarType > &u, CSysVector< ScalarType > &v, bool useCuda, Apply &&apply)
Mirror of ApplyPreconditionerOnHost: applies a device preconditioner to host vectors.
Definition CPreconditioner.hpp:75
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59
bool UseDeviceExpressions()
Whether vector expressions are currently evaluated on the device.
Definition CSysVector.hpp:119
void SetUseDeviceExpressions(bool)
Definition CSysVector.hpp:120
ENUM_LINEAR_SOLVER_PREC
Types of preconditioners for the linear solver.
Definition option_structure.hpp:2658
@ JACOBI
Jacobi preconditioner.
Definition option_structure.hpp:2660
@ LINELET
Line implicit preconditioner.
Definition option_structure.hpp:2662
@ ILU
ILU(k) preconditioner.
Definition option_structure.hpp:2663
@ Q_IDENTITY
No preconditioner, but the matrix-vector product still uses quantized (int8) off-diagonal storage,...
Definition option_structure.hpp:2667
@ PASTIX_ILU
PaStiX ILU(k) preconditioner.
Definition option_structure.hpp:2669
@ Q_JACOBI
Jacobi with quantized (int8) off-diagonal storage; same matvec quantization as Q_LU_SGS,...
Definition option_structure.hpp:2665
@ PASTIX_LDLT_P
PaStiX LDLT as preconditioner.
Definition option_structure.hpp:2671
@ PASTIX_LU_P
PaStiX LU as preconditioner.
Definition option_structure.hpp:2670
@ Q_LU_SGS
LU-SGS with quantized (int8) off-diagonal storage; L/U are never allocated as ScalarType.
Definition option_structure.hpp:2664
@ IDENTITY
No preconditioner.
Definition option_structure.hpp:2659
@ LU_SGS
LU SGS preconditioner.
Definition option_structure.hpp:2661