template<typename T>
class numcxx::TSolverUMFPACK< T >
Bridge class for using umfpack as solver for vmatrix.
UMFPACK is a GPL licensed sparse matrix package by Tim Davis of Texas A&M university, see wikipedia and its homepage
- Examples:
- 15-numcxx-umfpack.cxx, 40-stationary-heat-fe.cxx, 41-stationary-heat-fv.cxx, 42-convtest-fem-sin.cxx, 43-convtest-fvm-sin.cxx, 44-transient-heat-fe.cxx, 45-convdiff1d.cxx, and 46-nonlin-fvm.cxx.
Definition at line 20 of file tsolver-umfpack.hxx.
Create LU factorization class.
Definition at line 14 of file tsolver-umfpack.ixx.
const std::shared_ptr< TSparseMatrix< T > > pMatrix
The corresponding matrix.
void * Numeric
Pointer to numeric factorization data.
void * Symbolic
Pointer to symbolic factorization data.
void update()
Perform actual computation of LU factorization.
Create LU factorization class.
Definition at line 23 of file tsolver-umfpack.ixx.
const std::shared_ptr< TSparseMatrix< T > > pMatrix
The corresponding matrix.
void * Numeric
Pointer to numeric factorization data.
void * Symbolic
Pointer to symbolic factorization data.
void update()
Perform actual computation of LU factorization.
Definition at line 32 of file tsolver-umfpack.ixx.
41 umfpack_di_free_numeric(&
Numeric);
void * Numeric
Pointer to numeric factorization data.
void * Symbolic
Pointer to symbolic factorization data.
Perform actual computation of LU factorization.
copy matrix data for use in solve
Definition at line 62 of file tsolver-umfpack.ixx.
64 if (Matrix.empty())
return;
65 if (Matrix.pattern_changed())
66 throw std::runtime_error(
"numcxx: forgot flush() after sparse pattern changed");
68 int n=Matrix.shape(0);
69 int nia=Matrix.pIA->size();
70 int nja=Matrix.pJA->size();
80 double *control=
nullptr;
83 if (Matrix.pattern_changed() ||
Symbolic==
nullptr)
87 status=umfpack_di_symbolic (n, n, Matrix.pIA->data(), Matrix.pJA->data(), Matrix.pA->data(), &
Symbolic, 0, 0);
91 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_symbolic error %d\n",status);
92 throw std::runtime_error(errormsg);
98 umfpack_di_free_numeric(&
Numeric);
101 status =umfpack_di_numeric (Matrix.pIA->data(), Matrix.pJA->data(), Matrix.pA->data(),
Symbolic, &
Numeric, control, 0) ;
105 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_numeric error %d\n",status);
106 throw std::runtime_error(errormsg);
std::shared_ptr< TArray1< int > > pIA
Row pointer of matrix.
std::shared_ptr< TArray1< int > > pJA
Column indices.
std::shared_ptr< TArray1< T > > pA
Entries.
void * Numeric
Pointer to numeric factorization data.
void * Symbolic
Pointer to symbolic factorization data.
Solve LU factorized system.
- Examples:
- 15-numcxx-umfpack.cxx, 40-stationary-heat-fe.cxx, 41-stationary-heat-fv.cxx, 42-convtest-fem-sin.cxx, 43-convtest-fvm-sin.cxx, 44-transient-heat-fe.cxx, 45-convdiff1d.cxx, and 46-nonlin-fvm.cxx.
Definition at line 116 of file tsolver-umfpack.ixx.
118 Sol.resize(Rhs.size());
119 double *control=
nullptr;
121 status=umfpack_di_solve (UMFPACK_At,
pIA->data(),
pJA->data(),
pA->data(), Sol.data(), Rhs.data(),
Numeric, control, 0 ) ;
125 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_solve error %d\n",status);
126 throw std::runtime_error(errormsg);
std::shared_ptr< TArray1< int > > pIA
Row pointer of matrix.
std::shared_ptr< TArray1< int > > pJA
Column indices.
std::shared_ptr< TArray1< T > > pA
Entries.
void * Numeric
Pointer to numeric factorization data.
Definition at line 66 of file tsolver-umfpack.hxx.
void solve(TArray< T > &Sol, const TArray< T > &Rhs)
Solve LU factorized system.
The documentation for this class was generated from the following files: