Building Medical Digital Twins with Pulse: Open Source Simulation Tools for Developers and Researchers
×
GastrointestinalModel.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 #include "engine/common/system/Model.h"
7 #include "engine/common/system/Systems.h"
8 
11 class SEFluidCircuitPath;
12 
13 namespace pulse
14 {
15  class PBPhysiology;
16  class EngineTest;
20  class PULSE_DECL GastrointestinalModel : public GastrointestinalSystem, public Model
21  {
22  friend PBPhysiology;//friend the serialization class
23  friend EngineTest;
24  public:
25  GastrointestinalModel(Data& data);
26  virtual ~GastrointestinalModel();
27 
28  void Clear() override;
29 
30  // Set members to a stable homeostatic state
31  void Initialize() override;
32  // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
33  void SetUp() override;
34 
35  void AtSteadyState() override;
36  void PreProcess() override;
37  void Process(bool solve_and_transport = true) override;
38  void PostProcess(bool solve_and_transport = true) override;
39 
40  protected:
41  void ComputeExposedModelParameters() override;
42 
43  void DefaultNutritionRates(SENutrition& n);
44  void DigestStomachNutrients(double duration_s);
45  double DigestNutrient(SEUnitScalar& totalAmt, SEUnitScalar& rate, bool mass, double duration_s);
46 
47  // Serializable member variables (Set in Initialize and in schema)
48 
49  // Stateless member variable (Set in SetUp())
50  SEFluidCircuitPath* m_GItoCVPath;
51  SEScalarMassPerTime* m_CalciumDigestionRate;
52  SEScalarVolumePerTime* m_WaterDigestionRate;
53 
54  SELiquidCompartment* m_SmallIntestine;
55  SELiquidSubstanceQuantity* m_SmallIntestineGlucose;
56  SELiquidSubstanceQuantity* m_SmallIntestineTristearin;
57  SELiquidSubstanceQuantity* m_SmallIntestineCalcium;
58  SELiquidSubstanceQuantity* m_SmallIntestineSodium;
59  SELiquidSubstanceQuantity* m_SmallIntestineUrea;
60  SELiquidCompartment* m_SmallIntestineChyme;
61 
62  bool m_ConsumeRate; // Some substance digestion rates are specified by the user, some by configuration,
63  //if the stomach runs out of a substance with a user provided rate, we invalidate the rate (true)
64  //if the rate is a configuration rate, we don't want to invalidate it if we run out of the substance (false)
65  };
66 END_NAMESPACE
Definition: PBPhysiology.h:24
Definition: SEFluidCircuitPath.h:9
Definition: SELiquidCompartment.h:11
Definition: SELiquidSubstanceQuantity.h:12
Definition: SENutrition.h:7
Definition: SEScalarMassPerTime.h:31
Definition: SEScalarVolumePerTime.h:32
An interface to be used for gaining access to a scalar with any unit type
Definition: SEScalar.h:178
Definition: Logger.h:14

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.