#include <DSSolver.h>
Public Member Functions | |
virtual BOOL | AddNumbers (double alfa, SparseMatrixF *smtx) |
int | CG (double *b, double *x, double epsilon, int max_iter) |
virtual long | Close () |
virtual void | condense (double *a, double *lhs, double *rhs, long tc) |
virtual void | Dispose () |
DSSolver (MathTracer *pMT=NULL) | |
virtual double & | ElementAt (int i, int j) |
void | EndSolverWriteInfo () |
virtual BOOL | Factorize () |
void | GetA12block (double *pA12) |
virtual double | GetFactorizationError () |
IntArrayList * | GetFixedBlocks () |
IntArrayList * | GetFixedDOFs () |
virtual SparseMatrixF * | GetSparseMatrix () |
virtual long | Initialize (unsigned char run_code, eDSSolverType solverType=eDSSFactorizationLDLT, eDSMatrixType matrixType=eDSSparseMatrix) |
virtual BOOL | IsAllocated () |
virtual BOOL | IsFactorized () |
virtual BOOL | IsInitialized () |
virtual BOOL | IsSchur () |
virtual BOOL | LoadMatrix (SparseMatrixF *smt, unsigned char block_size) |
virtual BOOL | LoadMatrix (unsigned long neq, unsigned char block_size, double *a, unsigned long *ci, unsigned long *adr) |
virtual BOOL | LoadMCN (IntArrayList &mcn) |
virtual BOOL | LoadMCN (ULONG n_blocks, unsigned char block_size, long *mcn, BOOL bIsSchur) |
virtual BOOL | LoadNumbers (SparseMatrixF *sm) |
virtual void | LoadZeros () |
void | MulMatrixByVector (double *b, double *c) |
int | PreCG (double *b, double *x, double epsilon, int max_iter) |
virtual BOOL | PreFactorize () |
virtual BOOL | ReFactorize () |
virtual BOOL | ScaleMatrix (double alfa) |
virtual BOOL | SetMatrixPattern (SparseMatrixF *smt, unsigned char block_size) |
virtual void | SetMT (MathTracer *pMT) |
virtual BOOL | SetOrderingType (Ordering::Type otype) |
void | SetSM (SparseMatrixF *sm) |
virtual BOOL | Solve (double *r, double *f) |
void | StartSolverWriteInfo () |
virtual | ~DSSolver () |
Private Member Functions | |
BOOL | CreateFixedArray (long no_noncondensed_DOFs) |
SparseGridMtx * | CreateNewSparseGridMtx (IntArrayList *fixed=NULL) |
void | ExpandMCN (IntArrayList &mcn) |
BOOL | LoadMCN_int (IntArrayList *mcn_order) |
BOOL | PreFactorizeSchur () |
void | StoreFixedLastPermutation_dom_order () |
void | WriteFactorizationInfo () |
Private Attributes | |
SparseGridMtx * | act_matrix |
unsigned char | blockSize |
IntArrayList * | dom_order |
MathTracer * | eMT |
IntArrayList * | fixed |
IntArrayList * | lncn |
BOOL | m_bIsSchur |
ISolver::eState | m_eState |
SparseMatrixF | m_sm |
SparseGridMtx * | matrix |
LargeVector | matrixD |
SparseGridMtxPD * | matrixPD |
eDSMatrixType | MatrixType |
Ordering * | mcn |
MathTracer | MT |
long | n_blocks |
long | neq |
Ordering::Type | OrderingType |
SparseGridMtx * | orig_matrix |
unsigned char | run_code |
eDSSolverType | SolverType |
char | str [512] |
double * | tmpR |
Definition at line 173 of file DSSolver.h.
DSSolver | ( | MathTracer * | pMT = NULL |
) |
Definition at line 13 of file DSSolver.cpp.
References Ordering::ApproxMinimumDegree, blockSize, dom_order, eDSSFactorizationLDLT, eDSSparseMatrix, eMT, fixed, lncn, m_bIsSchur, m_eState, matrixPD, MatrixType, mcn, n_blocks, neq, None, OrderingType, orig_matrix, run_code, SetMT(), SolverType, tmpR, and MathTracer::Writeln().
~DSSolver | ( | ) | [virtual] |
Definition at line 43 of file DSSolver.cpp.
References Dispose().
BOOL AddNumbers | ( | double | alfa, | |
SparseMatrixF * | smtx | |||
) | [virtual] |
Implements ISolver.
Definition at line 368 of file DSSolver.cpp.
References SparseMatrixF::a, SparseMatrixF::AddNumbers(), ISolver::Allocated, eMT, m_eState, m_sm, and MathTracer::Writeln().
int CG | ( | double * | b, | |
double * | x, | |||
double | epsilon, | |||
int | max_iter | |||
) | [virtual] |
Implements ISolver.
Definition at line 1082 of file DSSolver.cpp.
References LargeVectorAttach::AddMult(), LargeVectorAttach::DataPtr(), eMT, LargeVectorAttach::InnerProduct(), LargeVectorAttach::LinComb(), MulMatrixByVector(), neq, MathTracer::Write(), and MathTracer::Writeln().
long Close | ( | ) | [virtual] |
void condense | ( | double * | a, | |
double * | lhs, | |||
double * | rhs, | |||
long | tc | |||
) | [virtual] |
Implements ISolver.
Definition at line 893 of file DSSolver.cpp.
References IntArrayList::Count, dom_order, eMT, Factorize(), ISolver::Factorized, ISolver::Initialized, IsSchur(), IntArrayList::Items, lncn, m_bIsSchur, m_eState, matrixPD, mcn, neq, Ordering::perm, SparseGridMtxPD::SolveA11(), SparseGridMtxPD::Sub_A11inv_A12(), SparseGridMtxPD::Sub_A21_A11inv(), tmpR, SparseGridMtxPD::WriteCondensedMatrixA22(), and MathTracer::Writeln().
BOOL CreateFixedArray | ( | long | no_noncondensed_DOFs | ) | [private] |
Definition at line 722 of file DSSolver.cpp.
References IntArrayList::AddIfNotLast(), IntArrayList::Alloc(), blockSize, IntArrayList::Count, eMT, ISolver::ErrorInMCN, fixed, IntArrayList::Items, lncn, m_eState, mcn, neq, Ordering::order, Ordering::perm, and MathTracer::Writeln().
Referenced by LoadMCN_int().
SparseGridMtx * CreateNewSparseGridMtx | ( | IntArrayList * | fixed = NULL |
) | [private] |
Definition at line 204 of file DSSolver.cpp.
References blockSize, Array::Clear(), IntArrayList::Count, MathTracer::CS(), eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eDSSFastCG, TraceableMatrix::eMT, eMT, SparseConectivityMtxII::GetPermutationAndPattern(), m_sm, MathTracer::MC_(), mcn, SparseConectivityMtxII::N(), n_blocks, SparseConectivityMtxII::Nonzeros(), SparseMatrixF::Nonzeros(), OrderingType, SolverType, str, tmpR, MathTracer::Write(), MathTracer::Writeln(), and SparseGridMtx::WriteStatistics().
Referenced by PreFactorize(), and PreFactorizeSchur().
void Dispose | ( | ) | [virtual] |
Implements ISolver.
Definition at line 110 of file DSSolver.cpp.
References dom_order, fixed, lncn, matrixPD, mcn, orig_matrix, and tmpR.
Referenced by Close(), Initialize(), SetMatrixPattern(), and ~DSSolver().
double & ElementAt | ( | int | i, | |
int | j | |||
) | [virtual] |
Definition at line 339 of file DSSolver.cpp.
void EndSolverWriteInfo | ( | ) |
Definition at line 560 of file DSSolver.cpp.
References eMT, MathTracer::NowString(), str, MathTracer::Write(), and MathTracer::Writeln().
Referenced by Factorize().
void ExpandMCN | ( | IntArrayList & | mcn | ) | [private] |
Definition at line 635 of file DSSolver.cpp.
References IntArrayList::Add(), blockSize, IntArrayList::Count, and fixed.
Referenced by LoadMCN_int().
BOOL Factorize | ( | ) | [virtual] |
Implements ISolver.
Definition at line 570 of file DSSolver.cpp.
References eMT, EndSolverWriteInfo(), IsAllocated(), m_sm, SparseMatrixF::neq, PreFactorize(), ReFactorize(), StartSolverWriteInfo(), str, MathTracer::Write(), and MathTracer::Writeln().
Referenced by condense(), and Solve().
void GetA12block | ( | double * | pA12 | ) | [virtual] |
Implements ISolver.
Definition at line 958 of file DSSolver.cpp.
References IntArrayList::Count, SparseMatrixF::GetA12block(), lncn, and m_sm.
double GetFactorizationError | ( | ) | [virtual] |
Implements ISolver.
Definition at line 608 of file DSSolver.cpp.
References SparseMatrixF::a, LargeVectorAttach::DataPtr(), LargeVectorAttach::InnerProduct(), LargeVectorAttach::LinComb(), m_sm, MulMatrixByVector(), neq, and Solve().
IntArrayList* GetFixedBlocks | ( | ) | [inline] |
Definition at line 258 of file DSSolver.h.
References fixed.
IntArrayList* GetFixedDOFs | ( | ) | [inline] |
Definition at line 259 of file DSSolver.h.
References lncn.
SparseMatrixF * GetSparseMatrix | ( | ) | [virtual] |
Implements ISolver.
Definition at line 392 of file DSSolver.cpp.
References ISolver::Allocated, eMT, m_eState, m_sm, and MathTracer::Writeln().
long Initialize | ( | unsigned char | run_code, | |
eDSSolverType | solverType = eDSSFactorizationLDLT , |
|||
eDSMatrixType | matrixType = eDSSparseMatrix | |||
) | [virtual] |
Implements ISolver.
Definition at line 48 of file DSSolver.cpp.
References Ordering::ApproxMinimumDegree, Ordering::ApproxMinimumDegreeIncomplete, Dispose(), eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eDSSFastCG, eDSSkylineMatrix, eDSSparseMatrix, eMT, ISolver::Initialized, m_eState, MatrixType, None, OrderingType, Ordering::ReverseCuthillMcKee, SolverType, and MathTracer::Writeln().
BOOL IsAllocated | ( | ) | [virtual] |
Implements ISolver.
Definition at line 193 of file DSSolver.cpp.
References ISolver::Allocated, ISolver::Factorized, and m_eState.
Referenced by Factorize(), and ReFactorize().
BOOL IsFactorized | ( | ) | [virtual] |
Implements ISolver.
Definition at line 188 of file DSSolver.cpp.
References ISolver::Factorized, and m_eState.
Referenced by Solve().
BOOL IsInitialized | ( | ) | [virtual] |
BOOL IsSchur | ( | ) | [virtual] |
Definition at line 199 of file DSSolver.cpp.
References m_bIsSchur.
Referenced by condense(), and PreFactorize().
BOOL LoadMatrix | ( | SparseMatrixF * | smt, | |
unsigned char | block_size | |||
) | [virtual] |
Implements ISolver.
Definition at line 154 of file DSSolver.cpp.
References SparseMatrixF::CreateLocalCopy(), m_sm, and SetMatrixPattern().
BOOL LoadMatrix | ( | unsigned long | neq, | |
unsigned char | block_size, | |||
double * | a, | |||
unsigned long * | ci, | |||
unsigned long * | adr | |||
) | [virtual] |
Definition at line 148 of file DSSolver.cpp.
BOOL LoadMCN | ( | IntArrayList & | mcn | ) | [virtual] |
Definition at line 713 of file DSSolver.cpp.
References IntArrayList::Alloc(), blockSize, Array::Copy(), IntArrayList::Count, IntArrayList::Initialize(), IntArrayList::Items, and LoadMCN_int().
BOOL LoadMCN | ( | ULONG | n_blocks, | |
unsigned char | block_size, | |||
long * | mcn, | |||
BOOL | bIsSchur | |||
) | [virtual] |
Implements ISolver.
Definition at line 669 of file DSSolver.cpp.
References IntArrayList::Alloc(), blockSize, Array::Copy(), IntArrayList::Items, LoadMCN_int(), and m_bIsSchur.
BOOL LoadMCN_int | ( | IntArrayList * | mcn_order | ) | [private] |
Definition at line 679 of file DSSolver.cpp.
References IntArrayList::Alloc(), blockSize, IntArrayList::Count, CreateFixedArray(), ExpandMCN(), for(), IntArrayList::Items, mcn, and n_blocks.
Referenced by LoadMCN().
BOOL LoadNumbers | ( | SparseMatrixF * | sm | ) | [virtual] |
Implements ISolver.
Definition at line 344 of file DSSolver.cpp.
References SparseMatrixF::a, ISolver::Allocated, MathTracer::CS(), eMT, SparseMatrixF::IsSamePattern(), m_eState, m_sm, MathTracer::MC_(), MathTracer::Write(), and MathTracer::Writeln().
void LoadZeros | ( | ) | [virtual] |
Implements ISolver.
Definition at line 328 of file DSSolver.cpp.
References ISolver::Allocated, eMT, m_eState, and MathTracer::Writeln().
void MulMatrixByVector | ( | double * | b, | |
double * | c | |||
) | [virtual] |
Implements ISolver.
Definition at line 965 of file DSSolver.cpp.
References eDSSFactorizationLU, eDSSFastCG, m_sm, SparseMatrixF::MulMatrixByVector(), SparseMatrixF::MulNonsymMatrixByVector(), neq, and SolverType.
Referenced by CG(), GetFactorizationError(), and PreCG().
int PreCG | ( | double * | b, | |
double * | x, | |||
double | epsilon, | |||
int | max_iter | |||
) | [virtual] |
Implements ISolver.
Definition at line 984 of file DSSolver.cpp.
References LargeVectorAttach::AddMult(), LargeVectorAttach::DataPtr(), eMT, LargeVectorAttach::InnerProduct(), LargeVectorAttach::LinComb(), MulMatrixByVector(), neq, Solve(), MathTracer::Write(), and MathTracer::Writeln().
BOOL PreFactorize | ( | ) | [virtual] |
Implements ISolver.
Definition at line 267 of file DSSolver.cpp.
References ISolver::Allocated, CreateNewSparseGridMtx(), eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eDSSFastCG, eDSSkylineMatrix, eDSSparseMatrix, eMT, IsSchur(), m_eState, m_sm, matrixPD, MatrixType, neq, SparseMatrixF::neq, PreFactorizeSchur(), SolverType, MathTracer::Write(), and MathTracer::Writeln().
Referenced by Factorize().
BOOL PreFactorizeSchur | ( | ) | [private] |
Definition at line 839 of file DSSolver.cpp.
References ISolver::Allocated, IntArrayList::Count, CreateNewSparseGridMtx(), eMT, fixed, m_eState, matrixPD, mcn, StoreFixedLastPermutation_dom_order(), and MathTracer::Writeln().
Referenced by PreFactorize().
BOOL ReFactorize | ( | ) | [virtual] |
Implements ISolver.
Definition at line 430 of file DSSolver.cpp.
References MathTracer::CS(), eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eDSSFastCG, eMT, ISolver::Factorized, IsAllocated(), m_eState, matrixPD, MathTracer::MC_(), SparseGridMtxPD::SchurComplementFactorization(), SolverType, str, MathTracer::Write(), WriteFactorizationInfo(), MathTracer::Writeln(), and DenseMatrixArithmetics::zero_pivots.
Referenced by Factorize().
BOOL ScaleMatrix | ( | double | alfa | ) | [virtual] |
Implements ISolver.
Definition at line 380 of file DSSolver.cpp.
References ISolver::Allocated, eMT, m_eState, m_sm, SparseMatrixF::ScaleMatrix(), and MathTracer::Writeln().
BOOL SetMatrixPattern | ( | SparseMatrixF * | smt, | |
unsigned char | block_size | |||
) | [virtual] |
Implements ISolver.
Definition at line 161 of file DSSolver.cpp.
References blockSize, LargeVectorAttach::DataPtr(), Dispose(), eDSSDiagonalScaling, eMT, LargeVectorAttach::Init(), ISolver::Initialized, long(), m_eState, m_sm, matrixD, SparseMatrixF::neq, neq, SparseMatrixF::Nonzeros(), SparseMatrixF::ReadDiagonal(), SolverType, str, and MathTracer::Writeln().
Referenced by LoadMatrix().
void SetMT | ( | MathTracer * | pMT | ) | [virtual] |
BOOL SetOrderingType | ( | Ordering::Type | otype | ) | [virtual] |
Implements ISolver.
Definition at line 123 of file DSSolver.cpp.
References Ordering::ApproxMinimumDegree, Ordering::ColAMD, Ordering::CuthillMcKee, eMT, Ordering::MetisND, Ordering::MinimumDegree, Ordering::NestedGraphBisection, None, OrderingType, Ordering::ReverseCuthillMcKee, and MathTracer::Writeln().
void SetSM | ( | SparseMatrixF * | sm | ) |
Definition at line 603 of file DSSolver.cpp.
References m_sm.
BOOL Solve | ( | double * | r, | |
double * | f | |||
) | [virtual] |
Implements ISolver.
Definition at line 481 of file DSSolver.cpp.
References blockSize, Array::Copy(), LargeVectorAttach::DiagonalSolve(), Factorize(), IsFactorized(), IntArrayList::Items, matrixD, mcn, LargeVectorAttach::N(), neq, Ordering::perm, and tmpR.
Referenced by GetFactorizationError(), and PreCG().
void StartSolverWriteInfo | ( | ) |
Definition at line 534 of file DSSolver.cpp.
References eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eMT, MathTracer::NowString(), SolverType, str, MathTracer::Write(), and MathTracer::Writeln().
Referenced by Factorize().
void StoreFixedLastPermutation_dom_order | ( | ) | [private] |
Definition at line 861 of file DSSolver.cpp.
References IntArrayList::Alloc(), Array::Clear(), Array::Copy(), IntArrayList::Count, dom_order, IntArrayList::Items, lncn, m_sm, neq, SparseMatrixF::neq, and p.
Referenced by PreFactorizeSchur().
void WriteFactorizationInfo | ( | ) | [private] |
Definition at line 403 of file DSSolver.cpp.
References eDSSFactorizationLDLT, eDSSFactorizationLDLTIncomplete, eDSSFactorizationLLT, eDSSFactorizationLLTIncomplete, eDSSFactorizationLU, eDSSFastCG, eMT, SolverType, MathTracer::Write(), and MathTracer::Writeln().
Referenced by ReFactorize().
SparseGridMtx* act_matrix [private] |
Definition at line 179 of file DSSolver.h.
unsigned char blockSize [private] |
Definition at line 194 of file DSSolver.h.
Referenced by CreateFixedArray(), CreateNewSparseGridMtx(), DSSolver(), ExpandMCN(), LoadMCN(), LoadMCN_int(), SetMatrixPattern(), and Solve().
IntArrayList* dom_order [private] |
Definition at line 191 of file DSSolver.h.
Referenced by condense(), Dispose(), DSSolver(), and StoreFixedLastPermutation_dom_order().
MathTracer* eMT [private] |
Definition at line 176 of file DSSolver.h.
Referenced by AddNumbers(), CG(), condense(), CreateFixedArray(), CreateNewSparseGridMtx(), DSSolver(), EndSolverWriteInfo(), Factorize(), GetSparseMatrix(), Initialize(), LoadNumbers(), LoadZeros(), PreCG(), PreFactorize(), PreFactorizeSchur(), ReFactorize(), ScaleMatrix(), SetMatrixPattern(), SetMT(), SetOrderingType(), StartSolverWriteInfo(), and WriteFactorizationInfo().
IntArrayList* fixed [private] |
Definition at line 204 of file DSSolver.h.
Referenced by CreateFixedArray(), Dispose(), DSSolver(), ExpandMCN(), GetFixedBlocks(), and PreFactorizeSchur().
IntArrayList* lncn [private] |
Definition at line 205 of file DSSolver.h.
Referenced by condense(), CreateFixedArray(), Dispose(), DSSolver(), GetA12block(), GetFixedDOFs(), and StoreFixedLastPermutation_dom_order().
BOOL m_bIsSchur [private] |
Definition at line 208 of file DSSolver.h.
Referenced by condense(), DSSolver(), IsSchur(), and LoadMCN().
ISolver::eState m_eState [private] |
Definition at line 183 of file DSSolver.h.
Referenced by AddNumbers(), condense(), CreateFixedArray(), DSSolver(), GetSparseMatrix(), Initialize(), IsAllocated(), IsFactorized(), IsInitialized(), LoadNumbers(), LoadZeros(), PreFactorize(), PreFactorizeSchur(), ReFactorize(), ScaleMatrix(), and SetMatrixPattern().
SparseMatrixF m_sm [private] |
Definition at line 178 of file DSSolver.h.
Referenced by AddNumbers(), CreateNewSparseGridMtx(), Factorize(), GetA12block(), GetFactorizationError(), GetSparseMatrix(), LoadMatrix(), LoadNumbers(), MulMatrixByVector(), PreFactorize(), ScaleMatrix(), SetMatrixPattern(), SetSM(), and StoreFixedLastPermutation_dom_order().
SparseGridMtx* matrix [private] |
Definition at line 180 of file DSSolver.h.
LargeVector matrixD [private] |
Definition at line 200 of file DSSolver.h.
Referenced by SetMatrixPattern(), and Solve().
SparseGridMtxPD* matrixPD [private] |
Definition at line 181 of file DSSolver.h.
Referenced by condense(), Dispose(), DSSolver(), PreFactorize(), PreFactorizeSchur(), and ReFactorize().
eDSMatrixType MatrixType [private] |
Definition at line 186 of file DSSolver.h.
Referenced by DSSolver(), Initialize(), and PreFactorize().
Definition at line 197 of file DSSolver.h.
Referenced by condense(), CreateFixedArray(), CreateNewSparseGridMtx(), Dispose(), DSSolver(), LoadMCN_int(), PreFactorizeSchur(), and Solve().
MathTracer MT [private] |
Definition at line 175 of file DSSolver.h.
Referenced by SetMT().
long n_blocks [private] |
Definition at line 195 of file DSSolver.h.
Referenced by CreateNewSparseGridMtx(), DSSolver(), and LoadMCN_int().
long neq [private] |
Definition at line 196 of file DSSolver.h.
Referenced by CG(), condense(), CreateFixedArray(), DSSolver(), GetFactorizationError(), MulMatrixByVector(), PreCG(), PreFactorize(), SetMatrixPattern(), Solve(), and StoreFixedLastPermutation_dom_order().
Ordering::Type OrderingType [private] |
Definition at line 207 of file DSSolver.h.
Referenced by CreateNewSparseGridMtx(), DSSolver(), Initialize(), and SetOrderingType().
SparseGridMtx* orig_matrix [private] |
Definition at line 201 of file DSSolver.h.
Referenced by Dispose(), and DSSolver().
unsigned char run_code [private] |
Definition at line 187 of file DSSolver.h.
Referenced by DSSolver().
eDSSolverType SolverType [private] |
Definition at line 185 of file DSSolver.h.
Referenced by CreateNewSparseGridMtx(), DSSolver(), Initialize(), MulMatrixByVector(), PreFactorize(), ReFactorize(), SetMatrixPattern(), StartSolverWriteInfo(), and WriteFactorizationInfo().
char str[512] [private] |
Definition at line 182 of file DSSolver.h.
Referenced by CreateNewSparseGridMtx(), EndSolverWriteInfo(), Factorize(), ReFactorize(), SetMatrixPattern(), and StartSolverWriteInfo().
double* tmpR [private] |
Definition at line 190 of file DSSolver.h.
Referenced by condense(), CreateNewSparseGridMtx(), Dispose(), DSSolver(), and Solve().