Files
solver/OndselSolver/IntegratorInterface.cpp
aiksiongkoh 3d6a23a678 Cmake gtest (#72)
* Check rackpin and gear for zero radii

* rebase zero-radii-check (#69)

* contributing

* Update push-freecad.yml

updated actions/checkout to v4

* dragging log for debugging

* fix calcdxNorm crash

* setDebug and remove MBDyn*

* Update cmakelists.txt

* fix includes for gcc-14

gcc-14 is more disciplined about not including <algorithm> transitively.

* fix runDragStep

* backhoe files (#65)

* Mark unused variables to silence compiler warnings. (#64)

* Backhoe issues (#67)

* backhoe issues

* runDragStep edit

* backhoe issues

* runDragStep edit

* Reduce large drag step progressively until convergence.

* Switch to using built-in M_PI, even on MSVC (#68)

---------

Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain>
Co-authored-by: mosfet80 <realeandrea@yahoo.it>
Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
Co-authored-by: Jed Brown <jed@jedbrown.org>
Co-authored-by: sliptonic <shopinthewoods@gmail.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* in progress

* Gtest added

---------

Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain>
Co-authored-by: mosfet80 <realeandrea@yahoo.it>
Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
Co-authored-by: Jed Brown <jed@jedbrown.org>
Co-authored-by: sliptonic <shopinthewoods@gmail.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-07-30 14:45:59 -06:00

85 lines
2.3 KiB
C++

/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include <string>
#include "IntegratorInterface.h"
#include "SystemSolver.h"
#include "BasicQuasiIntegrator.h"
using namespace MbD;
void 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 IntegratorInterface::setSystem(Solver* sys)
{
system = static_cast<SystemSolver*>(sys);
}
void IntegratorInterface::logString(const std::string& str)
{
system->logString(str);
}
void 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();
}
size_t IntegratorInterface::orderMax()
{
return system->orderMax;
}
void IntegratorInterface::incrementTime(double tnew)
{
system->settime(tnew);
}
void IntegratorInterface::postFirstStep()
{
assert(false); //Not used.
//system->postFirstStep();
//if (integrator->istep > 0) {
// //"Noise make checking at the start unreliable."
// this->checkForDiscontinuity();
//}
//this->checkForOutputThrough(integrator->t);
}
void IntegratorInterface::interpolateAt(double)
{
//"Interpolate for system state at tArg and leave system in that state."
assert(false);
//auto yout = integrator->yDerivat(0, tArg);
//auto ydotout = integrator->yDerivat(1, tArg);
//auto yddotout = integrator->yDerivat(2, tArg);
//system->time(tArg);
//system->y(yout);
//system->ydot(ydotout);
//system->yddot(yddotout);
//system->simUpdateAll();
}