Files
solver/MbDCode/IntegratorInterface.cpp
Aik-Siong Koh 371b13a9e0 runVelIC
2023-06-18 01:06:39 -06:00

52 lines
1.1 KiB
C++

#include <string>
#include "IntegratorInterface.h"
#include "SystemSolver.h"
#include "BasicQuasiIntegrator.h"
using namespace MbD;
void MbD::IntegratorInterface::initializeGlobally()
{
tstart = system->startTime();
hout = system->outputStepSize();
hmax = system->maxStepSize();
hmin = system->minStepSize();
tout = system->firstOutputTime();
tend = system->endTime();
direction = (tstart < tend) ? 1.0 : -1.0;
}
void MbD::IntegratorInterface::setSystem(Solver* sys)
{
system = static_cast<SystemSolver*>(sys);
}
void MbD::IntegratorInterface::logString(std::string& str)
{
system->logString(str);
}
void MbD::IntegratorInterface::run()
{
this->preRun();
this->initializeLocally();
this->initializeGlobally();
if (hout > (4 * std::numeric_limits<double>::epsilon()) && (direction * tout < (direction * (tend + (0.1 * direction * hout))))) {
integrator->run();
}
this->finalize();
this->reportStats();
this->postRun();
}
int MbD::IntegratorInterface::orderMax()
{
return system->orderMax;
}
void MbD::IntegratorInterface::incrementTime(double tnew)
{
system->settime(tnew);
}