Skip to content

Commit c580489

Browse files
ntatum94StevenAWhite
authored andcommitted
Adjusting order of operations and warning messages
1 parent 7b0ab93 commit c580489

File tree

1 file changed

+9
-5
lines changed
  • projects/biogears/libBiogears/src/engine/Controller

1 file changed

+9
-5
lines changed

projects/biogears/libBiogears/src/engine/Controller/BioGears.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,21 +372,25 @@ bool BioGears::SetupPatient()
372372
weight_kg = m_Patient->GetWeight(MassUnit::kg);
373373
BMI_kg_per_m2 = weight_kg / std::pow(m_Patient->GetHeight().GetValue(LengthUnit::m), 2);
374374
if (BMI_kg_per_m2 > BMIObese_kg_per_m2) {
375-
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is too high. Obese patients must be modeled by adding/using a condition. Setting the patient to maximum BMI allowed of %f kg/m^2.", BMI_kg_per_m2, BMIObese_kg_per_m2));
375+
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is too high. Obese patients must be modeled by adding/using a condition. Adjusting patient weight using the maximum BMI allowed of %f kg/m^2.", BMI_kg_per_m2, BMIObese_kg_per_m2));
376376
weight_kg = BMIObese_kg_per_m2 * std::pow(m_Patient->GetHeight().GetValue(LengthUnit::m), 2);
377+
BMI_kg_per_m2 = weight_kg / std::pow(m_Patient->GetHeight().GetValue(LengthUnit::m), 2);
378+
Warning(asprintf("Patient weight has been overwritten to a value of %f kg.", weight_kg));
377379
m_Patient->GetWeight().SetValue(weight_kg, MassUnit::kg);
378380
}
379381
if (BMI_kg_per_m2 > BMIOverweight_kg_per_m2) {
380382
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is overweight. No guarantees of model validity.", BMI_kg_per_m2));
381383
}
382-
if (BMI_kg_per_m2 < BMIUnderweight_kg_per_m2) {
383-
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is underweight. No guarantees of model validity.", BMI_kg_per_m2));
384-
}
385384
if (BMI_kg_per_m2 < BMISeverelyUnderweight_kg_per_m2) {
386-
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is too low. Severly underweight patients must be modeled by adding/using a condition. Setting the patient to minimum BMI allowed of %f kg/m^2.", BMI_kg_per_m2, BMISeverelyUnderweight_kg_per_m2));
385+
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is too low. Severly underweight patients must be modeled by adding/using a condition. Adjusting patient weight using the minimum BMI allowed of %f kg/m^2.", BMI_kg_per_m2, BMISeverelyUnderweight_kg_per_m2));
387386
weight_kg = BMISeverelyUnderweight_kg_per_m2 * std::pow(m_Patient->GetHeight().GetValue(LengthUnit::m), 2);
387+
BMI_kg_per_m2 = weight_kg / std::pow(m_Patient->GetHeight().GetValue(LengthUnit::m), 2);
388+
Warning(asprintf("Patient weight has been overwritten to a value of %f kg.", weight_kg));
388389
m_Patient->GetWeight().SetValue(weight_kg, MassUnit::kg);
389390
}
391+
if (BMI_kg_per_m2 < BMIUnderweight_kg_per_m2) {
392+
Warning(asprintf("Patient Body Mass Index (BMI) of %f kg/m^2 is underweight. No guarantees of model validity.", BMI_kg_per_m2));
393+
}
390394

391395
//BODY FAT FRACTION ---------------------------------------------------------------
392396
//From American Council on Exercise

0 commit comments

Comments
 (0)