I12h.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * @file malaria/Si.cpp
  3. *
  4. * This file is part of VLE, a framework for multi-modeling, simulation
  5. * and analysis of complex dynamical systems
  6. * http://www.vle-project.org
  7. *
  8. * Copyright (c) 2011 INRA http://www.inra.fr
  9. *
  10. * See the AUTHORS or Authors.txt file for copyright owners and contributors
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. /* @@tagdepends: vle.extension.differential-equation @@endtagdepends
  26. @@tagdynamic@@ */
  27. #include <vle/extension/DifferentialEquation.hpp>
  28. #include <iostream>
  29. #include <sstream>
  30. namespace malariaspread {
  31. namespace ved = vle::extension::differential_equation;
  32. class I12h :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. I12h(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. delta_H2 = events.getDouble("delta_H2");; // = ???
  41. alpha_2 = events.getDouble("alpha_2"); // = ???
  42. gamma_2 = events.getDouble("gamma_2"); // = ???
  43. d2_H2 = events.getDouble("d2_H2"); // = ???
  44. _I12h = createVar("I12h");
  45. _E12h = createExt("E12h");
  46. }
  47. virtual ~I12h()
  48. { }
  49. void compute(const vle::devs::Time& /* time */)
  50. {
  51. grad(_I12h) = delta_H2*_E12h() -alpha_2*_I12h() - gamma_2*_I12h() - d2_H2*_I12h();
  52. }
  53. private:
  54. // transition rate from E -> I for the patch 2 of the host population
  55. double delta_H2;
  56. // transition rate from I -> R for the patch 2 of the host population
  57. double alpha_2;
  58. //death rate due to the disease
  59. double gamma_2;
  60. // natural death rate of I in the host population for the patch 2
  61. double d2_H2;
  62. Var _I12h;
  63. Ext _E12h;
  64. };
  65. } // namespace malariaspread
  66. DECLARE_DYNAMICS(malariaspread::I12h)