MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
bufferstreamdrive.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/bufferstreamdrive.h,v 1.5 2017/01/12 14:46:09 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 /* socket driver */
33 
34 #ifndef BUFFERSTREAMDRIVE_H
35 #define BUFFERSTREAMDRIVE_H
36 
37 #include "streamdrive.h"
38 
39 /* BufferStreamDrive_base - begin */
40 
42 protected:
43  unsigned int InputEvery;
44  unsigned int InputCounter;
45 
47 
48 public:
49  BufferStreamDrive_base(unsigned int uL,
50  const DriveHandler* pDH,
51  integer nd, const std::vector<doublereal>& v0,
53  unsigned int ie,
55 
56  virtual ~BufferStreamDrive_base(void);
57 
58  const integer GetBufSize(void) const;
59  virtual const doublereal *GetBufRaw(void) = 0;
60 
61  virtual void ServePending(const doublereal& t);
62 };
63 
64 /* BufferStreamDrive_base - end */
65 
66 /* BufferStreamDrive - begin */
67 
69 protected:
70  std::vector<doublereal> buffer;
71 
72 public:
73  BufferStreamDrive(unsigned int uL,
74  const DriveHandler* pDH,
75  integer nd, const std::vector<doublereal>& v0,
77  unsigned int ie,
79 
80  virtual ~BufferStreamDrive(void);
81 
82  const doublereal *GetBufRaw(void);
83  std::vector<doublereal>& GetBuf(void);
84 
85  /* Scrive il contributo del DriveCaller al file di restart */
86  virtual std::ostream& Restart(std::ostream& out) const;
87 };
88 
89 /* BufferStreamDrive - end */
90 
91 /* BufferStreamDriveRaw - begin */
92 
94 protected:
97 
98 public:
99  BufferStreamDriveRaw(unsigned int uL,
100  const DriveHandler* pDH,
101  integer nd, const std::vector<doublereal>& v0,
103  unsigned int ie,
105  bool bOwnsMemory);
106 
107  virtual ~BufferStreamDriveRaw(void);
108 
109  bool bOwnsMemory(void) const;
110  void SetBufRaw(integer n, const doublereal *p);
111  const doublereal *GetBufRaw(void);
112 
113  /* Scrive il contributo del DriveCaller al file di restart */
114  virtual std::ostream& Restart(std::ostream& out) const;
115 };
116 
117 /* BufferStreamDrive - end */
118 
119 class DataManager;
120 class MBDynParser;
121 
122 struct BufferStreamDR : public DriveRead {
123 public:
124  BufferStreamDR(void) { NO_OP; };
125 
126  virtual Drive *
127  Read(unsigned uLabel, const DataManager *pDM, MBDynParser& HP);
128 };
129 
130 #endif /* BUFFERSTREAMDRIVE_H */
131 
StreamDriveEcho * pSDE
virtual ~BufferStreamDrive_base(void)
virtual void ServePending(const doublereal &t)
BufferStreamDrive(unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE)
Definition: drive.h:89
BufferStreamDriveRaw(unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE, bool bOwnsMemory)
#define NO_OP
Definition: myassert.h:74
std::vector< doublereal > buffer
bool bOwnsMemory(void) const
void SetBufRaw(integer n, const doublereal *p)
const doublereal * GetBufRaw(void)
virtual ~BufferStreamDrive(void)
virtual std::ostream & Restart(std::ostream &out) const
virtual Drive * Read(unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
const doublereal * m_pBuffer
std::vector< doublereal > & GetBuf(void)
virtual ~BufferStreamDriveRaw(void)
static const std::vector< doublereal > v0
Definition: fixedstep.cc:45
virtual const doublereal * GetBufRaw(void)=0
const Modifier * pMod
Definition: streamdrive.h:69
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual std::ostream & Restart(std::ostream &out) const
const doublereal * GetBufRaw(void)
BufferStreamDrive_base(unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE)
const integer GetBufSize(void) const