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

#include <matvec3n.h>

Collaboration diagram for MatNxN:

Public Member Functions

 MatNxN (void)
 
 MatNxN (integer ns)
 
 MatNxN (integer ns, const doublereal &d)
 
 ~MatNxN (void)
 
integer iGetNumRows (void) const
 
integer iGetNumCols (void) const
 
void Reset (const doublereal d=0.)
 
void Put (integer i, integer j, const doublereal &d)
 
void Add (integer i, integer j, const doublereal &d)
 
void Sub (integer i, integer j, const doublereal &d)
 
const doublerealdGet (integer i, integer j) const
 
const MatNxNCopy (const MatNxN &m)
 
const MatNxNMult (const MatNx3 &m, const Mat3xN &n)
 
doublerealoperator() (integer i, integer j)
 
const doublerealoperator() (integer i, integer j) const
 

Protected Member Functions

void Create_ (integer ns)
 
void Destroy_ (void)
 

Protected Attributes

integer iMaxRows
 
integer iNumRows
 
doublerealpdVec
 
doublereal ** pdMat
 

Private Member Functions

 MatNxN (const MatNxN &)
 
const MatNxNoperator= (const MatNxN &)
 

Friends

class Mat3xN
 
class MatNx3
 
class VecN
 
std::ostream & operator<< (std::ostream &, const MatNxN &)
 

Detailed Description

Definition at line 514 of file matvec3n.h.

Constructor & Destructor Documentation

MatNxN::MatNxN ( const MatNxN )
private
MatNxN::MatNxN ( void  )

Definition at line 956 of file matvec3n.cc.

References NO_OP.

957 : iMaxRows(0), iNumRows(0), pdVec(NULL), pdMat(NULL)
958 {
959  NO_OP;
960 }
integer iMaxRows
Definition: matvec3n.h:527
#define NO_OP
Definition: myassert.h:74
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
doublereal * pdVec
Definition: matvec3n.h:529
MatNxN::MatNxN ( integer  ns)

Definition at line 963 of file matvec3n.cc.

References Create_().

964 : iMaxRows(ns), iNumRows(ns), pdVec(NULL), pdMat(NULL)
965 {
966  Create_(ns);
967 #ifdef DEBUG
968  IsValid();
969 #endif /* DEBUG */
970 }
integer iMaxRows
Definition: matvec3n.h:527
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
void Create_(integer ns)
Definition: matvec3n.cc:928
doublereal * pdVec
Definition: matvec3n.h:529

Here is the call graph for this function:

MatNxN::MatNxN ( integer  ns,
const doublereal d 
)

Definition at line 973 of file matvec3n.cc.

References Create_(), and Reset().

974 : iMaxRows(ns), iNumRows(ns), pdVec(NULL), pdMat(NULL)
975 {
976  Create_(ns);
977  Reset(d);
978 }
integer iMaxRows
Definition: matvec3n.h:527
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
void Create_(integer ns)
Definition: matvec3n.cc:928
void Reset(const doublereal d=0.)
Definition: matvec3n.cc:986
doublereal * pdVec
Definition: matvec3n.h:529

Here is the call graph for this function:

MatNxN::~MatNxN ( void  )

Definition at line 981 of file matvec3n.cc.

References Destroy_().

982 {
983  Destroy_();
984 }
void Destroy_(void)
Definition: matvec3n.cc:944

Here is the call graph for this function:

Member Function Documentation

void MatNxN::Add ( integer  i,
integer  j,
const doublereal d 
)
inline

Definition at line 589 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

590 {
591 #ifdef DEBUG
592  IsValid();
593 #endif /* DEBUG */
594  ASSERT(i > 0 && i <= iNumRows);
595  ASSERT(j > 0 && j <= iNumRows);
596  pdMat[--j][--i] += d;
597 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
const MatNxN & MatNxN::Copy ( const MatNxN m)

Definition at line 997 of file matvec3n.cc.

References ASSERT, c, iMaxRows, iNumRows, and pdMat.

998 {
999 #ifdef DEBUG
1000  m.IsValid();
1001 #endif /* DEBUG */
1002  ASSERT(iMaxRows >= m.iNumRows);
1003  iNumRows = m.iNumRows;
1004 
1005  for (integer c = 0; c < iNumRows; c++) {
1006 #ifdef HAVE_MEMCPY
1007  memcpy(pdMat[c], m.pdMat[c], sizeof(doublereal)*iNumRows);
1008 #else // ! HAVE_MEMCPY
1009  for (integer r = 0; r < iNumRows; r++) {
1010  pdMat[c][r] = m.pdMat[c][r];
1011  }
1012 #endif // ! HAVE_MEMCPY
1013  }
1014  return *this;
1015 }
integer iMaxRows
Definition: matvec3n.h:527
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
static std::stack< cleanup * > c
Definition: cleanup.cc:59
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
void MatNxN::Create_ ( integer  ns)
protected

Definition at line 928 of file matvec3n.cc.

References ASSERT, Destroy_(), pdMat, pdVec, and SAFENEWARR.

Referenced by MatNxN().

929 {
930  ASSERT(ns > 0);
931  if (pdVec != NULL) {
932  Destroy_();
933  }
934  SAFENEWARR(pdVec, doublereal, ns*ns);
935  SAFENEWARR(pdMat, doublereal*, ns);
936 
937  pdMat[0] = pdVec;
938  for (integer i = 1; i < ns; i++) {
939  pdMat[i] = pdMat[i-1]+ns;
940  }
941 }
doublereal ** pdMat
Definition: matvec3n.h:530
void Destroy_(void)
Definition: matvec3n.cc:944
#define ASSERT(expression)
Definition: colamd.c:977
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
double doublereal
Definition: colamd.c:52
doublereal * pdVec
Definition: matvec3n.h:529
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void MatNxN::Destroy_ ( void  )
protected

Definition at line 944 of file matvec3n.cc.

References pdMat, pdVec, and SAFEDELETEARR.

Referenced by Create_(), and ~MatNxN().

945 {
946  if (pdVec != NULL) {
948  }
949 
950  if (pdMat != NULL) {
952  }
953 }
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
doublereal ** pdMat
Definition: matvec3n.h:530
doublereal * pdVec
Definition: matvec3n.h:529
const doublereal & MatNxN::dGet ( integer  i,
integer  j 
) const
inline

Definition at line 612 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

Referenced by Modal::AssJac(), Modal::InitialAssJac(), Modal::InitialAssRes(), and ReadModal().

613 {
614 #ifdef DEBUG
615  IsValid();
616 #endif /* DEBUG */
617  ASSERT(i > 0 && i <= iNumRows);
618  ASSERT(j > 0 && j <= iNumRows);
619  return pdMat[--j][--i];
620 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
integer MatNxN::iGetNumCols ( void  ) const
inline

Definition at line 570 of file matvec3n.h.

References iNumRows.

Referenced by grad::MatNxNDirectExpr::bHaveReferenceTo(), grad::MatNxNDirectExpr::iGetNumCols(), MatNxN_test(), MatNxN_test_grad(), MatNxNT_test_grad(), and grad::operator*().

571 {
572 #ifdef DEBUG
573  IsValid();
574 #endif /* DEBUG */
575  return iNumRows;
576 }
integer iNumRows
Definition: matvec3n.h:528
integer MatNxN::iGetNumRows ( void  ) const
inline

Definition at line 562 of file matvec3n.h.

References iNumRows.

Referenced by grad::MatNxNDirectExpr::bHaveReferenceTo(), grad::MatNxNDirectExpr::iGetNumRows(), MatNxN_test(), MatNxN_test_grad(), and MatNxNT_test_grad().

563 {
564 #ifdef DEBUG
565  IsValid();
566 #endif /* DEBUG */
567  return iNumRows;
568 }
integer iNumRows
Definition: matvec3n.h:528
const MatNxN & MatNxN::Mult ( const MatNx3 m,
const Mat3xN n 
)

Definition at line 1017 of file matvec3n.cc.

References ASSERT, Mat3xN::iNumCols, MatNx3::iNumRows, iNumRows, MatNx3::pdCols, pdMat, and Mat3xN::pdRows.

Referenced by Modal::InitialAssJac(), and ModuleNonsmoothNode::mbs_get_force().

1018 {
1019 #ifdef DEBUG
1020  IsValid();
1021  n.IsValid();
1022  m.IsValid();
1023 #endif /* DEBUG */
1024 
1025  ASSERT(m.iNumRows == iNumRows);
1026  ASSERT(m.iNumRows == n.iNumCols);
1027 
1028  for (integer i = 0; i < iNumRows; i++) {
1029  for (integer j = 0; j < iNumRows; j++) {
1030  pdMat[j][i] =
1031  m.pdCols[0][i]*n.pdRows[0][j]
1032  + m.pdCols[1][i]*n.pdRows[1][j]
1033  + m.pdCols[2][i]*n.pdRows[2][j];
1034  }
1035  }
1036 
1037  return *this;
1038 }
integer iNumRows
Definition: matvec3n.h:528
integer iNumCols
Definition: matvec3n.h:235
doublereal ** pdMat
Definition: matvec3n.h:530
doublereal * pdRows[3]
Definition: matvec3n.h:236
#define ASSERT(expression)
Definition: colamd.c:977
doublereal * pdCols[3]
Definition: matvec3n.h:389
long int integer
Definition: colamd.c:51
integer iNumRows
Definition: matvec3n.h:388
doublereal & MatNxN::operator() ( integer  i,
integer  j 
)
inline

Definition at line 623 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

624 {
625 #ifdef DEBUG
626  IsValid();
627 #endif /* DEBUG */
628  ASSERT(i > 0 && i <= iNumRows);
629  ASSERT(j > 0 && j <= iNumRows);
630  return pdMat[--j][--i];
631 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
const doublereal & MatNxN::operator() ( integer  i,
integer  j 
) const
inline

Definition at line 634 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

635 {
636 #ifdef DEBUG
637  IsValid();
638 #endif /* DEBUG */
639  ASSERT(i > 0 && i <= iNumRows);
640  ASSERT(j > 0 && j <= iNumRows);
641  return pdMat[--j][--i];
642 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
const MatNxN& MatNxN::operator= ( const MatNxN )
private
void MatNxN::Put ( integer  i,
integer  j,
const doublereal d 
)
inline

Definition at line 578 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

Referenced by ReadModal().

579 {
580 #ifdef DEBUG
581  IsValid();
582 #endif /* DEBUG */
583  ASSERT(i > 0 && i <= iNumRows);
584  ASSERT(j > 0 && j <= iNumRows);
585  pdMat[--j][--i] = d;
586 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977
void MatNxN::Reset ( const doublereal  d = 0.)

Definition at line 986 of file matvec3n.cc.

References iNumRows, and pdVec.

Referenced by MatNxN().

987 {
988 #ifdef DEBUG
989  IsValid();
990 #endif /* DEBUG */
991  for (integer i = iNumRows*iNumRows; i-- > 0; ) {
992  pdVec[i] = d;
993  }
994 }
integer iNumRows
Definition: matvec3n.h:528
doublereal * pdVec
Definition: matvec3n.h:529
long int integer
Definition: colamd.c:51
void MatNxN::Sub ( integer  i,
integer  j,
const doublereal d 
)
inline

Definition at line 600 of file matvec3n.h.

References ASSERT, iNumRows, and pdMat.

601 {
602 #ifdef DEBUG
603  IsValid();
604 #endif /* DEBUG */
605  ASSERT(i > 0 && i <= iNumRows);
606  ASSERT(j > 0 && j <= iNumRows);
607  pdMat[--j][--i] -= d;
608 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
#define ASSERT(expression)
Definition: colamd.c:977

Friends And Related Function Documentation

friend class Mat3xN
friend

Definition at line 515 of file matvec3n.h.

friend class MatNx3
friend

Definition at line 516 of file matvec3n.h.

std::ostream& operator<< ( std::ostream &  ,
const MatNxN  
)
friend

Definition at line 1041 of file matvec3n.cc.

1042 {
1043  for (integer r = 0; r < m.iNumRows; r++) {
1044  for (integer c = 0; c < m.iNumRows; c++) {
1045  out << " " << m.pdMat[c][r];
1046  }
1047  out << std::endl;
1048  }
1049 
1050  return out;
1051 }
integer iNumRows
Definition: matvec3n.h:528
doublereal ** pdMat
Definition: matvec3n.h:530
static std::stack< cleanup * > c
Definition: cleanup.cc:59
long int integer
Definition: colamd.c:51
friend class VecN
friend

Definition at line 517 of file matvec3n.h.

Member Data Documentation

integer MatNxN::iMaxRows
protected

Definition at line 527 of file matvec3n.h.

Referenced by Copy().

integer MatNxN::iNumRows
protected
doublereal** MatNxN::pdMat
protected

Definition at line 530 of file matvec3n.h.

Referenced by Add(), Copy(), Create_(), Destroy_(), dGet(), VecN::Mult(), Mult(), operator()(), operator<<(), Put(), and Sub().

doublereal* MatNxN::pdVec
protected

Definition at line 529 of file matvec3n.h.

Referenced by Create_(), Destroy_(), and Reset().


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