Commit e6542b80 authored by Aaron Bray's avatar Aaron Bray
Browse files

Support shorthand naming for hemorrhage compartments

parent 6419cb05
Name: "InitialStableState" Name: "InitialStableState"
Description: "Stabilize a patient and save out the engines state at time zero" Description: "Stabilize a patient and save out the engines state at time zero"
InitialParameters { PatientFile:"StandardMale.pba" } StartType { PatientConfiguration { PatientFile:"StandardMale.pba" } }
AnyAction AnyAction
{ {
......
Name: "Vitals Monitor" Name: "Vitals Monitor"
Description: "Data associated with a vitals monitor." Description: "Data associated with a vitals monitor."
InitialParameters { PatientFile:"StandardMale.pba" } StartType { PatientConfiguration { PatientFile:"StandardMale.pba" } }
DataRequestManager DataRequestManager
{ {
......
...@@ -361,7 +361,6 @@ bool SEPatientActionCollection::ProcessAction(const SEPatientAction& action) ...@@ -361,7 +361,6 @@ bool SEPatientActionCollection::ProcessAction(const SEPatientAction& action)
if (!m_PericardialEffusion->IsActive()) if (!m_PericardialEffusion->IsActive())
RemovePericardialEffusion(); RemovePericardialEffusion();
return true; return true;
} }
const SESubstanceBolus* bolus = dynamic_cast<const SESubstanceBolus*>(&action); const SESubstanceBolus* bolus = dynamic_cast<const SESubstanceBolus*>(&action);
......
...@@ -961,9 +961,12 @@ void Cardiovascular::Hemorrhage() ...@@ -961,9 +961,12 @@ void Cardiovascular::Hemorrhage()
{ {
h = hem.second; h = hem.second;
double rate_mL_Per_s = h->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s); double rate_mL_Per_s = h->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s);
SELiquidCompartment* compartment = m_data.GetCompartments().GetLiquidCompartment(h->GetCompartment()); // Allow shorthand naming
if(h->GetCompartment().find("Vasculature") == std::string::npos)
h->SetCompartment(h->GetCompartment() + "Vasculature");
SELiquidCompartment* compartment = m_data.GetCompartments().GetCardiovascularGraph().GetCompartment(h->GetCompartment());
/// \error Fatal: Bleeding rate cannot exceed cardiac output /// \error Error: Bleeding rate cannot exceed cardiac output
if (rate_mL_Per_s > GetCardiacOutput().GetValue(VolumePerTimeUnit::mL_Per_s)) if (rate_mL_Per_s > GetCardiacOutput().GetValue(VolumePerTimeUnit::mL_Per_s))
{ {
m_ss << "Cannot have bleeding rate greater than cardiac output. \n\tCurrent cardiac output is: " << GetCardiacOutput() m_ss << "Cannot have bleeding rate greater than cardiac output. \n\tCurrent cardiac output is: " << GetCardiacOutput()
...@@ -972,7 +975,7 @@ void Cardiovascular::Hemorrhage() ...@@ -972,7 +975,7 @@ void Cardiovascular::Hemorrhage()
invalid_hemorrhages.push_back(h); invalid_hemorrhages.push_back(h);
continue; continue;
} }
/// \error Fatal: Bleeding rate cannot be less than zero /// \error Error: Bleeding rate cannot be less than zero
if (rate_mL_Per_s < 0) if (rate_mL_Per_s < 0)
{ {
m_ss << "Cannot specify bleeding less than 0"; m_ss << "Cannot specify bleeding less than 0";
...@@ -980,7 +983,7 @@ void Cardiovascular::Hemorrhage() ...@@ -980,7 +983,7 @@ void Cardiovascular::Hemorrhage()
invalid_hemorrhages.push_back(h); invalid_hemorrhages.push_back(h);
continue; continue;
} }
/// \error Fatal: Bleeding must be from a vascular compartment /// \error Error: Bleeding must be from a vascular compartment
if (!compartment) if (!compartment)
{ {
m_ss << "Cannot hemorrhage from compartment "+h->GetComment()+", must be a valid vascular compartment"; m_ss << "Cannot hemorrhage from compartment "+h->GetComment()+", must be a valid vascular compartment";
...@@ -1026,6 +1029,7 @@ void Cardiovascular::Hemorrhage() ...@@ -1026,6 +1029,7 @@ void Cardiovascular::Hemorrhage()
/// \error Fatal: Bleeding must come from nodes in the circultatory circuit /// \error Fatal: Bleeding must come from nodes in the circultatory circuit
if (nodes.size() == 0) if (nodes.size() == 0)
{ {
/// \error Error: Hemorrhage compartments must have nodes in the circulatory circuit
m_ss << "Hemorrhage compartments must have nodes in the circulatory circuit"; m_ss << "Hemorrhage compartments must have nodes in the circulatory circuit";
Error(m_ss); Error(m_ss);
invalid_hemorrhages.push_back(h); invalid_hemorrhages.push_back(h);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment