chrono::ChMklEngine Class Reference

Description

Interface class to Intel MKL Pardiso solver.

This class wraps the C interface of the solver in order to fit Chrono data structures. This class can still be called by the end-user in order to solve linear systems. See demo_MKL_MklEngine for the related demo.

#include <ChMklEngine.h>

Public Types

enum  phase_t {
  COMPLETE = 13, ANALYSIS = 11, ANALYSIS_NUMFACTORIZATION = 12, NUMFACTORIZATION = 22,
  NUMFACTORIZATION_SOLVE = 23, SOLVE = 33, SOLVE_FORWARD = 331, SOLVE_DIAGONAL = 332,
  SOLVE_BACKWARD = 333, RELEASE_FACTORS = 0, RELEASE_ALL = -1
}
 

Public Member Functions

 ChMklEngine (int pb_size=0, ChSparseMatrix::SymmetryType matrix_type=ChSparseMatrix::GENERAL)
 
void SetProblemSize (int pb_size)
 Set problem dimension.
 
void SetMatrix (ChSparseMatrix &Z)
 Set the problem matrix. More...
 
void SetMatrix (int pb_size, double *a, int *ia, int *ja)
 Set directly the CSR matrix arrays. More...
 
void SetSolutionVector (ChMatrix<> &x)
 Set the solution vector. More...
 
void SetSolutionVector (double *x)
 
void SetRhsVector (ChMatrix<> &b)
 Set the right-hand side vector. More...
 
void SetRhsVector (double *b)
 
void SetProblem (ChSparseMatrix &Z, ChMatrix<> &b, ChMatrix<> &x)
 Set the matrix, as well as the right-hand side and solution arrays.
 
int PardisoCall (int phase, int message_level=0)
 Solver routine.
 
void ResetSolver ()
 Reinitializes the solver to default values.
 
void GetResidual (ChMatrix<> &res) const
 Calculate and return the problem residual res=b-Ax. More...
 
void GetResidual (double *res) const
 
double GetResidualNorm () const
 Calculate and return the L2-norm of the problem residual, ||b-Ax||.
 
void SetIparmValue (int parm_num, int value)
 Set the value of the specified entry in the Pardiso parameter list.
 
int GetIparmValue (int parm_num) const
 Return the current value of the specified Pardiso parameter.
 
int * GetIparmAddress ()
 Get the Pardiso parameter list.
 
void PrintPardisoParameters () const
 Print the current values of the Pardiso solver parameters.
 
void UsePermutationVector (bool val)
 Enable/disable use of permutation vector. More...
 
void UsePartialSolution (int option=1, int start_row=0, int end_row=0)
 
void OutputSchurComplement (int option, int start_row, int end_row=0)
 The Schur complement is output on the solution vector x that has to be resized to n x n size; The next call to Pardiso must not involve a solution phase. More...
 
void SetPreconditionedCGS (bool val, int L)
 

Member Function Documentation

void chrono::ChMklEngine::GetResidual ( ChMatrix<> &  res) const

Calculate and return the problem residual res=b-Ax.

Note that it is the caller's responsibility to provide an array of appropriate size.

void chrono::ChMklEngine::OutputSchurComplement ( int  option,
int  start_row,
int  end_row = 0 
)

The Schur complement is output on the solution vector x that has to be resized to n x n size; The next call to Pardiso must not involve a solution phase.

So no phase 33, 331, 332, 333, 23, 13 ecc... Any solution phase in fact would ouput the solution on the solution vector x. The element (

Parameters
start_row],\param[start_row]must be the top-left element of the matrix on which the Schur complement will be computed; The element (
end_row],\param[end_row]must be the bottom-right element of the matrix on which the Schur complement will be computed;
void chrono::ChMklEngine::SetMatrix ( ChSparseMatrix Z)

Set the problem matrix.

This will also update the problem dimension as well as the matrix symmetry type.

void chrono::ChMklEngine::SetMatrix ( int  pb_size,
double *  a,
int *  ia,
int *  ja 
)

Set directly the CSR matrix arrays.

Note that it is implied that the matrix symmetry type is GENERAL.

void chrono::ChMklEngine::SetRhsVector ( ChMatrix<> &  b)

Set the right-hand side vector.

Note that it is the caller's responsibility to ensure that the size is appropriate.

void chrono::ChMklEngine::SetSolutionVector ( ChMatrix<> &  x)

Set the solution vector.

Note that it is the caller's responsibility to provide an array of appropriate size.

void chrono::ChMklEngine::UsePermutationVector ( bool  val)

Enable/disable use of permutation vector.

Indicate to the solver to store the permutation vector and use it in the next calls.