R21h.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 R21h :
  33. public ved::DifferentialEquation
  34. {
  35. public:
  36. R21h(const vle::devs::DynamicsInit& model,
  37. const vle::devs::InitEventList& events) :
  38. ved::DifferentialEquation(model,events)
  39. {
  40. alpha_1 = events.getDouble("alpha_1"); // = ???
  41. d1_H1 = events.getDouble("d1_H1"); // = ???
  42. phi_r2 = events.getDouble("phi_r2"); // = ???
  43. _R21h = createVar("R21h");
  44. _I21h = createExt("I21h");
  45. _R2h= createExt("R2h");
  46. }
  47. virtual ~R21h()
  48. { }
  49. void compute(const vle::devs::Time& /* time */)
  50. {
  51. grad(_R21h) = alpha_1*_I21h() + phi_r2*_R2h() - d1_H1*_R21h();
  52. }
  53. private:
  54. // transition rate from i -> R for the patch i of the host population
  55. double alpha_1;
  56. // natural death rate of R in the host population for the patch i
  57. double d1_H1;
  58. // Recovered rate of host population of the patch 2 that left to patch 1 (Go)
  59. double phi_r2;
  60. Var _R21h;
  61. Ext _I21h;
  62. Ext _R2h;
  63. };
  64. } // namespace malariaspread
  65. DECLARE_DYNAMICS(malariaspread::R21h)