MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NaiveSolver Class Reference

#include <naivewrap.h>

Inheritance diagram for NaiveSolver:
Collaboration diagram for NaiveSolver:

Public Member Functions

 NaiveSolver (const integer &size, const doublereal &dMP, NaiveMatrixHandler *const a=0)
 
 ~NaiveSolver (void)
 
void SetMat (NaiveMatrixHandler *const a)
 
void Reset (void)
 
void Solve (void) const
 
- Public Member Functions inherited from LinearSolver
 LinearSolver (SolutionManager *pSM=NULL)
 
virtual ~LinearSolver (void)
 
virtual void SolveT (void) const
 
bool bReset (void) const
 
void SetSolutionManager (SolutionManager *pSM)
 
doublerealpdGetResVec (void) const
 
doublerealpdGetSolVec (void) const
 
doublerealpdSetResVec (doublereal *pd)
 
doublerealpdSetSolVec (doublereal *pd)
 
virtual void MakeCompactForm (SparseMatrixHandler &mh, std::vector< doublereal > &Ax, std::vector< integer > &Ar, std::vector< integer > &Ac, std::vector< integer > &Ap) const
 
virtual bool bGetConditionNumber (doublereal &dCond)
 

Private Member Functions

void Factor (void) throw (LinearSolver::ErrFactor)
 

Private Attributes

integer iSize
 
doublereal dMinPiv
 
std::vector< integerpiv
 
NaiveMatrixHandlerA
 

Additional Inherited Members

- Protected Attributes inherited from LinearSolver
SolutionManagerpSM
 
bool bHasBeenReset
 
doublerealpdRhs
 
doublerealpdSol
 

Detailed Description

Definition at line 52 of file naivewrap.h.

Constructor & Destructor Documentation

NaiveSolver::NaiveSolver ( const integer size,
const doublereal dMP,
NaiveMatrixHandler *const  a = 0 
)

Definition at line 52 of file naivewrap.cc.

References NO_OP.

54 : LinearSolver(0),
55 iSize(size),
56 dMinPiv(dMP < 0 ? 0 : dMP),
57 piv(size),
58 A(a)
59 {
60  NO_OP;
61 }
#define NO_OP
Definition: myassert.h:74
NaiveMatrixHandler * A
Definition: naivewrap.h:57
doublereal dMinPiv
Definition: naivewrap.h:55
std::vector< integer > piv
Definition: naivewrap.h:56
LinearSolver(SolutionManager *pSM=NULL)
Definition: ls.cc:46
integer iSize
Definition: naivewrap.h:54
NaiveSolver::~NaiveSolver ( void  )

Definition at line 63 of file naivewrap.cc.

References NO_OP.

64 {
65  NO_OP;
66 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void NaiveSolver::Factor ( void  )
throw (LinearSolver::ErrFactor
)
private

Definition at line 109 of file naivewrap.cc.

References A, dMinPiv, iSize, MBDYN_EXCEPT_ARGS, NAIVE_ENOPIV, NAIVE_ENULCOL, NAIVE_ERANGE, NAIVE_MASK, NAIVE_MAX, naivfct(), NaiveMatrixHandler::piNzc, NaiveMatrixHandler::piNzr, piv, NaiveMatrixHandler::ppdRows, NaiveMatrixHandler::ppiCols, NaiveMatrixHandler::ppiRows, and NaiveMatrixHandler::ppnonzero.

Referenced by Solve().

111 {
112  integer rc = naivfct(A->ppdRows, iSize,
113  A->piNzr, A->ppiRows,
114  A->piNzc, A->ppiCols,
115  A->ppnonzero,
116  &piv[0], dMinPiv);
117 
118  integer err = (rc & NAIVE_MASK);
119  if (err) {
120  integer idx = (rc & NAIVE_MAX);
121  switch (err) {
122  case NAIVE_ENULCOL:
123  silent_cerr("NaiveSolver: ENULCOL(" << idx << ")"
124  << std::endl);
126 
127  case NAIVE_ENOPIV:
128  silent_cerr("NaiveSolver: ENOPIV(" << idx << ")"
129  << std::endl);
131 
132  case NAIVE_ERANGE:
133  silent_cerr("NaiveSolver: ERANGE"
134  << std::endl);
135  break;
136 
137  default:
138  silent_cerr("NaiveSolver: (" << rc << ")"
139  << std::endl);
140  break;
141  }
142 
144  }
145 }
doublereal ** ppdRows
Definition: naivemh.h:60
integer * piNzr
Definition: naivemh.h:63
#define NAIVE_MAX
Definition: mthrdslv.h:71
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer ** ppiRows
Definition: naivemh.h:61
integer * piNzc
Definition: naivemh.h:63
char ** ppnonzero
Definition: naivemh.h:62
NaiveMatrixHandler * A
Definition: naivewrap.h:57
int naivfct(RMAT a, integer neq, integer *nzr, IMAT ri, integer *nzc, IMAT ci, NZMAT nz, integer *piv, doublereal minpiv)
Definition: mthrdslv.c:76
doublereal dMinPiv
Definition: naivewrap.h:55
#define NAIVE_ERANGE
Definition: mthrdslv.h:75
integer ** ppiCols
Definition: naivemh.h:61
#define NAIVE_ENOPIV
Definition: mthrdslv.h:74
std::vector< integer > piv
Definition: naivewrap.h:56
#define NAIVE_ENULCOL
Definition: mthrdslv.h:73
long int integer
Definition: colamd.c:51
#define NAIVE_MASK
Definition: mthrdslv.h:70
integer iSize
Definition: naivewrap.h:54

Here is the call graph for this function:

void NaiveSolver::Reset ( void  )
virtual

Reimplemented from LinearSolver.

Definition at line 75 of file naivewrap.cc.

References LinearSolver::bHasBeenReset.

76 {
77  bHasBeenReset = true;
78 }
bool bHasBeenReset
Definition: ls.h:73
void NaiveSolver::SetMat ( NaiveMatrixHandler *const  a)

Definition at line 69 of file naivewrap.cc.

References A, and a.

70 {
71  A = a;
72 }
NaiveMatrixHandler * A
Definition: naivewrap.h:57
static const doublereal a
Definition: hfluid_.h:289
void NaiveSolver::Solve ( void  ) const
virtual

Implements LinearSolver.

Definition at line 81 of file naivewrap.cc.

References A, LinearSolver::bHasBeenReset, Factor(), iSize, MBDYN_EXCEPT_ARGS, NAIVE_ERANGE, NAIVE_MASK, naivslv(), LinearSolver::pdRhs, LinearSolver::pdSol, NaiveMatrixHandler::piNzc, piv, NaiveMatrixHandler::ppdRows, and NaiveMatrixHandler::ppiCols.

82 {
83  if (bHasBeenReset) {
84  const_cast<NaiveSolver *>(this)->Factor();
85  bHasBeenReset = false;
86  }
87 
90  integer err = (rc & NAIVE_MASK);
91  if (err) {
92  switch (err) {
93  case NAIVE_ERANGE:
94  silent_cerr("NaiveSolver: ERANGE"
95  << std::endl);
96  break;
97 
98  default:
99  silent_cerr("NaiveSolver: (" << rc << ")"
100  << std::endl);
101  break;
102  }
103 
105  }
106 }
doublereal ** ppdRows
Definition: naivemh.h:60
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bHasBeenReset
Definition: ls.h:73
integer * piNzc
Definition: naivemh.h:63
NaiveMatrixHandler * A
Definition: naivewrap.h:57
#define NAIVE_ERANGE
Definition: mthrdslv.h:75
integer ** ppiCols
Definition: naivemh.h:61
void Factor(void)
Definition: naivewrap.cc:109
doublereal * pdSol
Definition: ls.h:75
std::vector< integer > piv
Definition: naivewrap.h:56
doublereal * pdRhs
Definition: ls.h:74
long int integer
Definition: colamd.c:51
#define NAIVE_MASK
Definition: mthrdslv.h:70
integer iSize
Definition: naivewrap.h:54
int naivslv(RMAT a, integer neq, integer *nzc, IMAT ci, doublereal *rhs, doublereal *sol, integer *piv)
Definition: mthrdslv.c:190

Here is the call graph for this function:

Member Data Documentation

NaiveMatrixHandler* NaiveSolver::A
private

Definition at line 57 of file naivewrap.h.

Referenced by Factor(), SetMat(), and Solve().

doublereal NaiveSolver::dMinPiv
private

Definition at line 55 of file naivewrap.h.

Referenced by Factor().

integer NaiveSolver::iSize
private

Definition at line 54 of file naivewrap.h.

Referenced by Factor(), and Solve().

std::vector<integer> NaiveSolver::piv
mutableprivate

Definition at line 56 of file naivewrap.h.

Referenced by Factor(), and Solve().


The documentation for this class was generated from the following files: