46 static const std::vector<doublereal>
v0;
50 const char*
const sFileName,
53 iNumSteps(-1), iCurrStep(-1),
54 bLinear(bl), bPadZeroes(pz), boWhen(bo), pd(0), pvd(0)
59 std::ifstream in(sFileName);
61 silent_cerr(
"can't open file \""
62 << sFileName <<
"\"" << std::endl);
70 while (in.get(c), c ==
'#') {
74 in.getline(buf,
sizeof(buf));
83 std::streampos pos = in.tellg();
86 for (ins = 0; !in.eof(); ins++) {
90 in.getline(buf,
sizeof(buf));
98 silent_cout(
"VariableStepFileDrive(" << uL <<
"): "
99 "counted " << ins <<
" steps" << std::endl);
114 silent_cerr(
"unexpected end of file '"
115 << sFileName <<
'\'' << std::endl);
120 for (c = in.get(); isspace(c); c = in.get()) {
123 silent_cerr(
"unexpected end of line #" << j + 1 <<
" after time=" << pvd[0][j] <<
", column #" << i + 1 <<
" of file '"
124 << sFileName <<
'\'' << std::endl);
128 silent_cerr(
"unexpected end of line #" << j + 1 <<
", time=" << pvd[0][j] <<
" after channel #" << i <<
", column #" << i + 1 <<
" of file '"
129 << sFileName <<
'\'' << std::endl);
137 silent_cerr(
"missing end-of-line at line #" << j + 1 <<
", time=" << pvd[0][j] <<
" of file '"
138 << sFileName <<
'\'' << std::endl);
146 if (
pvd[0][j] <=
pvd[0][j - 1]) {
147 silent_cerr(
"time[" << j <<
"]=" <<
pvd[0][j]
148 <<
" <= time[" << j - 1 <<
"]=" <<
pvd[0][j - 1]
149 <<
" in file '" << sFileName <<
"'" << std::endl);
177 return out <<
"0. /* VariableStepFileDrive: not implemented yet! */"
184 if (t <=
pvd[0][0]) {
188 "A variable step file drive lower bound is halting the simulation");
206 "A variable step file drive upper bound is halting the simulation");
266 silent_cerr(
"VariableStepFileDrive(" << uLabel <<
"): "
267 "invalid channels number " << idrives
279 silent_cerr(
"VariableStepFileDrive(" << uLabel <<
"): "
280 "unknown value for \"interpolation\" "
291 silent_cerr(
"VariableStepFileDrive(" << uLabel <<
"): "
292 "unknown value for \"pad zeros\" "
311 silent_cerr(
"VariableStepFileDrive(" << uLabel <<
"): "
312 "invalid bailout parameter "
#define MBDYN_EXCEPT_ARGS
virtual integer GetInt(integer iDefval=0)
#define SAFEDELETEARR(pnt)
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
const DriveHandler * pGetDrvHdl(void) const
virtual Drive * Read(unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
virtual void ServePending(const doublereal &t)
static const std::vector< doublereal > v0
virtual bool IsKeyWord(const char *sKeyWord)
VariableStepFileDrive(unsigned int uL, const DriveHandler *pDH, const char *const sFileName, integer id, bool bl, bool pz, Drive::Bailout bo)
#define ASSERT(expression)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
static std::stack< cleanup * > c
virtual bool GetYesNo(bool &bRet)
doublereal dGetTime(void) const
#define SAFENEWARR(pnt, item, sz)
virtual ~VariableStepFileDrive(void)
static doublereal buf[BUFSIZE]
virtual HighParser::ErrOut GetLineData(void) const
virtual std::ostream & Restart(std::ostream &out) const