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

#include <JacSubMatrix.h>

Collaboration diagram for ExpandableMatrix:

Classes

struct  ExpandableColBlock
 

Public Member Functions

 ExpandableMatrix (void)
 
 ExpandableMatrix (const integer n, const integer m)
 
virtual ~ExpandableMatrix (void)
 
void ReDim (const integer n, const integer m)
 
void SetBlockDim (const integer block, const integer ncols)
 
void Zero (void)
 
integer GetNRows () const
 
integer GetNBlocks () const
 
integer GetBlockNCols (const integer block) const
 
void Reset (void)
 
void Link (const integer block, const ExpandableMatrix *const xp)
 
void Link (const integer block, const ExpandableRowVector *const xp)
 
void SetBlockIdx (integer block, integer iidx)
 
void Set (doublereal xx, integer eq, integer block, integer block_col=1)
 
void Set (Vec3 xx, integer eq, integer block, integer block_col=1)
 
void Set (Mat3x3 xx, integer eq, integer block, integer block_col=1)
 
void Add (doublereal xx, integer eq, integer block, integer block_col=1)
 
void Sub (doublereal xx, integer eq, integer block, integer block_col=1)
 
void Add (Vec3 xx, integer eq, integer block, integer block_col=1)
 
void Sub (Vec3 xx, integer eq, integer block, integer block_col=1)
 
void Add (Mat3x3 xx, integer eq, integer block, integer block_col=1)
 
void Sub (Mat3x3 xx, integer eq, integer block, integer block_col=1)
 
void Add (FullSubMatrixHandler &WM, const integer eq, const doublereal c=1.) const
 
void Sub (FullSubMatrixHandler &WM, const integer eq, const doublereal c=1.) const
 
std::ostream & Write (std::ostream &out, const char *sFill="") const
 

Private Member Functions

ExpandableMatrixoperator= (const ExpandableMatrix &)
 
 ExpandableMatrix (const ExpandableMatrix &)
 

Private Attributes

std::vector< ExpandableColBlockv
 

Detailed Description

Definition at line 87 of file JacSubMatrix.h.

Constructor & Destructor Documentation

ExpandableMatrix::ExpandableMatrix ( const ExpandableMatrix )
private
ExpandableMatrix::ExpandableMatrix ( void  )

Definition at line 282 of file JacSubMatrix.cc.

282 {};
ExpandableMatrix::ExpandableMatrix ( const integer  n,
const integer  m 
)

Definition at line 283 of file JacSubMatrix.cc.

References ReDim().

283  {
284  ReDim(n, m);
285 }
void ReDim(const integer n, const integer m)

Here is the call graph for this function:

ExpandableMatrix::~ExpandableMatrix ( void  )
virtual

Definition at line 286 of file JacSubMatrix.cc.

286 {};

Member Function Documentation

void ExpandableMatrix::Add ( doublereal  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 405 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetBlockNCols(), GetNBlocks(), GetNRows(), and v.

Referenced by Add(), and PlaneHingeJoint::AssJac().

405  {
406  ASSERTMSGBREAK(eq > 0, "ExpandableMatrix::Add() underflow");
407  ASSERTMSGBREAK(block > 0, "ExpandableMatrix::Add() underflow");
408  ASSERTMSGBREAK(block_col > 0, "ExpandableMatrix::Add() underflow");
409  ASSERTMSGBREAK(eq <= GetNRows(), "ExpandableRowVector::Add() overflow");
410  ASSERTMSGBREAK(block <= GetNBlocks(), "ExpandableRowVector::Add() overflow");
411  ASSERTMSGBREAK(block_col <= GetBlockNCols(block), "ExpandableRowVector::Add() overflow");
412  v[block - 1].rows[eq - 1].Add(xx, block_col);
413 }
integer GetBlockNCols(const integer block) const
integer GetNRows() const
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static const char * eq[]
Definition: drvdisp.cc:196
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::Add ( Vec3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 423 of file JacSubMatrix.cc.

References Add().

423  {
424  for (integer i = 0; i <3; i++) {
425  Add(xx(i + 1), eq + i, block, block_col);
426  }
427 }
static const char * eq[]
Definition: drvdisp.cc:196
void Add(doublereal xx, integer eq, integer block, integer block_col=1)
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::Add ( Mat3x3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 428 of file JacSubMatrix.cc.

References Add().

428  {
429  for (integer i = 0; i <3; i++) {
430  for (integer ii = 0; ii <3; ii++) {
431  Add(xx(i + 1, ii + 1), eq + i, block, block_col + ii);
432  }
433  }
434 }
static const char * eq[]
Definition: drvdisp.cc:196
void Add(doublereal xx, integer eq, integer block, integer block_col=1)
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::Add ( FullSubMatrixHandler WM,
const integer  eq,
const doublereal  c = 1. 
) const

Definition at line 475 of file JacSubMatrix.cc.

References GetNBlocks(), and v.

477  {
478 // std::cerr << "ExpandableMatrix::Add" << std::endl;
479 // std::cerr << "\teq " << eq << std::endl;
480 // std::cerr << "\tc " << c << std::endl;
481  for (integer block = 0; block < GetNBlocks(); block++) {
482 // std::cerr << "\t\tblock " << block << std::endl;
483  v[block].Add(WM, eq, c);
484  }
485 }
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static const char * eq[]
Definition: drvdisp.cc:196
static std::stack< cleanup * > c
Definition: cleanup.cc:59
long int integer
Definition: colamd.c:51
integer GetNBlocks() const

Here is the call graph for this function:

integer ExpandableMatrix::GetBlockNCols ( const integer  block) const

Definition at line 325 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, and v.

Referenced by Add(), Link(), Set(), and Sub().

325  {
326  ASSERTMSGBREAK(block >= 0, "ExpandableMatrix:GetBlockNCols(), "
327  "block shold be >= 0");
328  ASSERTMSGBREAK((unsigned long)block < v.size(), "ExpandableMatrix:GetBlockNCols(), "
329  "block shold be < nblocks");
330  return v[block].GetBlockNCols();
331 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
integer ExpandableMatrix::GetNBlocks ( ) const

Definition at line 322 of file JacSubMatrix.cc.

References v.

Referenced by Add(), ExpandableMatrix::ExpandableColBlock::Link(), Set(), SetBlockDim(), SetBlockIdx(), Sub(), and Write().

322  {
323  return v.size();
324 };
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
integer ExpandableMatrix::GetNRows ( ) const

Definition at line 315 of file JacSubMatrix.cc.

References v.

Referenced by Add(), Link(), Set(), and Sub().

315  {
316  if (v.begin() != v.end() ) {
317  return v[0].GetBlockNRows();
318  } else {
319  return 0;
320  }
321 };
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
void ExpandableMatrix::Link ( const integer  block,
const ExpandableMatrix *const  xp 
)

Definition at line 340 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetBlockNCols(), GetNRows(), and v.

Referenced by PlaneHingeJoint::AssJac().

340  {
341  ASSERTMSGBREAK(i > 0, "ExpandableMatrix::Link() underflow");
342  ASSERTMSGBREAK(std::vector<ExpandableColBlock>::size_type(i) <= v.size(), "ExpandableMatrix::Link() overflow");
343  //FIXME
344  //ASSERTMSGBREAK(v[i - 1].idx == 0, "ExpandableMatrix::Link() fatal error");
345  ASSERTMSGBREAK(v[i - 1].GetBlockNCols() == xp->GetNRows(),
346  "ExpandableMatrix::Link() dimension mismatch");
347  v[i - 1].Link(xp);
348 }
integer GetBlockNCols(const integer block) const
integer GetNRows() const
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89

Here is the call graph for this function:

void ExpandableMatrix::Link ( const integer  block,
const ExpandableRowVector *const  xp 
)

Definition at line 350 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetBlockNCols(), and v.

350  {
351  ASSERTMSGBREAK(i > 0, "ExpandableMatrix::Link() underflow");
352  ASSERTMSGBREAK(std::vector<ExpandableColBlock>::size_type(i) <= v.size(), "ExpandableMatrix::Link() overflow");
353  //FIXME
354  //ASSERTMSGBREAK(v[i - 1].idx == 0, "ExpandableMatrix::Link() fatal error");
355  ASSERTMSGBREAK(v[i - 1].GetBlockNCols() == 1,
356  "ExpandableMatrix::Link() dimension mismatch");
357  v[i - 1].Link(xp);
358 }
integer GetBlockNCols(const integer block) const
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89

Here is the call graph for this function:

ExpandableMatrix& ExpandableMatrix::operator= ( const ExpandableMatrix )
private
void ExpandableMatrix::ReDim ( const integer  n,
const integer  m 
)

Definition at line 287 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, and v.

Referenced by PlaneHingeJoint::AssJac(), and ExpandableMatrix().

287  {
288  //we have to accept = 0, some elements do ReDim(0,0) (PointForceElement))
289  ASSERTMSGBREAK(n>=0, "ExpandableMatrix:ReDim(), n shold be >= 0");
290  ASSERTMSGBREAK(m>=0, "ExpandableMatrix:ReDim(), m shold be >= 0");
291  v.resize(m, ecb_Zero);
292  for (std::vector<ExpandableColBlock>::iterator i = v.begin(); i != v.end(); ++i) {
293  i->ReDim(n);
294  }
295 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static ExpandableMatrix::ExpandableColBlock ecb_Zero
void ExpandableMatrix::Reset ( void  )

Definition at line 332 of file JacSubMatrix.cc.

References v.

332  {
333  for (std::vector<ExpandableColBlock>::iterator i = v.begin();
334  i != v.end(); ++i)
335  {
336  i->Reset();
337  }
338 }
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
void ExpandableMatrix::Set ( doublereal  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 360 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetBlockNCols(), GetNBlocks(), GetNRows(), and v.

Referenced by PlaneHingeJoint::AssJac(), and Set().

360  {
361  ASSERTMSGBREAK(eq > 0, "ExpandableMatrix::Set() underflow");
362  ASSERTMSGBREAK(block > 0, "ExpandableMatrix::Set() underflow");
363  ASSERTMSGBREAK(block_col > 0, "ExpandableMatrix::Set() underflow");
364  ASSERTMSGBREAK(eq <= GetNRows(), "ExpandableRowVector::Set() overflow");
365  ASSERTMSGBREAK(block <= GetNBlocks(), "ExpandableRowVector::Set() overflow");
366  ASSERTMSGBREAK(block_col <= GetBlockNCols(block), "ExpandableRowVector::Set() overflow");
367  v[block - 1].rows[eq - 1].Set(xx, block_col);
368 }
integer GetBlockNCols(const integer block) const
integer GetNRows() const
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static const char * eq[]
Definition: drvdisp.cc:196
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::Set ( Vec3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 369 of file JacSubMatrix.cc.

References Set().

369  {
370  for (integer i = 0; i <3; i++) {
371  Set(xx(i + 1), eq + i, block, block_col);
372  }
373 }
void Set(doublereal xx, integer eq, integer block, integer block_col=1)
static const char * eq[]
Definition: drvdisp.cc:196
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::Set ( Mat3x3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 374 of file JacSubMatrix.cc.

References Set().

374  {
375  for (integer i = 0; i <3; i++) {
376  for (integer ii = 0; ii <3; ii++) {
377  Set(xx(i + 1, ii + 1), eq + i, block, block_col + ii);
378  }
379  }
380 }
void Set(doublereal xx, integer eq, integer block, integer block_col=1)
static const char * eq[]
Definition: drvdisp.cc:196
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::SetBlockDim ( const integer  block,
const integer  ncols 
)

Definition at line 296 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetNBlocks(), and v.

Referenced by PlaneHingeJoint::AssJac().

296  {
297  ASSERTMSGBREAK(block>0, "ExpandableMatrix:SetBlockDim(), block shold be > 0");
298  ASSERTMSGBREAK(block <= GetNBlocks(), "ExpandableMatrix:SetBlockDim(), block shold be "
299  "<= GetNBlocks()");
300 // std::cerr << "ExpandableMatrix::SetBlockDim(" << block <<", " << ncols << ")" << std::endl;
301  int pippo = 0;
302  for (std::vector<ExpandableRowVector>::iterator i = v[block-1].rows.begin();
303  i != v[block-1].rows.end(); ++i)
304  {
305  pippo++;
306 // std::cerr << "\t" << pippo << std::endl;
307  i->ReDim(ncols);
308  }
309 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::SetBlockIdx ( integer  block,
integer  iidx 
)

Definition at line 381 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetNBlocks(), and v.

381  {
382  ASSERTMSGBREAK(block > 0, "ExpandableMatrix::SetColIdx() underflow");
383  ASSERTMSGBREAK(block <= GetNBlocks(), "ExpandableMatrix::SetColIdx() overflow");
384 // std::cerr << "ExpandableMatrix::SetBlockIdx" << std::endl;
385  v[block - 1].SetColIdx(iidx);
386 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::Sub ( doublereal  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 414 of file JacSubMatrix.cc.

References ASSERTMSGBREAK, GetBlockNCols(), GetNBlocks(), GetNRows(), and v.

Referenced by PlaneHingeJoint::AssJac(), and Sub().

414  {
415  ASSERTMSGBREAK(eq > 0, "ExpandableMatrix::Sub() underflow");
416  ASSERTMSGBREAK(block > 0, "ExpandableMatrix::Sub() underflow");
417  ASSERTMSGBREAK(block_col > 0, "ExpandableMatrix::Sub() underflow");
418  ASSERTMSGBREAK(eq <= GetNRows(), "ExpandableRowVector::Sub() overflow");
419  ASSERTMSGBREAK(block <= GetNBlocks(), "ExpandableRowVector::Sub() overflow");
420  ASSERTMSGBREAK(block_col <= GetBlockNCols(block), "ExpandableRowVector::Sub() overflow");
421  v[block - 1].rows[eq - 1].Sub(xx, block_col);
422 }
integer GetBlockNCols(const integer block) const
integer GetNRows() const
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static const char * eq[]
Definition: drvdisp.cc:196
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::Sub ( Vec3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 435 of file JacSubMatrix.cc.

References Sub().

435  {
436  for (integer i = 0; i <3; i++) {
437  Sub(xx(i + 1), eq + i, block, block_col);
438  }
439 }
void Sub(doublereal xx, integer eq, integer block, integer block_col=1)
static const char * eq[]
Definition: drvdisp.cc:196
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::Sub ( Mat3x3  xx,
integer  eq,
integer  block,
integer  block_col = 1 
)

Definition at line 440 of file JacSubMatrix.cc.

References Sub().

440  {
441  for (integer i = 0; i <3; i++) {
442  for (integer ii = 0; ii <3; ii++) {
443  Sub(xx(i + 1, ii + 1), eq + i, block, block_col + ii);
444  }
445  }
446 }
void Sub(doublereal xx, integer eq, integer block, integer block_col=1)
static const char * eq[]
Definition: drvdisp.cc:196
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void ExpandableMatrix::Sub ( FullSubMatrixHandler WM,
const integer  eq,
const doublereal  c = 1. 
) const

Definition at line 508 of file JacSubMatrix.cc.

References GetNBlocks(), and v.

510  {
511  for (integer block = 0; block < GetNBlocks(); block++) {
512  v[block].Sub(WM, eq, c);
513  }
514 }
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
static const char * eq[]
Definition: drvdisp.cc:196
static std::stack< cleanup * > c
Definition: cleanup.cc:59
long int integer
Definition: colamd.c:51
integer GetNBlocks() const

Here is the call graph for this function:

std::ostream & ExpandableMatrix::Write ( std::ostream &  out,
const char *  sFill = "" 
) const

Definition at line 538 of file JacSubMatrix.cc.

References GetNBlocks(), and v.

Referenced by operator<<().

538  {
539  for (integer block = 0; block < GetNBlocks(); block++) {
540  out << "Block: " << block << std::endl;
541  v[block].Write(out, "\t");
542  }
543  return out;
544 }
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89
long int integer
Definition: colamd.c:51
integer GetNBlocks() const

Here is the call graph for this function:

void ExpandableMatrix::Zero ( void  )

Definition at line 310 of file JacSubMatrix.cc.

References v.

310  {
311  for (std::vector<ExpandableColBlock>::iterator i = v.begin(); i != v.end(); ++i) {
312  i->Zero();
313  }
314 }
std::vector< ExpandableColBlock > v
Definition: JacSubMatrix.h:89

Member Data Documentation


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