MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
FactorTSR Class Reference
Inheritance diagram for FactorTSR:
Collaboration diagram for FactorTSR:

Public Member Functions

TimeStepControlRead (Solver *s, MBDynParser &HP)
 
- Public Member Functions inherited from TimeStepRead
virtual ~TimeStepRead (void)
 

Detailed Description

Definition at line 288 of file TimeStepControl.cc.

Member Function Documentation

TimeStepControl * FactorTSR::Read ( Solver s,
MBDynParser HP 
)
virtual

Implements TimeStepRead.

Definition at line 294 of file TimeStepControl.cc.

References HighParser::ErrValueOutOfRange< T >::Get(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::IsArg(), and MBDynErrBase::what().

295 {
296  integer iMinIters = 1;
297  integer iMaxIters = 0;
298  doublereal dReductionFactor = 1.;
299  try {
300  dReductionFactor = HP.GetReal(1., HighParser::range_gt_le<doublereal>(0., 1.));
301 
303  silent_cerr("error: invalid reduction factor " << e.Get() << " (must be positive and less than (or equal to) one) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
304  throw e;
305  }
306 
307  integer iStepsBeforeReduction = 1;
308  try {
309  iStepsBeforeReduction = HP.GetInt(1, HighParser::range_ge<integer>(1));
310 
312  silent_cerr("error: invalid number of steps before reduction " << e.Get() << " (must be greater than zero) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
313  throw e;
314  }
315 
316  doublereal dRaiseFactor = 1.;
317  try {
318  dRaiseFactor = HP.GetReal(1., HighParser::range_ge<doublereal>(1.));
319 
321  silent_cerr("error: invalid increase factor " << e.Get() << " (must be greater than (or equal to) one) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
322  throw e;
323  }
324 
325  integer iStepsBeforeRaise = 1;
326  try {
327  iStepsBeforeRaise = HP.GetInt(1, HighParser::range_ge<integer>(1));
328 
330  silent_cerr("error: invalid number of steps before increase " << e.Get() << " (must be greater than zero) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
331  throw e;
332  }
333 
334  try {
335  iMinIters = HP.GetInt(1, HighParser::range_ge<integer>(1));
336 
338  silent_cerr("error: invalid number of minimum iterations " << e.Get() << " (must be greater than zero) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
339  throw e;
340  }
341 
342  iMaxIters = 0;
343  if (HP.IsArg()) {
344  try {
345  iMaxIters = HP.GetInt(1, HighParser::range_ge<integer>(1));
346 
348  silent_cerr("error: invalid number of maximum iterations " << e.Get() << " (must be greater than zero) [" << e.what() << "] at line " << HP.GetLineData() << std::endl);
349  throw e;
350  }
351  }
352 
353  // RETURN THE new FACTOR
354  return new Factor(s, dReductionFactor,
355  iStepsBeforeReduction,
356  dRaiseFactor,
357  iStepsBeforeRaise,
358  iMinIters,
359  iMaxIters);
360 }
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
const char * what(void) const
Definition: except.cc:54
virtual bool IsArg(void)
Definition: parser.cc:807
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:


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