43 MeschachVectorHandler::MeschachVectorHandler(
integer iSize)
51 silent_cerr(
"out of memory?" << std::endl);
58 MeschachVectorHandler::~MeschachVectorHandler(
void)
62 if (v_free(pv) != 0) {
71 MeschachVectorHandler::IsValid(
void)
const
76 ASSERT(pv->max_dim >= pv->dim);
79 ASSERT(pdVecm1 == pv->ve - 1);
84 MeschachVectorHandler::Resize(
integer iNewSize)
91 VEC*
p = v_resize(pv, iNewSize);
93 silent_cerr(
"out of memory?" << std::endl);
113 MeschachSparseMatrixHandler::MeschachSparseMatrixHandler(
integer m,
118 if (m > 0 && n > 0) {
119 Create(m, n, maxlen);
123 MeschachSparseMatrixHandler::~MeschachSparseMatrixHandler(
void)
138 MeschachSparseMatrixHandler::Create(
integer m,
146 mat = sp_resize(
mat, m, n);
149 mat = sp_get(m, n, maxlen ? maxlen : n);
155 MeschachSparseMatrixHandler::IsValid(
void)
const
172 MeschachSparseSolutionManager::Create(
unsigned integer iSize,
177 MeschachVectorHandler,
178 MeschachVectorHandler(iSize));
183 if (pivot == PNULL || pivot->size < iSize) {
184 PERM* p = px_resize(pivot, iSize);
186 silent_cerr(
"out of memory?" << std::endl);
193 && (pmh->iGetNumRows() < (
integer)iSize
194 || pmh->iGetNumCols() < (
integer)iSize)) {
200 MeschachSparseMatrixHandler,
201 MeschachSparseMatrixHandler(iSize,
208 MeschachSparseSolutionManager::Factor(
void)
214 spLUfactor(pmh->pGetMAT(), pivot, alpha);
218 MeschachSparseSolutionManager::MeschachSparseSolutionManager(
integer iSize,
221 : prhs(NULL), pivot(PNULL), pmh(NULL), fStatus(RESET), alpha (a)
223 Create(iSize, iMaxSize);
227 MeschachSparseSolutionManager::~MeschachSparseSolutionManager(
void)
237 if (pivot != PNULL) {
248 MeschachSparseSolutionManager::IsValid(
void)
const
255 ASSERT(prhs->iGetSize() >= pmh->iGetNumCols());
256 ASSERT(pivot->size >= pmh->iGetNumCols());
257 ASSERT(pivot->size >= pmh->iGetNumRows());
262 MeschachSparseSolutionManager::MatrReset(
void)
274 MeschachSparseSolutionManager::Solve(
void)
280 if (fStatus == RESET) {
285 spLUsolve(pmh->pGetMAT(),
287 prhs->pGetMeschachVEC(),
288 prhs->pGetMeschachVEC());
293 MeschachSparseSolutionManager::pMatHdl(
void)
const
304 MeschachSparseSolutionManager::pResHdl(
void)
const
318 MeschachSparseSolutionManager::pSolHdl(
void)
const
328 operator << (std::ostream& out,
const MeschachSparseMatrixHandler& MH)
330 SPMAT* p = MH.pGetMAT();
332 for (
integer j = 0; j < p->n; j++) {
333 silent_cout(std::setw(16) << sp_get_val(p,
i, j));
335 silent_cout(std::endl);
#define MBDYN_EXCEPT_ARGS
void Reset(scalar_func_type &d)
std::ostream & operator<<(std::ostream &out, const FullMatrixHandler &m)
static doublereal mat[5][5]
#define ASSERT(expression)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
static const doublereal a