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

#include <matvec3n.h>

Collaboration diagram for VecN:

Public Member Functions

 VecN (void)
 
 VecN (integer ns)
 
 VecN (integer ns, const doublereal &d)
 
 VecN (const VecN &)
 
 VecN (const VectorHandler &vh, integer ns, integer iFirstIndex)
 
 ~VecN (void)
 
integer iGetNumRows (void) const
 
void Resize (integer ns)
 
void Reset (const doublereal d=0.)
 
void Put (integer i, const doublereal &d)
 
void Add (integer i, const doublereal &d)
 
void Sub (integer i, const doublereal &d)
 
const doublerealdGet (integer i) const
 
const VecNCopy (const VectorHandler &vh, integer iFirstIndex=1)
 
const doublerealpGetVec (void) const
 
doublerealpGetVec (void)
 
void RightMult (const MatNx3 &n, const Vec3 &v)
 
const VecNMult (const MatNxN &m, const VecN &n)
 
const VecNMult (const MatNxN &m, const ArrayView &vm, const VecN &n, const ArrayView &vn)
 
const VecNoperator+= (const VecN &m)
 
const VecNoperator*= (const doublereal &d)
 
doublerealoperator() (integer i)
 
const doublerealoperator() (integer i) const
 

Protected Member Functions

void Create_ (integer ns)
 
void Destroy_ (void)
 

Protected Attributes

integer iMaxRows
 
integer iNumRows
 
doublerealpdVec
 

Private Member Functions

const VecNoperator= (const VecN &)
 

Friends

class Mat3xN
 
class MatNx3
 
class MatNxN
 

Detailed Description

Definition at line 76 of file matvec3n.h.

Constructor & Destructor Documentation

VecN::VecN ( void  )

Definition at line 65 of file matvec3n.cc.

References NO_OP.

66 : iMaxRows(0), iNumRows(0), pdVec(NULL)
67 {
68  NO_OP;
69 }
#define NO_OP
Definition: myassert.h:74
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
VecN::VecN ( integer  ns)

Definition at line 72 of file matvec3n.cc.

References Create_().

73 : iMaxRows(ns), iNumRows(ns), pdVec(NULL)
74 {
75  Create_(ns);
76 #ifdef DEBUG
77  IsValid();
78 #endif /* DEBUG */
79 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
void Create_(integer ns)
Definition: matvec3n.cc:47

Here is the call graph for this function:

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

Definition at line 82 of file matvec3n.cc.

References Create_(), and Reset().

83 : iMaxRows(ns), iNumRows(ns), pdVec(NULL)
84 {
85  Create_(ns);
86  Reset(d);
87 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
void Create_(integer ns)
Definition: matvec3n.cc:47
void Reset(const doublereal d=0.)
Definition: matvec3n.cc:147

Here is the call graph for this function:

VecN::VecN ( const VecN v)

Definition at line 89 of file matvec3n.cc.

References Create_(), iNumRows, and pdVec.

90 : iMaxRows(v.iNumRows), iNumRows(v.iNumRows), pdVec(NULL)
91 {
92  Create_(v.iNumRows);
93  for (integer iCnt = 0; iCnt < iNumRows; iCnt++) {
94  pdVec[iCnt] = v.pdVec[iCnt];
95  }
96 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
void Create_(integer ns)
Definition: matvec3n.cc:47
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VecN::VecN ( const VectorHandler vh,
integer  ns,
integer  iFirstIndex 
)

Definition at line 104 of file matvec3n.cc.

References ASSERT, Create_(), VectorHandler::iGetSize(), and pdVec.

105 :iMaxRows(ns), iNumRows(ns), pdVec(NULL)
106 {
107  ASSERT(iFirstIndex > 0 && iFirstIndex + ns - 1 <= vh.iGetSize());
108  Create_(ns);
109  for(integer iCnt = 0; iCnt < ns; iCnt++) {
110  pdVec[iCnt] = vh(iFirstIndex+iCnt);
111  }
112 }
virtual integer iGetSize(void) const =0
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
#define ASSERT(expression)
Definition: colamd.c:977
void Create_(integer ns)
Definition: matvec3n.cc:47
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VecN::~VecN ( void  )

Definition at line 127 of file matvec3n.cc.

References Destroy_().

128 {
129  Destroy_();
130 }
void Destroy_(void)
Definition: matvec3n.cc:57

Here is the call graph for this function:

Member Function Documentation

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

Definition at line 169 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

170 {
171 #ifdef DEBUG
172  IsValid();
173 #endif /* DEBUG */
174  ASSERT(i > 0 && i <= iNumRows);
175  pdVec[--i] += d;
176 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
const VecN & VecN::Copy ( const VectorHandler vh,
integer  iFirstIndex = 1 
)

Definition at line 116 of file matvec3n.cc.

References ASSERT, VectorHandler::iGetSize(), iNumRows, and pdVec.

Referenced by Modal::AssRes().

117 {
118  ASSERT(iFirstIndex > 0 && iFirstIndex + iNumRows - 1 <= vh.iGetSize());
119  for (integer iCnt = 0; iCnt < iNumRows; iCnt++) {
120  pdVec[iCnt] = vh(iFirstIndex+iCnt);
121  }
122 
123  return *this;
124 }
virtual integer iGetSize(void) const =0
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void VecN::Create_ ( integer  ns)
protected

Definition at line 47 of file matvec3n.cc.

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

Referenced by Resize(), and VecN().

48 {
49  ASSERT(ns > 0);
50  if (pdVec != NULL) {
51  Destroy_();
52  }
54 }
doublereal * pdVec
Definition: matvec3n.h:89
#define ASSERT(expression)
Definition: colamd.c:977
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
void Destroy_(void)
Definition: matvec3n.cc:57
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

void VecN::Destroy_ ( void  )
protected

Definition at line 57 of file matvec3n.cc.

References pdVec, and SAFEDELETEARR.

Referenced by Create_(), Resize(), and ~VecN().

58 {
59  if (pdVec != NULL) {
61  }
62 }
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
doublereal * pdVec
Definition: matvec3n.h:89
const doublereal & VecN::dGet ( integer  i) const
inline

Definition at line 188 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

Referenced by Modal::AssJac().

189 {
190 #ifdef DEBUG
191  IsValid();
192 #endif /* DEBUG */
193  ASSERT(i > 0 && i <= iNumRows);
194  return pdVec[--i];
195 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
integer VecN::iGetNumRows ( void  ) const
inline

Definition at line 150 of file matvec3n.h.

References iNumRows.

Referenced by ReadModal().

151 {
152 #ifdef DEBUG
153  IsValid();
154 #endif /* DEBUG */
155  return iNumRows;
156 }
integer iNumRows
Definition: matvec3n.h:88
const VecN & VecN::Mult ( const MatNxN m,
const VecN n 
)

Definition at line 192 of file matvec3n.cc.

References ASSERT, iNumRows, MatNxN::iNumRows, MatNxN::pdMat, and pdVec.

Referenced by Modal::AssRes().

193 {
194 #ifdef DEBUG
195  IsValid();
196 #endif /* DEBUG */
197  ASSERT(iNumRows == m.iNumRows);
198  ASSERT(m.iNumRows == n.iNumRows);
199 
200  for (integer i = 0; i < iNumRows; i++ ) {
201  pdVec[i] = 0.;
202  for (integer j = 0; j < iNumRows; j++ ) {
203  pdVec[i] += m.pdMat[j][i]*n.pdVec[j];
204  }
205  }
206 
207  return *this;
208 }
integer iNumRows
Definition: matvec3n.h:528
doublereal * pdVec
Definition: matvec3n.h:89
doublereal ** pdMat
Definition: matvec3n.h:530
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
long int integer
Definition: colamd.c:51
const VecN & VecN::Mult ( const MatNxN m,
const ArrayView vm,
const VecN n,
const ArrayView vn 
)

Definition at line 211 of file matvec3n.cc.

References ASSERT, iNumRows, MatNxN::iNumRows, ArrayView::Last(), ArrayView::Number(), ArrayView::Offset(), MatNxN::pdMat, pdVec, and ArrayView::Start().

213 {
214 #ifdef DEBUG
215  IsValid();
216 #endif /* DEBUG */
217  ASSERT(iNumRows == m.iNumRows);
218  ASSERT(m.iNumRows >= vm.Last());
219  ASSERT(n.iNumRows >= vn.Last());
220  ASSERT(vm.Number() == vm.Number());
221 
222  for(integer i = 0; i < iNumRows; i++) {
223  integer jm = vm.Start() - 1;
224  integer jn = vn.Start() - 1;
225 
226  pdVec[i] = 0.;
227  for(integer j = 0; j < vm.Number(); j++) {
228  pdVec[i] += m.pdMat[jm][i]*n.pdVec[jn];
229 
230  jm += vm.Offset();
231  jn += vn.Offset();
232  }
233  }
234 
235  return *this;
236 }
integer iNumRows
Definition: matvec3n.h:528
doublereal * pdVec
Definition: matvec3n.h:89
doublereal ** pdMat
Definition: matvec3n.h:530
integer Number(void) const
Definition: matvec3n.h:67
integer iNumRows
Definition: matvec3n.h:88
integer Offset(void) const
Definition: matvec3n.h:63
#define ASSERT(expression)
Definition: colamd.c:977
integer Last(void) const
Definition: matvec3n.h:71
integer Start(void) const
Definition: matvec3n.h:59
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

doublereal & VecN::operator() ( integer  i)
inline

Definition at line 198 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

199 {
200 #ifdef DEBUG
201  IsValid();
202 #endif /* DEBUG */
203  ASSERT(i > 0 && i <= iNumRows);
204  return pdVec[--i];
205 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
const doublereal & VecN::operator() ( integer  i) const
inline

Definition at line 208 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

209 {
210 #ifdef DEBUG
211  IsValid();
212 #endif /* DEBUG */
213  ASSERT(i > 0 && i <= iNumRows);
214  return pdVec[--i];
215 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
const VecN & VecN::operator*= ( const doublereal d)

Definition at line 181 of file matvec3n.cc.

References iNumRows, and pdVec.

182 {
183 #ifdef DEBUG
184  IsValid();
185 #endif /* DEBUG */
186  for (integer i = iNumRows; i-- > 0; ) {
187  pdVec[i] *= d;
188  }
189  return *this;
190 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
long int integer
Definition: colamd.c:51
const VecN & VecN::operator+= ( const VecN m)

Definition at line 169 of file matvec3n.cc.

References iNumRows, and pdVec.

170 {
171 #ifdef DEBUG
172  IsValid();
173 #endif /* DEBUG */
174  for (integer i = m.iNumRows; i-- > 0; ) {
175  pdVec[i] += m.pdVec[i];
176  }
177  return *this;
178 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
long int integer
Definition: colamd.c:51
const VecN& VecN::operator= ( const VecN )
private
const doublereal* VecN::pGetVec ( void  ) const
inline

Definition at line 125 of file matvec3n.h.

References pdVec.

Referenced by ModuleNonsmoothNode::mbs_get_force().

125  {
126  return pdVec;
127  };
doublereal * pdVec
Definition: matvec3n.h:89
doublereal* VecN::pGetVec ( void  )
inline

Definition at line 129 of file matvec3n.h.

References pdVec.

129  {
130  return pdVec;
131  };
doublereal * pdVec
Definition: matvec3n.h:89
void VecN::Put ( integer  i,
const doublereal d 
)
inline

Definition at line 159 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

Referenced by PiezoActuatorBeam::AfterPredict(), PiezoActuatorBeam2::AfterPredict(), PiezoActuatorVEBeam2::AfterPredict(), PiezoActuatorVEBeam::AfterPredict(), PiezoActuatorBeam::AssStiffnessVec(), PiezoActuatorBeam2::AssStiffnessVec(), PiezoActuatorVEBeam2::AssStiffnessVec(), PiezoActuatorVEBeam::AssStiffnessVec(), Modal::InitialAssRes(), and ReadModal().

160 {
161 #ifdef DEBUG
162  IsValid();
163 #endif /* DEBUG */
164  ASSERT(i > 0 && i <= iNumRows);
165  pdVec[--i] = d;
166 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977
void VecN::Reset ( const doublereal  d = 0.)

Definition at line 147 of file matvec3n.cc.

References iNumRows, and pdVec.

Referenced by VecN().

148 {
149 #ifdef DEBUG
150  IsValid();
151 #endif /* DEBUG */
152  for (integer i = iNumRows; i-- > 0; ) {
153  pdVec[i] = d;
154  }
155 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
long int integer
Definition: colamd.c:51
void VecN::Resize ( integer  ns)

Definition at line 133 of file matvec3n.cc.

References ASSERT, Create_(), Destroy_(), iMaxRows, iNumRows, and pdVec.

134 {
135  ASSERT(ns > 0);
136  if (pdVec != NULL) {
137  Destroy_();
138  }
139  Create_(ns);
140  iMaxRows = iNumRows = ns;
141 #ifdef DEBUG
142  IsValid();
143 #endif /* DEBUG */
144 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
integer iMaxRows
Definition: matvec3n.h:87
#define ASSERT(expression)
Definition: colamd.c:977
void Create_(integer ns)
Definition: matvec3n.cc:47
void Destroy_(void)
Definition: matvec3n.cc:57

Here is the call graph for this function:

void VecN::RightMult ( const MatNx3 n,
const Vec3 v 
)

Definition at line 157 of file matvec3n.cc.

References iNumRows, MatNx3::pdCols, pdVec, Vec3::pdVec, V1, V2, and V3.

158 {
159 #ifdef DEBUG
160  IsValid();
161 #endif /* DEBUG */
162  for (integer i = iNumRows; i-- > 0; ) {
163  pdVec[i] = n.pdCols[0][i]*v.pdVec[V1]
164  + n.pdCols[1][i]*v.pdVec[V2]
165  + n.pdCols[2][i]*v.pdVec[V3];
166  }
167 }
Definition: matvec3.h:50
doublereal pdVec[3]
Definition: matvec3.h:109
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
Definition: matvec3.h:51
Definition: matvec3.h:49
doublereal * pdCols[3]
Definition: matvec3n.h:389
long int integer
Definition: colamd.c:51
void VecN::Sub ( integer  i,
const doublereal d 
)
inline

Definition at line 178 of file matvec3n.h.

References ASSERT, iNumRows, and pdVec.

179 {
180 #ifdef DEBUG
181  IsValid();
182 #endif /* DEBUG */
183  ASSERT(i > 0 && i <= iNumRows);
184  pdVec[--i] -= d;
185 }
doublereal * pdVec
Definition: matvec3n.h:89
integer iNumRows
Definition: matvec3n.h:88
#define ASSERT(expression)
Definition: colamd.c:977

Friends And Related Function Documentation

friend class Mat3xN
friend

Definition at line 77 of file matvec3n.h.

friend class MatNx3
friend

Definition at line 78 of file matvec3n.h.

friend class MatNxN
friend

Definition at line 79 of file matvec3n.h.

Member Data Documentation

integer VecN::iMaxRows
protected

Definition at line 87 of file matvec3n.h.

Referenced by Resize().


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