Gastrointestinal.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <biogears/cdm/CommonDataModel.h>
15 #include <biogears/exports.h>
16 
17 #include <biogears/cdm/properties/SEScalarMassPerTime.h>
18 #include <biogears/cdm/properties/SEScalarVolumePerTime.h>
19 #include <biogears/cdm/system/physiology/SEGastrointestinalSystem.h>
20 #include <biogears/engine/Controller/BioGearsSystem.h>
21 #include <biogears/schema/biogears/BioGearsPhysiology.hxx>
22 
23 namespace biogears {
24 class SELiquidCompartment;
25 class SELiquidSubstanceQuantity;
26 class SEFluidCircuitPath;
27 class BioGears;
28 
32 class BIOGEARS_API Gastrointestinal : public SEGastrointestinalSystem, public BioGearsSystem {
33  friend class BioGears;
34  friend class BioGearsEngineTest;
35 
36 protected:
37  static auto make_unique(BioGears& bg) -> std::unique_ptr<Gastrointestinal>;
40 
41 public:
42  virtual ~Gastrointestinal() override;
43 
44  static size_t TypeHash() { return reinterpret_cast<size_t>(&TypeHash); }
45  static constexpr char const* const TypeTag() { return "Gastrointestinal"; }
46  const char* classname() const override { return TypeTag(); }
47  size_t hash_code() const override { return TypeHash(); }
48 
49  void Clear() override;
50 
51  // Set members to a stable homeostatic state
52  void Initialize() override;
53 
54  // Load a state
55  virtual bool Load(const CDM::BioGearsGastrointestinalSystemData& in);
56  virtual CDM::BioGearsGastrointestinalSystemData* Unload() const override;
57 
58 protected:
59  virtual void Unload(CDM::BioGearsGastrointestinalSystemData& data) const;
60 
61  // Set pointers and other member variables common to both homeostatic initialization and loading a state
62  void SetUp() override;
63 
64 public:
65  void AtSteadyState() override;
66  void PreProcess() override;
67  void Process() override;
68  void PostProcess() override;
69 
70 protected:
71  void GastricSecretion(double duration_s);
72  void AbsorbNutrients();
73  void DigestNutrient();
74  void AbsorbMeal(double duration_s);
75  void AbsorbNutrients(double duration_s);
76 
77  void ProcessDrugCAT(); //Compartment, absorption, and transit model for oral drug dosing
78 
79  void ChymeSecretion();
80  // Serializable member variables (Set in Initialize and in schema)
81 
82  // Stateless member variable (Set in SetUp())
99 
104 
105  //Drug absoprtion member variables
106  std::vector<double> m_TransitPH;
107  std::vector<double> m_TransitVolume_mL;
108  std::vector<double> m_TransitSurfaceArea_cm2;
109  std::vector<double> m_EnterocyteVolumeFraction;
110  std::vector<double> m_TransitRate_Per_s;
111  std::vector<double> m_TransitBileSalts_mM;
112 
113  // We want to start simulation time 0 (after stabilization) with the initial gut mass from the meal specified in the config file
114  std::map<SELiquidSubstanceQuantity*, double> m_InitialSubstanceMasses_ug; // Used only during the final AtSteadyState
115 
116  bool m_ConsumeRate; // Some substance digestion rates are specified by the user, some by configuration,
117  //if the stomach runs out of a substance with a user provided rate, we invalidate the rate (true)
118  //if the rate is a configuration rate, we don't want to invalidate it if we run out of the substance (false)
119  bool m_DecrementNutrients; // True Signals that we decrement stomach nutrients when we digest them
120  // We do not decrement stomach contents during stabilization
122  double m_dT_s;
123 };
124 }
bool m_ConsumeRate
Definition: Gastrointestinal.h:116
std::vector< double > m_TransitSurfaceArea_cm2
Definition: Gastrointestinal.h:108
SELiquidSubstanceQuantity * m_smallintestineVAscularTriacylglycerol
Definition: Gastrointestinal.h:98
SELiquidSubstanceQuantity * m_SmallIntestineChymeSodium
Definition: Gastrointestinal.h:91
SEFluidCircuitPath * m_GItoCVPath
Definition: Gastrointestinal.h:100
SELiquidSubstanceQuantity * m_SmallIntestineVascularSodium
Definition: Gastrointestinal.h:93
std::vector< double > m_TransitBileSalts_mM
Definition: Gastrointestinal.h:111
SELiquidSubstanceQuantity * m_SmallIntestineChymeTriacylglycerol
Definition: Gastrointestinal.h:89
Definition: SELiquidSubstanceQuantity.h:28
BioGears & m_data
Definition: Gastrointestinal.h:39
Definition: SEFluidCircuitPath.h:25
std::vector< double > m_TransitPH
Definition: Gastrointestinal.h:106
Class corresponding to the BioGearsGastrointestinalSystemData schema type.
Definition: BioGearsPhysiology.hxx:3914
SELiquidCompartment * m_Lymph
Definition: Gastrointestinal.h:85
SEScalarVolumePerTime m_WaterDigestionRate
Definition: Gastrointestinal.h:103
std::vector< double > m_EnterocyteVolumeFraction
Definition: Gastrointestinal.h:109
Definition: SELiquidCompartment.h:27
SEScalarMassPerTime m_CalciumDigestionRate
Definition: Gastrointestinal.h:102
SEFluidCircuitPath * m_GutE3ToGroundPath
Definition: Gastrointestinal.h:101
SELiquidSubstanceQuantity * m_SmallIntestineVascularCalcium
Definition: Gastrointestinal.h:96
SELiquidSubstanceQuantity * m_LymphTriacylglycerol
Definition: Gastrointestinal.h:97
Definition: SEGastrointestinalSystem.h:26
Definition: BioGearsEngineTest.h:24
const char * classname() const override
Definition: Gastrointestinal.h:46
static size_t TypeHash()
Definition: Gastrointestinal.h:44
SELiquidSubstanceQuantity * m_SmallIntestineChymeAminoAcids
Definition: Gastrointestinal.h:87
SELiquidCompartment * m_vSmallIntestine
Definition: Gastrointestinal.h:84
Definition: Gastrointestinal.h:32
SELiquidSubstanceQuantity * m_smallIntestineVascularAminoAcids
Definition: Gastrointestinal.h:95
Definition: SEScalarVolumePerTime.h:40
static constexpr char const *const TypeTag()
Hopefully this returns a unique ID for every type.
Definition: Gastrointestinal.h:45
std::vector< double > m_TransitVolume_mL
Definition: Gastrointestinal.h:107
bool m_DecrementNutrients
Definition: Gastrointestinal.h:119
std::map< SELiquidSubstanceQuantity *, double > m_InitialSubstanceMasses_ug
Definition: Gastrointestinal.h:114
size_t hash_code() const override
Definition: Gastrointestinal.h:47
SELiquidSubstanceQuantity * m_SmallIntestineChymeCalcium
Definition: Gastrointestinal.h:90
SELiquidSubstanceQuantity * m_smallIntestineVascularGlucose
Definition: Gastrointestinal.h:94
Definition: SEScalarMassPerTime.h:40
std::vector< double > m_TransitRate_Per_s
Definition: Gastrointestinal.h:110
SELiquidSubstanceQuantity * m_SmallIntestineChymeUrea
Definition: Gastrointestinal.h:92
Manages and controls execution of all data/systems in BioGears.
Definition: BioGears.h:86
SELiquidSubstanceQuantity * m_SmallIntestineChymeAlbumin
Definition: Gastrointestinal.h:86
SELiquidSubstanceQuantity * m_SmallIntestineChymeGlucose
Definition: Gastrointestinal.h:88
Generic class for handling the BioGears stabilization methodology.
Definition: BioGearsSystem.h:23
Definition: SEElectricalCircuit.h:18
SELiquidCompartment * m_SmallIntestineChyme
Definition: Gastrointestinal.h:83
double m_secretionRate_mL_Per_s
Definition: Gastrointestinal.h:121
double m_dT_s
Definition: Gastrointestinal.h:122