MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
stlvh.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/stlvh.h,v 1.9 2017/01/12 14:43:54 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 #ifndef STLVH_H
33 #define STLVH_H
34 
35 #include <vector>
36 #include "vh.h"
37 
38 class Vec3;
39 class SubVectorHandler;
40 
41 /* STLVectorHandler - begin */
42 
43 class STLVectorHandler : public VectorHandler, public std::vector<doublereal> {
44 public:
45  STLVectorHandler(integer iSize = 0);
46 
47  virtual ~STLVectorHandler(void);
48 
49 #ifdef DEBUG
50  /* Usata per il debug */
51  virtual void IsValid(void) const;
52 #endif /* DEBUG */
53 
54  virtual doublereal* pdGetVec(void) const;
55 
56  virtual integer iGetSize(void) const;
57 
58  virtual void Reset(void);
59 
60  virtual void Resize(integer iNewSize);
61 
62  virtual void PutCoef(integer iRow, const doublereal& dCoef);
63 
64  virtual void IncCoef(integer iRow, const doublereal& dCoef);
65 
66  virtual void DecCoef(integer iRow, const doublereal& dCoef);
67 
68  virtual const doublereal& dGetCoef(integer iRow) const;
69 
70  virtual const doublereal& operator () (integer iRow) const;
71 
72  virtual doublereal& operator () (integer iRow);
73 
74  /* Somma un Vec3 nella posizione desiderata */
75  virtual void Add(integer iRow, const Vec3& v);
76 
77  /* Sottrae un Vec3 nella posizione desiderata */
78  virtual void Sub(integer iRow, const Vec3& v);
79 
80  /* Scrive un Vec3 nella posizione desiderata */
81  virtual void Put(integer iRow, const Vec3& v);
82 
83  /* Somma e moltiplica per uno scalare */
84  virtual VectorHandler&
85  ScalarAddMul(const VectorHandler& VH, const doublereal& d);
86 
87  /* Somma e moltiplica per uno scalare v = VH + d * VH1 */
88  virtual VectorHandler&
89  ScalarAddMul(const VectorHandler& VH, const VectorHandler& VH1,
90  const doublereal& d);
91 
92  /* Moltiplica per uno scalare */
93  virtual VectorHandler&
94  ScalarMul(const VectorHandler& VH, const doublereal& d);
95 
96  /* Overload di += usato per la correzione della soluzione */
97  virtual VectorHandler& operator += (const VectorHandler& VH);
98 
99  /* Overload di -= */
100  virtual VectorHandler& operator -= (const VectorHandler& VH);
101 
102  /* Overload di *= */
103  virtual VectorHandler& operator *= (const doublereal &d);
104 
105  /* Assegnazione che copia il contenuto della memoria di due handlers */
106  virtual VectorHandler& operator = (const VectorHandler& VH);
107 
108  /* Norma 2 del vettore */
109  virtual doublereal Dot(void) const;
110 
111  /* Prodotto Scalare di due vettori */
112  virtual doublereal InnerProd(const VectorHandler& VH) const;
113 };
114 
115 /* STLVectorHandler - end */
116 
117 #endif // STLVH_H
118 
Definition: matvec3.h:98
virtual void IncCoef(integer iRow, const doublereal &dCoef)
Definition: stlvh.cc:111
virtual VectorHandler & operator*=(const doublereal &d)
Definition: stlvh.cc:277
virtual integer iGetSize(void) const
Definition: stlvh.cc:78
virtual VectorHandler & operator+=(const VectorHandler &VH)
Definition: stlvh.cc:245
virtual doublereal * pdGetVec(void) const
Definition: stlvh.cc:68
virtual void Reset(void)
Definition: stlvh.cc:84
virtual const doublereal & dGetCoef(integer iRow) const
Definition: stlvh.cc:129
virtual VectorHandler & operator-=(const VectorHandler &VH)
Definition: stlvh.cc:261
STLVectorHandler(integer iSize=0)
Definition: stlvh.cc:47
virtual void Sub(integer iRow, const Vec3 &v)
Definition: stlvh.cc:169
struct vector vector
virtual VectorHandler & ScalarMul(const VectorHandler &VH, const doublereal &d)
Definition: stlvh.cc:229
virtual VectorHandler & operator=(const VectorHandler &VH)
Definition: stlvh.cc:288
virtual void Put(integer iRow, const Vec3 &v)
Definition: stlvh.cc:181
virtual const doublereal & operator()(integer iRow) const
Definition: stlvh.cc:138
virtual void DecCoef(integer iRow, const doublereal &dCoef)
Definition: stlvh.cc:120
virtual ~STLVectorHandler(void)
Definition: stlvh.cc:53
virtual void Resize(integer iNewSize)
Definition: stlvh.cc:94
virtual void Add(integer iRow, const Vec3 &v)
Definition: stlvh.cc:157
virtual VectorHandler & ScalarAddMul(const VectorHandler &VH, const doublereal &d)
Definition: stlvh.cc:193
virtual void PutCoef(integer iRow, const doublereal &dCoef)
Definition: stlvh.cc:102
virtual doublereal InnerProd(const VectorHandler &VH) const
Definition: stlvh.cc:325
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual doublereal Dot(void) const
Definition: stlvh.cc:304