/*! \file pimathsolver.h * \brief PIMathSolver */ /* PIP - Platform Independent Primitives PIMathSolver Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef PIMATHSOLVER_H #define PIMATHSOLVER_H #include "pimathmatrix.h" /// Differential evaluations struct PIP_EXPORT TransferFunction { PIVector vector_Bm, vector_An; }; class PIP_EXPORT PIMathSolver { public: enum Method { Global = -1, Eyler_1 = 01, Eyler_2 = 02, EylerKoshi = 03, RungeKutta_4 = 14, AdamsBashfortMoulton_2 = 22, AdamsBashfortMoulton_3 = 23, AdamsBashfortMoulton_4 = 24, PolynomialApproximation_2 = 32, PolynomialApproximation_3 = 33, PolynomialApproximation_4 = 34, PolynomialApproximation_5 = 35 }; PIMathSolver(); void solve(double u, double h); void fromTF(const TransferFunction & TF); void setMethod(Method m) { method = m; } void setTime(double time); void solveEyler1(double u, double h); void solveEyler2(double u, double h); void solveRK4(double u, double h); void solveABM2(double u, double h); void solveABM3(double u, double h); void solveABM4(double u, double h); void solvePA(double u, double h, uint deg); void solvePA2(double u, double h); void solvePA3(double u, double h); void solvePA4(double u, double h); void solvePA5(double u, double h); PIMathVectord X; static Method method_global; static const char methods_desc[]; private: void moveF(); PIMathMatrixd A, M; PIMathVectord d, a1, b1; PIMathVectord k1, k2, k3, k4, xx; PIMathVectord XX, Y, pY; PIVector F; PIVector times; uint size = 0, step = 0; Method method = Global; double sum = 0., td = 0., ct = 0., lp = 0., dh = 0., t = 0., x1 = 0., x0 = 0.; bool ok = false; }; #endif // PIMATHSOLVER_H