Files
solver/MbDCode/IntegratorInterface.cpp
2023-06-11 07:15:20 -06:00

47 lines
992 B
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(SystemSolver* sys)
{
system = 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;
}