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

#include <stlvh.h>

Inheritance diagram for STLVectorHandler:
Collaboration diagram for STLVectorHandler:

Public Member Functions

 STLVectorHandler (integer iSize=0)
 
virtual ~STLVectorHandler (void)
 
virtual doublerealpdGetVec (void) const
 
virtual integer iGetSize (void) const
 
virtual void Reset (void)
 
virtual void Resize (integer iNewSize)
 
virtual void PutCoef (integer iRow, const doublereal &dCoef)
 
virtual void IncCoef (integer iRow, const doublereal &dCoef)
 
virtual void DecCoef (integer iRow, const doublereal &dCoef)
 
virtual const doublerealdGetCoef (integer iRow) const
 
virtual const doublerealoperator() (integer iRow) const
 
virtual doublerealoperator() (integer iRow)
 
virtual void Add (integer iRow, const Vec3 &v)
 
virtual void Sub (integer iRow, const Vec3 &v)
 
virtual void Put (integer iRow, const Vec3 &v)
 
virtual VectorHandlerScalarAddMul (const VectorHandler &VH, const doublereal &d)
 
virtual VectorHandlerScalarAddMul (const VectorHandler &VH, const VectorHandler &VH1, const doublereal &d)
 
virtual VectorHandlerScalarMul (const VectorHandler &VH, const doublereal &d)
 
virtual VectorHandleroperator+= (const VectorHandler &VH)
 
virtual VectorHandleroperator-= (const VectorHandler &VH)
 
virtual VectorHandleroperator*= (const doublereal &d)
 
virtual VectorHandleroperator= (const VectorHandler &VH)
 
virtual doublereal Dot (void) const
 
virtual doublereal InnerProd (const VectorHandler &VH) const
 
- Public Member Functions inherited from VectorHandler
virtual ~VectorHandler (void)
 
virtual void ResizeReset (integer)
 
virtual VectorHandleroperator+= (const SubVectorHandler &SubVH)
 
virtual doublereal Norm (void) const
 

Detailed Description

Definition at line 43 of file stlvh.h.

Constructor & Destructor Documentation

STLVectorHandler::STLVectorHandler ( integer  iSize = 0)

Definition at line 47 of file stlvh.cc.

References ASSERT.

48 : std::vector<doublereal>(iSize)
49 {
50  ASSERT(iSize >= 0);
51 }
#define ASSERT(expression)
Definition: colamd.c:977
STLVectorHandler::~STLVectorHandler ( void  )
virtual

Definition at line 53 of file stlvh.cc.

References NO_OP.

54 {
55  NO_OP;
56 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void STLVectorHandler::Add ( integer  iRow,
const Vec3 v 
)
virtual

Reimplemented from VectorHandler.

Definition at line 157 of file stlvh.cc.

References ASSERT.

158 {
159  ASSERT(iRow > 0);
160  ASSERT(unsigned(iRow) + 2 <= size());
161 
162  (*this)[--iRow] += v(1);
163  (*this)[++iRow] += v(2);
164  (*this)[++iRow] += v(3);
165 }
#define ASSERT(expression)
Definition: colamd.c:977
void STLVectorHandler::DecCoef ( integer  iRow,
const doublereal dCoef 
)
virtual

Implements VectorHandler.

Definition at line 120 of file stlvh.cc.

References ASSERT.

121 {
122  ASSERT(iRow > 0);
123  ASSERT(unsigned(iRow) <= size());
124 
125  (*this)[--iRow] -= dCoef;
126 }
#define ASSERT(expression)
Definition: colamd.c:977
const doublereal & STLVectorHandler::dGetCoef ( integer  iRow) const
virtual

Implements VectorHandler.

Definition at line 129 of file stlvh.cc.

References ASSERT.

130 {
131  ASSERT(iRow > 0);
132  ASSERT(unsigned(iRow) <= size());
133 
134  return (*this)[--iRow];
135 }
#define ASSERT(expression)
Definition: colamd.c:977
doublereal STLVectorHandler::Dot ( void  ) const
virtual

Reimplemented from VectorHandler.

Definition at line 304 of file stlvh.cc.

305 {
306 #ifdef DEBUG
307  IsValid();
308 #endif // DEBUG
309 
310  doublereal d2 = 0.;
311 
312  for (std::vector<doublereal>::const_iterator i = begin();
313  i != end(); ++i)
314  {
315  doublereal d = *i;
316  d2 += d*d;
317  }
318 
319  return d2;
320 }
double doublereal
Definition: colamd.c:52
integer STLVectorHandler::iGetSize ( void  ) const
virtual

Implements VectorHandler.

Definition at line 78 of file stlvh.cc.

Referenced by InnerProd(), operator+=(), operator-=(), operator=(), ScalarAddMul(), and ScalarMul().

79 {
80  return size();
81 }
void STLVectorHandler::IncCoef ( integer  iRow,
const doublereal dCoef 
)
virtual

Implements VectorHandler.

Definition at line 111 of file stlvh.cc.

References ASSERT.

112 {
113  ASSERT(iRow > 0);
114  ASSERT(unsigned(iRow) <= size());
115 
116  (*this)[--iRow] += dCoef;
117 }
#define ASSERT(expression)
Definition: colamd.c:977
doublereal STLVectorHandler::InnerProd ( const VectorHandler VH) const
virtual

Reimplemented from VectorHandler.

Definition at line 325 of file stlvh.cc.

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

326 {
327  ASSERT(VH.iGetSize() > 0);
328  ASSERT(unsigned(VH.iGetSize()) == size());
329 
330  doublereal d = 0.;
331 
332  for (integer i = iGetSize(); i > 0;) {
333  doublereal dd = VH(i);
334  i--;
335  d += (*this)[i]*dd;
336  }
337 
338  return d;
339 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

const doublereal & STLVectorHandler::operator() ( integer  iRow) const
virtual

Implements VectorHandler.

Definition at line 138 of file stlvh.cc.

References ASSERT.

139 {
140  ASSERT(iRow > 0);
141  ASSERT(unsigned(iRow) <= size());
142 
143  return (*this)[--iRow];
144 }
#define ASSERT(expression)
Definition: colamd.c:977
doublereal & STLVectorHandler::operator() ( integer  iRow)
virtual

Implements VectorHandler.

Definition at line 147 of file stlvh.cc.

References ASSERT.

148 {
149  ASSERT(iRow > 0);
150  ASSERT(unsigned(iRow) <= size());
151 
152  return (*this)[--iRow];
153 }
#define ASSERT(expression)
Definition: colamd.c:977
VectorHandler & STLVectorHandler::operator*= ( const doublereal d)
virtual

Reimplemented from VectorHandler.

Definition at line 277 of file stlvh.cc.

278 {
279  for (std::vector<doublereal>::iterator i = begin(); i != end(); ++i) {
280  *i *= d;
281  }
282 
283  return *this;
284 }
VectorHandler & STLVectorHandler::operator+= ( const VectorHandler VH)
virtual

Reimplemented from VectorHandler.

Definition at line 245 of file stlvh.cc.

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

246 {
247  ASSERT(VH.iGetSize() > 0);
248  ASSERT(unsigned(VH.iGetSize()) == size());
249 
250  for (integer i = iGetSize(); i > 0;) {
251  doublereal dd = VH(i);
252  i--;
253  (*this)[i] += dd;
254  }
255 
256  return *this;
257 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VectorHandler & STLVectorHandler::operator-= ( const VectorHandler VH)
virtual

Reimplemented from VectorHandler.

Definition at line 261 of file stlvh.cc.

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

262 {
263  ASSERT(VH.iGetSize() > 0);
264  ASSERT(unsigned(VH.iGetSize()) == size());
265 
266  for (integer i = iGetSize(); i > 0;) {
267  doublereal dd = VH(i);
268  i--;
269  (*this)[i] -= dd;
270  }
271 
272  return *this;
273 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VectorHandler & STLVectorHandler::operator= ( const VectorHandler VH)
virtual

Reimplemented from VectorHandler.

Definition at line 288 of file stlvh.cc.

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

289 {
290  ASSERT(VH.iGetSize() > 0);
291  ASSERT(unsigned(VH.iGetSize()) == size());
292 
293  for (integer i = iGetSize(); i > 0;) {
294  doublereal dd = VH(i);
295  i--;
296  (*this)[i] = dd;
297  }
298 
299  return *this;
300 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

doublereal * STLVectorHandler::pdGetVec ( void  ) const
virtual

Implements VectorHandler.

Definition at line 68 of file stlvh.cc.

69 {
70 #ifdef DEBUG
71  IsValid();
72 #endif // DEBUG
73 
74  return &((*const_cast<STLVectorHandler *>(this))[0]);
75 }
void STLVectorHandler::Put ( integer  iRow,
const Vec3 v 
)
virtual

Reimplemented from VectorHandler.

Definition at line 181 of file stlvh.cc.

References ASSERT.

Referenced by ModuleNonsmoothNode::mbs_get_force_frictional(), ModalMappingExt::Send(), StructMappingExtForce::SendToFileDes(), and StructMembraneMappingExtForce::SendToFileDes().

182 {
183  ASSERT(iRow > 0);
184  ASSERT(unsigned(iRow) + 2 <= size());
185 
186  (*this)[--iRow] = v(1);
187  (*this)[++iRow] = v(2);
188  (*this)[++iRow] = v(3);
189 }
#define ASSERT(expression)
Definition: colamd.c:977
void STLVectorHandler::PutCoef ( integer  iRow,
const doublereal dCoef 
)
virtual

Implements VectorHandler.

Definition at line 102 of file stlvh.cc.

References ASSERT.

103 {
104  ASSERT(iRow > 0);
105  ASSERT(unsigned(iRow) <= size());
106 
107  (*this)[--iRow] = dCoef;
108 }
#define ASSERT(expression)
Definition: colamd.c:977
void STLVectorHandler::Reset ( void  )
virtual

Implements VectorHandler.

Definition at line 84 of file stlvh.cc.

85 {
86 #ifdef DEBUG
87  IsValid();
88 #endif // DEBUG
89 
90  std::fill(begin(), end(), 0.);
91 }
void STLVectorHandler::Resize ( integer  iNewSize)
virtual

Implements VectorHandler.

Definition at line 94 of file stlvh.cc.

References ASSERT.

95 {
96  ASSERT(iNewSize >= 0);
97 
98  resize(iNewSize);
99 }
#define ASSERT(expression)
Definition: colamd.c:977
VectorHandler & STLVectorHandler::ScalarAddMul ( const VectorHandler VH,
const doublereal d 
)
virtual

Reimplemented from VectorHandler.

Definition at line 193 of file stlvh.cc.

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

194 {
195  ASSERT(VH.iGetSize() > 0);
196  ASSERT(unsigned(VH.iGetSize()) == size());
197 
198  for (integer i = iGetSize(); i > 0;) {
199  doublereal dd = d*VH(i);
200  i--;
201  (*this)[i] = dd;
202  }
203 
204  return *this;
205 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VectorHandler & STLVectorHandler::ScalarAddMul ( const VectorHandler VH,
const VectorHandler VH1,
const doublereal d 
)
virtual

Reimplemented from VectorHandler.

Definition at line 209 of file stlvh.cc.

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

212 {
213  ASSERT(VH.iGetSize() > 0);
214  ASSERT(unsigned(VH.iGetSize()) == size());
215  ASSERT(VH1.iGetSize() > 0);
216  ASSERT(unsigned(VH1.iGetSize()) == size());
217 
218  for (integer i = iGetSize(); i > 0;) {
219  doublereal dd = VH(i) + d*VH1(i);
220  i--;
221  (*this)[i] = dd;
222  }
223 
224  return *this;
225 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

VectorHandler & STLVectorHandler::ScalarMul ( const VectorHandler VH,
const doublereal d 
)
virtual

Reimplemented from VectorHandler.

Definition at line 229 of file stlvh.cc.

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

230 {
231  ASSERT(VH.iGetSize() > 0);
232  ASSERT(unsigned(VH.iGetSize()) == size());
233 
234  for (integer i = iGetSize(); i > 0; ) {
235  doublereal dd = d*VH(i);
236  i--;
237  (*this)[i] = dd;
238  }
239 
240  return *this;
241 }
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual integer iGetSize(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void STLVectorHandler::Sub ( integer  iRow,
const Vec3 v 
)
virtual

Reimplemented from VectorHandler.

Definition at line 169 of file stlvh.cc.

References ASSERT.

170 {
171  ASSERT(iRow > 0);
172  ASSERT(unsigned(iRow) + 2 <= size());
173 
174  (*this)[--iRow] -= v(1);
175  (*this)[++iRow] -= v(2);
176  (*this)[++iRow] -= v(3);
177 }
#define ASSERT(expression)
Definition: colamd.c:977

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