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

Various Data Request Updates

Creation was not correct for several compartments
Made an easier way to get the current value of a DataRequest
Created an all encompassing method to get a compound unit from a string
parent cffe9a1a
......@@ -6,7 +6,7 @@ set(BUILD_SHARED_LIBS OFF)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
if(MSVC OR XCode)
# For multi configuration IDE environments start with release
set(CMAKE_CONFIGURATION_TYPES Release CACHE TYPE INTERNAL FORCE )
set(CMAKE_CONFIGURATION_TYPES Release CACHE STRING INTERNAL FORCE )
endif()
##################################
## EIGEN ##
......
......@@ -136,6 +136,9 @@ extern const std::string& eCharge_Name(eCharge m);
//
// End General Enum
// IF YOU ADD A NEW SCALAR TYPE
// PLEASE UPDATE THE METHOD IN SEProperty.cpp
class CCompoundUnit;
class SERunningAverage;
......
......@@ -61,8 +61,8 @@ protected:
mutable SEScalarPower* m_HeatTransferRateIn;
mutable SEScalarPower* m_HeatTransferRateOut;
SEScalarEnergy* m_Heat;
SEScalarTemperature* m_Temperature;
SEScalarEnergy* m_Heat;
SEScalarTemperature* m_Temperature;
std::vector<SEThermalCompartmentLink*> m_Links;
std::vector<SEThermalCompartmentLink*> m_IncomingLinks;
......
......@@ -332,63 +332,71 @@ SEDataRequest* SEDataRequestManager::FindLiquidCompartmentDataRequest(const std:
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateThermalCompartmentDataRequest(const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindThermalCompartmentDataRequest(property);
SEDataRequest* dr = FindThermalCompartmentDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::ThermalCompartment, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateThermalCompartmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindThermalCompartmentDataRequest(property);
SEDataRequest* dr = FindThermalCompartmentDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::ThermalCompartment, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindThermalCompartmentDataRequest(const std::string& property)
SEDataRequest* SEDataRequestManager::FindThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::ThermalCompartment && dr->GetPropertyName() == property)
if (dr->GetCategory() == eDataRequest_Category::ThermalCompartment &&
dr->GetCompartmentName() == cmptName &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateTissueCompartmentDataRequest(const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindTissueCompartmentDataRequest(property);
SEDataRequest* dr = FindTissueCompartmentDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::TissueCompartment, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateTissueCompartmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindTissueCompartmentDataRequest(property);
SEDataRequest* dr = FindTissueCompartmentDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::TissueCompartment, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindTissueCompartmentDataRequest(const std::string& property)
SEDataRequest* SEDataRequestManager::FindTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::TissueCompartment && dr->GetPropertyName() == property)
if (dr->GetCategory() == eDataRequest_Category::TissueCompartment &&
dr->GetCompartmentName() == cmptName &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
......@@ -429,32 +437,36 @@ SEDataRequest* SEDataRequestManager::FindSubstanceDataRequest(const SESubstance&
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(property);
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::AnesthesiaMachine, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(property);
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::AnesthesiaMachine, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindAnesthesiaMachineDataRequest(const std::string& property)
SEDataRequest* SEDataRequestManager::FindAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::AnesthesiaMachine && dr->GetPropertyName() == property)
if (dr->GetCategory() == eDataRequest_Category::AnesthesiaMachine &&
dr->GetCompartmentName() == cmptName &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
......@@ -491,32 +503,36 @@ SEDataRequest* SEDataRequestManager::FindECGDataRequest(const std::string& prope
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindInhalerDataRequest(property);
SEDataRequest* dr = FindInhalerDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::Inhaler, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindInhalerDataRequest(property);
SEDataRequest* dr = FindInhalerDataRequest(cmptName, property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::Inhaler, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindInhalerDataRequest(const std::string& property)
SEDataRequest* SEDataRequestManager::FindInhalerDataRequest(const std::string& cmptName, const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::Inhaler && dr->GetPropertyName() == property)
if (dr->GetCategory() == eDataRequest_Category::Inhaler &&
dr->GetCompartmentName() == cmptName &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
......
......@@ -61,23 +61,23 @@ public:
SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateECGDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateECGDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
protected:
// Methods to find data requests so we don't keep making the same one
......@@ -88,12 +88,12 @@ protected:
SEDataRequest* FindGasCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string property);
SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string property);
SEDataRequest* FindThermalCompartmentDataRequest(const std::string& property);
SEDataRequest* FindTissueCompartmentDataRequest(const std::string& property);
SEDataRequest* FindThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindSubstanceDataRequest(const SESubstance& sub, const std::string& property);
SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& property);
SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindECGDataRequest(const std::string& property);
SEDataRequest* FindInhalerDataRequest(const std::string& property);
SEDataRequest* FindInhalerDataRequest(const std::string& cmptName, const std::string& property);
std::string m_ResultsFilename;
double m_SamplesPerSecond;
......
......@@ -143,6 +143,16 @@ DataTrack& SEEngineTracker::GetDataTrack()
return *m_DataTrack;
}
double SEEngineTracker::GetValue(const SEDataRequest& dr) const
{
auto drs = GetScalar(dr);
if (drs == nullptr)
return SEScalar::dNaN();
if (dr.HasUnit())
return drs->GetValue(*dr.GetUnit());
return drs->GetValue();
}
const SEDataRequestScalar* SEEngineTracker::GetScalar(const SEDataRequest& dr) const
{
auto found = m_Request2Scalar.find(&dr);
......
......@@ -29,7 +29,9 @@ enum class CompartmentUpdate {None,
enum class TrackMode { CSV, Dynamic };
class SEDataRequestScalar : public SEGenericScalar
{
public:
friend class SEEngineTracker;
friend class SEDynamicStabilizationPropertyConvergence;
protected:
SEDataRequestScalar(Logger* logger) : SEGenericScalar(logger)
{
Heading.clear();
......@@ -72,8 +74,6 @@ public:
bool ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds);
const SEDataRequestScalar* GetScalar(const SEDataRequest& dr) const;
virtual void SetupRequests();
virtual void TrackData(double currentTime_s=0);
virtual void PullData();
......@@ -82,8 +82,12 @@ public:
void SetTrackMode(TrackMode m) { m_Mode = m; }
TrackMode GetTrackMode() { return m_Mode; }
double GetValue(const SEDataRequest& dr) const;
protected:
const SEDataRequestScalar* GetScalar(const SEDataRequest& dr) const;
TrackMode m_Mode= TrackMode::CSV;
bool m_ForceConnection;
DataTrack* m_DataTrack;
......
......@@ -3,7 +3,6 @@
#pragma once
#include "properties/SEProperty.h"
#include "utils/unitconversion/UCCommon.h"
class CDM_DECL SEFunction : public SEProperty
{
......
......@@ -3,7 +3,6 @@
#pragma once
#include "properties/SEProperty.h"
#include "utils/unitconversion/UCCommon.h"
class CDM_DECL SEHistogram : public SEProperty
{
......
......@@ -17,3 +17,163 @@ SEProperty::~SEProperty()
void SEProperty::Clear()
{
}
#include "properties/SEScalarAmount.h"
#include "properties/SEScalarAmountPerMass.h"
#include "properties/SEScalarAmountPerTime.h"
#include "properties/SEScalarAmountPerVolume.h"
#include "properties/SEScalarArea.h"
#include "properties/SEScalarAreaPerTimePressure.h"
#include "properties/SEScalarElectricCapacitance.h"
#include "properties/SEScalarElectricCharge.h"
#include "properties/SEScalarElectricCurrent.h"
#include "properties/SEScalarElectricInductance.h"
#include "properties/SEScalarElectricPotential.h"
#include "properties/SEScalarElectricResistance.h"
#include "properties/SEScalarEnergy.h"
#include "properties/SEScalarEnergyPerAmount.h"
#include "properties/SEScalarEnergyPerMass.h"
#include "properties/SEScalarFlowCompliance.h"
#include "properties/SEScalarFlowElastance.h"
#include "properties/SEScalarFlowInertance.h"
#include "properties/SEScalarFlowResistance.h"
#include "properties/SEScalarForce.h"
#include "properties/SEScalarFrequency.h"
#include "properties/SEScalarHeatCapacitance.h"
#include "properties/SEScalarHeatCapacitancePerAmount.h"
#include "properties/SEScalarHeatCapacitancePerMass.h"
#include "properties/SEScalarHeatConductance.h"
#include "properties/SEScalarHeatConductancePerArea.h"
#include "properties/SEScalarHeatInductance.h"
#include "properties/SEScalarHeatResistance.h"
#include "properties/SEScalarHeatResistanceArea.h"
#include "properties/SEScalarInversePressure.h"
#include "properties/SEScalarInverseVolume.h"
#include "properties/SEScalarLength.h"
#include "properties/SEScalarLengthPerTime.h"
#include "properties/SEScalarLengthPerTimePressure.h"
#include "properties/SEScalarMass.h"
#include "properties/SEScalarMassPerAmount.h"
#include "properties/SEScalarMassPerAreaTime.h"
#include "properties/SEScalarMassPerMass.h"
#include "properties/SEScalarMassPerTime.h"
#include "properties/SEScalarMassPerVolume.h"
#include "properties/SEScalarOsmolality.h"
#include "properties/SEScalarOsmolarity.h"
#include "properties/SEScalarPower.h"
#include "properties/SEScalarPowerPerAreaTemperatureToTheFourth.h"
#include "properties/SEScalarPressure.h"
#include "properties/SEScalarPressurePerVolume.h"
#include "properties/SEScalarPressureTimePerArea.h"
#include "properties/SEScalarPressureTimePerVolumeArea.h"
#include "properties/SEScalarTemperature.h"
#include "properties/SEScalarTime.h"
#include "properties/SEScalarVolume.h"
#include "properties/SEScalarVolumePerPressure.h"
#include "properties/SEScalarVolumePerTime.h"
#include "properties/SEScalarVolumePerTimeArea.h"
#include "properties/SEScalarVolumePerTimeMass.h"
#include "properties/SEScalarVolumePerTimePressure.h"
#include "properties/SEScalarVolumePerTimePressureArea.h"
double Convert(double d, const CCompoundUnit& from, const CCompoundUnit& to)
{
if (&from == &to)
return d;
// I am assuming we are not going to do Quantity A to Quantity B Conversions
return CUnitConversionEngine::GetEngine().QuickConvertValue(d, from, to);
}
bool CompatibleUnits(const CCompoundUnit& from, const CCompoundUnit& to)
{
if (from == to)
return true;
if (from.GetDimension() == to.GetDimension())
return true;
// See if the quantity types (Dimensions) are convertable
double fromExp;
CCompoundUnit mappingUnit;
CUnitConversionEngine &uce = CUnitConversionEngine::GetEngine();
if (uce.GetQuantityConversionParams(from.GetDimension(), to.GetDimension(), fromExp, mappingUnit))
return true;
return false;
}
#define IS_A(UNIT) \
try \
{ \
auto& ccu = UNIT::GetCompoundUnit(unit); \
UnitMap[unit] = &ccu; \
return ccu; \
} catch (...) {} \
const CCompoundUnit& GetUnit(const std::string& unit)
{
static std::unordered_map<std::string, const CCompoundUnit*> UnitMap;
auto u = UnitMap.find(unit);
if (u != UnitMap.end())
return *u->second;
IS_A(AmountUnit);
IS_A(AmountPerMassUnit);
IS_A(AmountPerTimeUnit);
IS_A(AmountPerVolumeUnit);
IS_A(AreaUnit);
IS_A(AreaPerTimePressureUnit);
IS_A(ElectricCapacitanceUnit);
IS_A(ElectricChargeUnit);
IS_A(ElectricCurrentUnit);
IS_A(ElectricInductanceUnit);
IS_A(ElectricPotentialUnit);
IS_A(ElectricResistanceUnit);
IS_A(EnergyUnit);
IS_A(EnergyPerAmountUnit);
IS_A(EnergyPerMassUnit);
IS_A(FlowComplianceUnit);
IS_A(FlowElastanceUnit);
IS_A(FlowInertanceUnit);
IS_A(FlowResistanceUnit);
IS_A(ForceUnit);
IS_A(FrequencyUnit);
IS_A(HeatCapacitanceUnit);
IS_A(HeatCapacitancePerAmountUnit);
IS_A(HeatCapacitancePerMassUnit);
IS_A(HeatConductanceUnit);
IS_A(HeatConductancePerAreaUnit);
IS_A(HeatInductanceUnit);
IS_A(HeatResistanceUnit);
IS_A(HeatResistanceAreaUnit);
IS_A(InversePressureUnit);
IS_A(InverseVolumeUnit);
IS_A(LengthUnit);
IS_A(LengthPerTimeUnit);
IS_A(LengthPerTimePressureUnit);
IS_A(MassUnit);
IS_A(MassPerAmountUnit);
IS_A(MassPerAreaTimeUnit);
IS_A(MassPerMassUnit);
IS_A(MassPerTimeUnit);
IS_A(MassPerVolumeUnit);
IS_A(OsmolalityUnit);
IS_A(OsmolarityUnit);
IS_A(PowerUnit);
IS_A(PowerPerAreaTemperatureToTheFourthUnit);
IS_A(PressureUnit);
IS_A(PressurePerVolumeUnit);
IS_A(PressureTimePerAreaUnit);
IS_A(PressureTimePerVolumeAreaUnit);
IS_A(TemperatureUnit);
IS_A(TimeUnit);
IS_A(VolumeUnit);
IS_A(VolumePerPressureUnit);
IS_A(VolumePerTimeUnit);
IS_A(VolumePerTimeAreaUnit);
IS_A(VolumePerTimeMassUnit);
IS_A(VolumePerTimePressureUnit);
IS_A(VolumePerTimePressureAreaUnit);
std::stringstream err;
err << "Could not map unit " << unit << " to any CDM Unit Type";
throw CommonDataModelException(err.str());
}
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#pragma once
#include "utils/unitconversion/UCCommon.h"
class CDM_DECL SEProperty
{
......@@ -17,5 +17,8 @@ public:
virtual void Invalidate()=0;
virtual bool IsValid() const=0;
};
};
\ No newline at end of file
CDM_DECL const CCompoundUnit& GetCompoundUnit(const std::string& unit);
CDM_DECL bool CompatibleUnits(const CCompoundUnit& u1, const CCompoundUnit& u2);
CDM_DECL double Convert(double d, const CCompoundUnit& from, const CCompoundUnit& to);
\ No newline at end of file
......@@ -253,25 +253,3 @@ double SEGenericScalar::GetValue(const CCompoundUnit& unit) const
return m_UnitScalar->GetValue(unit);
}
double Convert(double d, const CCompoundUnit& from, const CCompoundUnit& to)
{
if (&from == &to)
return d;
// I am assuming we are not going to do Quantity A to Quantity B Conversions
return CUnitConversionEngine::GetEngine().QuickConvertValue(d,from,to);
}
bool CompatibleUnits(const CCompoundUnit& from, const CCompoundUnit& to)
{
if (from==to)
return true;
if (from.GetDimension() == to.GetDimension())
return true;
// See if the quantity types (Dimensions) are convertable
double fromExp;
CCompoundUnit mappingUnit;
CUnitConversionEngine &uce = CUnitConversionEngine::GetEngine();
if(uce.GetQuantityConversionParams(from.GetDimension(), to.GetDimension(), fromExp,mappingUnit))
return true;
return false;
}
......@@ -3,7 +3,6 @@ See accompanying NOTICE file for details.*/
#pragma once
#include "properties/SEProperty.h"
#include "utils/unitconversion/UCCommon.h"
#define ZERO_APPROX 1e-10
......@@ -215,9 +214,6 @@ protected:
const SEUnitScalar* m_UnitScalar;
};
CDM_DECL double Convert(double d, const CCompoundUnit& from, const CCompoundUnit& to);
CDM_DECL bool CompatibleUnits(const CCompoundUnit& u1, const CCompoundUnit& u2);
inline void Override(const SEScalar& from, SEScalar& to)
{
bool b = to.IsReadOnly();
......
Markdown is supported
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