/*************************************************************************** * Copyright (c) 2023 Ondsel, Inc. * * * * This file is part of OndselSolver. * * * * See LICENSE file for details about copyright. * ***************************************************************************/ #include "DifferentiatedGeneralSpline.h" #include "GeneralSpline.h" using namespace MbD; MbD::DifferentiatedGeneralSpline::DifferentiatedGeneralSpline(Symsptr arg, Symsptr spline, size_t derivOrder) : AnyGeneralSpline(arg), generalSpline(spline), derivativeOrder(derivOrder) { } double MbD::DifferentiatedGeneralSpline::getValue() { return std::static_pointer_cast(generalSpline)->derivativeAt(derivativeOrder, xx->getValue()); } Symsptr MbD::DifferentiatedGeneralSpline::differentiateWRTx() { auto arg = std::static_pointer_cast(generalSpline)->xx; auto deriv = std::make_shared(arg, generalSpline, derivativeOrder + 1); return deriv; } Symsptr MbD::DifferentiatedGeneralSpline::clonesptr() { return std::make_shared(*this); } std::ostream& MbD::DifferentiatedGeneralSpline::printOn(std::ostream& s) const { s << "deriv(" << *generalSpline << ", " << derivativeOrder << ")"; return s; } Symsptr MbD::DifferentiatedGeneralSpline::copyWith(Symsptr arg) { auto clone = clonesptr(); std::static_pointer_cast(clone)->setX(arg); return clone; }