44 const std::string& sFileName,
45 integer nd,
const std::vector<doublereal>&
v0,
111 for (
int i = 0; i < m_iND; i++) {
137 : m_size(size), m_data(data)
147 for (std::vector<BufCast *>::iterator i =
m_data.begin(); i !=
m_data.end(); ++i) {
161 for (
size_t i = 0; i !=
m_data.size(); ++i) {
162 out[i] =
m_data[i]->cast(in);
174 std::vector<BufCast *> data(nDrives);
176 size_t minsize = data[data.size() - 1]->offset() + data[data.size() - 1]->size();
177 size_t size = minsize;
181 silent_cerr(
"ReadStreamDriveModifier: invalid size " << i
187 if (size < minsize) {
188 silent_cerr(
"ReadStreamDriveModifier: size " << size
189 <<
" is less than min size " << minsize
199 silent_cerr(
"ReadStreamDriveModifier: unknown modifier type at line " << HP.
GetLineData() << std::endl);
210 sOutFileName(sOutFileName),
211 iPrecision(iPrecision),
227 silent_cerr(msg <<
"(" << uLabel <<
"): "
228 "unable to open echo file '" <<
sOutFileName <<
"'" << std::endl);
236 outFile.setf(std::ios::scientific);
239 <<
"# generated by SocketStreamDrive(" << uLabel <<
")"
241 if (nChannels == 1) {
243 <<
"# Time, Channel #1"
248 <<
"# Time, Channels #1-" << nChannels
258 for (
unsigned i = 1; i < size; i++) {
266 for (
unsigned i = 0; i < size ; i++) {
270 for (
unsigned j = 0; j < size ; j++) {
284 std::string sOutFileName;
291 silent_cerr(
"ReadStreamDriveEcho: "
292 "unable to parse echo file name "
302 if (iPrecision <= 0) {
303 silent_cerr(
"ReadStreamDriveEcho: "
304 "invalid echo precision " << iPrecision
size_t GetSize(void) const
const DriveHandler * pDrvHdl
#define MBDYN_EXCEPT_ARGS
virtual integer GetInt(integer iDefval=0)
std::vector< BufCast * > m_data
StreamDriveEcho * ReadStreamDriveEcho(const DataManager *pDM, MBDynParser &HP)
StreamDrive::Modifier * ReadStreamDriveModifier(MBDynParser &HP, integer nDrives)
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
const DriveHandler * pGetDrvHdl(void) const
void Modify(doublereal *out, const void *in) const
void Echo(const doublereal *pbuf, unsigned nChannels)
std::vector< doublereal > echoBuf
virtual size_t GetSize(void) const =0
virtual ~StreamDrive(void)
~StreamDriveCopyCast(void)
virtual bool IsKeyWord(const char *sKeyWord)
const StreamDrive::Modifier * pGetModifier(void) const
void Modify(doublereal *out, const void *in) const
void Copy(scalar_func_type &d1, const scalar_func_type &d2, LocalDofMap *)
#define ASSERT(expression)
void EchoPrepare(const doublereal *pbuf, unsigned nChannels)
static std::stack< cleanup * > c
bool Init(const std::string &msg, unsigned uLabel, unsigned nChannels)
StreamDriveEcho(const DriveHandler *pDrvHdl, std::string &sOutFileName, int iPrecision, doublereal dShift)
size_t GetSize(void) const
doublereal dGetTime(void) const
StreamDriveCopyCast(size_t size, const std::vector< BufCast * > &data)
void SetModifier(const Modifier *p)
static const std::vector< doublereal > v0
void ReadBufCast(HighParser &HP, std::vector< BufCast * > &data)
virtual HighParser::ErrOut GetLineData(void) const
StreamDrive(unsigned int uL, const DriveHandler *pDH, const std::string &sFileName, integer nd, const std::vector< doublereal > &v0, bool c, StreamDrive::Modifier *pmod)
virtual doublereal GetReal(const doublereal &dDefval=0.0)