MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
DirCColMatrixHandler< off > Class Template Reference

#include <dirccmh.h>

Inheritance diagram for DirCColMatrixHandler< off >:
Collaboration diagram for DirCColMatrixHandler< off >:

Public Member Functions

 DirCColMatrixHandler (std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~DirCColMatrixHandler ()
 
CompactSparseMatrixHandlerCopy (void) const
 
doublerealoperator() (integer i_row, integer i_col)
 
const doublerealoperator() (integer i_row, integer i_col) const
 
void Resize (integer n, integer nn)
 
VectorHandlerGetCol (integer icol, VectorHandler &out) const
 
MatrixHandlerMulAndSumWithShift (MatrixHandler &out, doublereal s=1., integer drow=0, integer dcol=0) const
 
MatrixHandlerFakeThirdOrderMulAndSumWithShift (MatrixHandler &out, std::vector< bool > b, doublereal s=1., integer drow=0, integer dcol=0) const
 
- Public Member Functions inherited from CompactSparseMatrixHandler_tpl< off >
 CompactSparseMatrixHandler_tpl (const integer &n, const integer &nn, std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~CompactSparseMatrixHandler_tpl (void)
 
CompactSparseMatrixHandler_tpl
< off >::const_iterator 
begin (void) const
 
const
CompactSparseMatrixHandler_tpl
< off >::const_iterator
end (void) const
 
- Public Member Functions inherited from CompactSparseMatrixHandler
 CompactSparseMatrixHandler (const integer &n, const integer &nn, std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~CompactSparseMatrixHandler ()
 
void AddUnchecked (const CompactSparseMatrixHandler &m)
 
virtual const doublerealpdGetMat (void) const
 
void Reset (void)
 
virtual integer MakeCompressedColumnForm (doublereal *const Ax, integer *const Ai, integer *const Ap, int offset=0) const
 
virtual integer MakeCompressedColumnForm (std::vector< doublereal > &Ax, std::vector< integer > &Ai, std::vector< integer > &Ap, int offset=0) const
 
virtual integer MakeIndexForm (doublereal *const Ax, integer *const Arow, integer *const Acol, integer *const AcolSt, int offset=0) const
 
virtual integer MakeIndexForm (std::vector< doublereal > &Ax, std::vector< integer > &Arow, std::vector< integer > &Acol, std::vector< integer > &AcolSt, int offset=0) const
 
- Public Member Functions inherited from SparseMatrixHandler
const integer Nz () const
 
 SparseMatrixHandler (const integer &n, const integer &nn=0)
 
virtual ~SparseMatrixHandler (void)
 
integer iGetNumRows (void) const
 
integer iGetNumCols (void) const
 
- Public Member Functions inherited from MatrixHandler
virtual ~MatrixHandler (void)
 
virtual void ResizeReset (integer, integer)
 
virtual doublerealpdGetMat (void)
 
virtual integerpiGetRows (void) const
 
virtual integerpiGetCols (void) const
 
virtual integer PacMat (void)
 
virtual void PutCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual void IncCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual void DecCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual const doublerealdGetCoef (integer iRow, integer iCol) const
 
virtual MatrixHandleroperator= (const MatrixHandler &MH)
 
virtual MatrixHandleroperator+= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator+= (const VariableSubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const VariableSubMatrixHandler &SubMH)
 
virtual MatrixHandlerScalarMul (const doublereal &d)
 
virtual MatrixHandlerMatMatMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatMatIncMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatIncMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatMatDecMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatDecMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual VectorHandlerMatVecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatVecIncMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecIncMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatVecDecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecDecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual doublereal ConditionNumber (enum Norm_t eNorm=NORM_1) const
 
virtual doublereal Norm (enum Norm_t eNorm=NORM_1) const
 

Private Member Functions

 DirCColMatrixHandler (const DirCColMatrixHandler &)
 

Private Attributes

std::vector< integer * > pindices
 
std::vector< integerindices
 

Additional Inherited Members

- Public Types inherited from MatrixHandler
enum  Norm_t { NORM_1, NORM_INF }
 
- Protected Member Functions inherited from CompactSparseMatrixHandler_tpl< off >
MatrixHandlerMatMatMul_base (void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
 
MatrixHandlerMatTMatMul_base (void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
 
virtual VectorHandlerMatVecMul_base (void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecMul_base (void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
 
- Protected Attributes inherited from CompactSparseMatrixHandler_tpl< off >
CompactSparseMatrixHandler_tpl
< off >::const_iterator 
m_end
 
- Protected Attributes inherited from CompactSparseMatrixHandler
bool bMatDuplicate
 
std::vector< doublereal > & Ax
 
const std::vector< integer > & Ai
 
const std::vector< integer > & Ap
 
- Protected Attributes inherited from SparseMatrixHandler
integer NRows
 
integer NCols
 
integer NZ
 

Detailed Description

template<int off>
class DirCColMatrixHandler< off >

Definition at line 46 of file dirccmh.h.

Constructor & Destructor Documentation

template<int off>
DirCColMatrixHandler< off >::DirCColMatrixHandler ( const DirCColMatrixHandler< off > &  )
private
template<int off>
DirCColMatrixHandler< off >::DirCColMatrixHandler ( std::vector< doublereal > &  x,
const std::vector< integer > &  i,
const std::vector< integer > &  p 
)

Definition at line 41 of file dirccmh.cc.

References SparseMatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), DirCColMatrixHandler< off >::indices, and DirCColMatrixHandler< off >::pindices.

44 : CompactSparseMatrixHandler_tpl<off>(p.size() - 1, p.size() - 1, x, i, p),
47 {
48  for (integer col = 1; col <= SparseMatrixHandler::iGetNumCols(); col++) {
49  pindices[col] = &indices[(col - 1)*SparseMatrixHandler::iGetNumRows()] - 1;
50 
51  integer row_begin = p[col - 1] - off, row_end = p[col] - off;
52 
53  for (integer r = row_begin; r < row_end; r++) {
54  pindices[col][i[r] - off + 1] = r;
55  }
56  }
57 }
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
std::vector< integer * > pindices
Definition: dirccmh.h:53
std::vector< integer > indices
Definition: dirccmh.h:54
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
DirCColMatrixHandler< off >::~DirCColMatrixHandler ( )
virtual

Definition at line 60 of file dirccmh.cc.

References NO_OP.

61 {
62  NO_OP;
63 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

template<int off>
CompactSparseMatrixHandler * DirCColMatrixHandler< off >::Copy ( void  ) const
virtual

Implements CompactSparseMatrixHandler.

Definition at line 69 of file dirccmh.cc.

References CompactSparseMatrixHandler::bMatDuplicate.

70 {
71  std::vector<doublereal> *pax =
72  new std::vector<doublereal>(CompactSparseMatrixHandler_tpl<off>::Ax);
76  p->bMatDuplicate = true;
77 
78  return p;
79 }
template<int off>
MatrixHandler & DirCColMatrixHandler< off >::FakeThirdOrderMulAndSumWithShift ( MatrixHandler out,
std::vector< bool b,
doublereal  s = 1.,
integer  drow = 0,
integer  dcol = 0 
) const

Definition at line 145 of file dirccmh.cc.

References SparseMatrixHandler::iGetNumCols(), MatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), MatrixHandler::iGetNumRows(), MatrixHandler::IncCoef(), and MBDYN_EXCEPT_ARGS.

150 {
151  silent_cerr("DirCColMatrixHandler<off>::FakeThirdOrderMulAndSumWithShift "
152  "called" << std::endl);
154  if ((out.iGetNumCols() < SparseMatrixHandler::iGetNumCols() + dcol)
155  || (out.iGetNumRows() < SparseMatrixHandler::iGetNumRows() + drow))
156  {
157  silent_cerr("Assertion fault "
158  "in DirCColMatrixHandler<off>::MulAndSumWithShift"
159  << std::endl);
161  }
162  drow = drow + 1;
163  for (integer col = 0; col < SparseMatrixHandler::iGetNumCols(); col++) {
165  integer idxe = CompactSparseMatrixHandler_tpl<off>::Ap[col + 1] - off;
166  integer newcol = col + dcol + 1;
167  for (; idx < idxe; idx++) {
168  if (b[CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off]) {
169  out.IncCoef(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + drow,
171  }
172  }
173  }
174  return out;
175 }
virtual integer iGetNumCols(void) const =0
virtual void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: mh.cc:374
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
VectorHandler & DirCColMatrixHandler< off >::GetCol ( integer  icol,
VectorHandler out 
) const
virtual

Implements SparseMatrixHandler.

Definition at line 92 of file dirccmh.cc.

References SparseMatrixHandler::iGetNumCols(), and MBDYN_EXCEPT_ARGS.

93 {
94  /*
95  * Note: we assume out has been reset
96  */
97 
98  if (icol > SparseMatrixHandler::iGetNumCols()) {
100  }
101 
102  integer idx = CompactSparseMatrixHandler_tpl<off>::Ap[icol - 1] - off;
104 
105  for ( ; idx < idxe; idx++) {
106  out(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + 1) =
108  }
109 
110  return out;
111 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
MatrixHandler & DirCColMatrixHandler< off >::MulAndSumWithShift ( MatrixHandler out,
doublereal  s = 1.,
integer  drow = 0,
integer  dcol = 0 
) const

Definition at line 116 of file dirccmh.cc.

References SparseMatrixHandler::iGetNumCols(), MatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), MatrixHandler::iGetNumRows(), MatrixHandler::IncCoef(), and MBDYN_EXCEPT_ARGS.

118 {
119  silent_cerr("DirCColMatrixHandler<off>::MulAndSumWithShift called"
120  << std::endl);
122  if ((out.iGetNumCols() < SparseMatrixHandler::iGetNumCols() + dcol)
123  || (out.iGetNumRows() < SparseMatrixHandler::iGetNumRows() + drow))
124  {
125  silent_cerr("Assertion fault "
126  "in DirCColMatrixHandler<off>::MulAndSumWithShift"
127  << std::endl);
129  }
130  drow = drow + 1;
131  for (integer col = 0; col < SparseMatrixHandler::iGetNumCols(); col++) {
134  integer newcol = col + dcol + 1;
135  for (; idx < idxe; idx++) {
136  out.IncCoef(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + drow,
138  }
139  }
140  return out;
141 }
virtual integer iGetNumCols(void) const =0
virtual void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: mh.cc:374
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
doublereal& DirCColMatrixHandler< off >::operator() ( integer  i_row,
integer  i_col 
)
inlinevirtual

Implements MatrixHandler.

Definition at line 71 of file dirccmh.h.

References ASSERTMSGBREAK, SparseMatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), MBDYN_EXCEPT_ARGS, and DirCColMatrixHandler< off >::pindices.

71  {
72  ASSERTMSGBREAK(i_row > 0 && i_row <= SparseMatrixHandler::iGetNumRows(),
73  "Error in CColMatrixHandler::operator(), "
74  "row index out of range");
75  ASSERTMSGBREAK(i_col > 0 && i_col <= SparseMatrixHandler::iGetNumCols(),
76  "Error in CColMatrixHandler::operator(), "
77  "col index out of range");
78 
79  integer idx = pindices[i_col][i_row];
80  if (idx == -1) {
81  /* matrix must be rebuilt */
83  }
84 
86  };
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
std::vector< integer * > pindices
Definition: dirccmh.h:53
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
const doublereal& DirCColMatrixHandler< off >::operator() ( integer  i_row,
integer  i_col 
) const
inlinevirtual

Implements MatrixHandler.

Definition at line 88 of file dirccmh.h.

References ASSERTMSGBREAK, SparseMatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), DirCColMatrixHandler< off >::pindices, and Zero1.

88  {
89  ASSERTMSGBREAK(i_row > 0 && i_row <= SparseMatrixHandler::iGetNumRows(),
90  "Error in CColMatrixHandler::operator(), "
91  "row index out of range");
92  ASSERTMSGBREAK(i_col > 0 && i_col <= SparseMatrixHandler::iGetNumCols(),
93  "Error in CColMatrixHandler::operator(), "
94  "col index out of range");
95 
96  integer idx = pindices[i_col][i_row];
97  if (idx == -1) {
98  /* matrix must be rebuilt */
100 
101  }
102 
104  };
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
const doublereal Zero1
std::vector< integer * > pindices
Definition: dirccmh.h:53
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
void DirCColMatrixHandler< off >::Resize ( integer  n,
integer  nn 
)
virtual

Implements MatrixHandler.

Definition at line 83 of file dirccmh.cc.

References MBDYN_EXCEPT_ARGS.

84 {
85  silent_cerr("DirCColMatrixHandler<off>::Resize called" << std::endl);
87 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63

Member Data Documentation

template<int off>
std::vector<integer> DirCColMatrixHandler< off >::indices
private

Definition at line 54 of file dirccmh.h.

Referenced by DirCColMatrixHandler< off >::DirCColMatrixHandler().

template<int off>
std::vector<integer *> DirCColMatrixHandler< off >::pindices
private

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