1. #include "Euler.h"
  2.  
  3. Euler::Euler()
  4. {
  5.  
  6. }
  7.  
  8. vec Euler::solve(std::vector< functPtr > functions)
  9. {
  10. vec solution;
  11. functPtr temp_ptr;
  12.  
  13. for (int i = 0; i < functions.size(); i++)
  14. {
  15. temp_ptr = functions[i];
  16. solution.push_back(this->initialConditions[i] + this->timeStep*temp_ptr(this->timeStep, this->initialConditions));
  17. }
  18.  
  19. return solution;
  20. }
  21.  
  22. void Euler::setTimeStep(double time)
  23. {
  24. this->timeStep = time;
  25. }
  26.  
  27. void Euler::setInitial(std::vector< double > initial)
  28. {
  29. this->initialConditions.clear();
  30. for(int i = 0; i < initial.size(); i++)
  31. this->initialConditions.push_back(initial[i]);
  32. }