====== XUnitSystem ====== **//Inherited from//** [[class::domain::nitem|NItem]], **//Inherited by//** NULL **//Friend class//** NULL **//Description//** XUnitSystem从NItem继承,封装了单位系统定义的数据及其方法,其类型标识为"CUNITSYSTEM"。 XT的单位系统以国际标准单位系统(SI)为基准,所有的数据在底层都按照SI单位存储读取,在应用层面用户可以定义自己的单位系统,XUnitSystem提供了用于SI与定制单位系之间的转换函数。 XUnitSystem预置了7个基本基本量纲单位以及40多种导出量纲单位,基本上覆盖了仿真分析中所使用的绝大多数单位类型。 |Unit_Length|"Length"| 0 | |Unit_Time|"Time"| 1| |Unit_Mass|"Mass"| 2| |Unit_Force|"Force"| 3| |Unit_Angle|"Angle"| 4| |Unit_Temperature|"Temperature"| 5 | |Unit_Area|"Area"| 6 | |Unit_Volume|"Volume"| 7 | |Unit_Velocity|"Velocity"| 8 | |Unit_Acceleration|"Acceleration"| 9 | |Unit_RotateVelo|"AngularVelocity"| 10 | |Unit_RotateAcc|"AngularAcceleration"| 11 | |Unit_Moment|"Moment"| 12 | |Unit_Pressure|"Pressure"| 13 | |Unit_Density|"Density"| 14 | |Unit_Stiffness|"Stiffness"| 15 | |Unit_RotateStiff|"RotateStiffness"| 16 | |Unit_DampingCoef|"DampingCoefficient"| 17 | |Unit_RotateDampingCoef|"RotateDampingCoefficient"| 18 | |Unit_Modulus|"ElasticModules"| 19 | |Unit_Energy|"Energy"| 20 | |Unit_Power|"Power"| 21 | |Unit_ThermalExCoef|"ThermalExpansionCoefficient"| 22 | |Unit_ThermalConductivity|"ThermalConductivity"| 23 | |Unit_ConvectionCoef|"ConvectionCoefficient"| 24 | |Unit_SpecificHeat|"SpecificHeat"| 25 | |Unit_HeatFlux|"HeatFlux"| 26 | |Unit_HeatGeneration|"HeatGeneration"| 27 | |Unit_LinearDensity|"MassPerUnitLength"| 28 | |Unit_SurfaceDensity|"MassPerUnitArea"| 29 | |Unit_AreaMomentInertia|"AreaMomentInertia"| 30 | |Unit_TorsionalConst|"TorsionalConstant"| 31 | |Unit_WarpCoef|"WarpingCoefficient"| 32 | |Unit_LinearMassMomentIntertia|"MassMomentOfInertiaPerUnitLength"| 33 | |Unit_MomentInertia|"MassMomentOfInertia"| 34 | |Unit_Stress|"Stress"| 35 | |Unit_Strain|"Strain"| 36 | |Unit_StrainEnergy|"StrainEnergy"| 37 | |Unit_ThermalEnergy|"ThermalEnergy"| 38 | |Unit_Frequency|"Frequency"| 39 | |Unit_VolumeEnergyDensity|"VolumeEnergyDensity"| 40 | |Unit_ElectricalResistivity|"ElectricalResistivity"| 41 | |Unit_StressReciprocal|"StressReciprocal"| 42 | |Unit_ThermalRadiation|"ThermalRadiation"| 43 | |Unit_DynamicViscosity|"DynamicViscosity"| 44 | |Unit_KinematicViscosity|"KinematicViscosity"| 45 | |Unit_FlowRate|"FlowRate"| 46 | |Unit_VelocityReciprocal|"VelocityReciprocal"| 47 | |Unit_EquivalentViscosity|"EquivalentViscosity"| 48 | **//Members//** * int [[xunitsystem#m_iunits[unit_type_count]|m_iUnits[Unit_Type_Count]]] **//Public interface//** * [[xunitsystem#xunitsystem1|XUnitSystem]](ulong id) * [[xunitsystem#~xunitsystem|~XUnitSystem]]() * static int [[xunitsystem#getunitcount|getUnitCount]](TypeID unitType) * static const char * [[xunitsystem#getunitstring|getUnitString]](TypeID unitType, ulong unitID) * static const char * [[xunitsystem#getunittypestring|getUnitTypeString]](TypeID unitType) * static double [[xunitsystem#converttosi|convertToSI]](TypeID unitType, ulong unitID, double curValue) * static double [[xunitsystem#convertfromsi|convertFromSI]](TypeID unitType, ulong unitID, double coreValue) * static int [[xunitsystem#getsiunit|getSIUnit]](TypeID unitType) * double [[xunitsystem#getvalue|getValue]](TypeID unitType, double siValue) const * double [[xunitsystem#getsivalue|getSIValue]](TypeID unitType, double value) const * int & [[xunitsystem#getunit|getUnit]](TypeID unitType) * int [[xunitsystem#getunit|getUnit]](TypeID unitType) const * void [[xunitsystem#setunit|setUnit]](TypeID unitType, ulong unitID) * virtual void [[xunitsystem#write|write]](XBinaryIO * io) * virtual ErrorCode [[xunitsystem#read|read]](XBinaryIO * io) ---- {{anchor:m_iunits[unit_type_count]}} **int m_iUnits[Unit_Type_Count]** 各类型单位选项数组 ---- {{anchor:xunitsystem1}} **XUnitSystem(ulong id)** *function: 构造函数 *parameters: - [i]ulong id: 对象ID *return value: 无 {{anchor:~xunitsystem}} **~XUnitSystem()** *function: 析构函数 *parameters: NULL *return value: 无 {{anchor:getunitcount}} **static int getUnitCount(TypeID unitType)** *function: 静态函数,获取指定类型的单位个数 *parameters: - [i]TypeID unitType: 单位类型 *return value: 指定类型的单位个数 {{anchor:getunitstring}} **static const char * getUnitString(TypeID unitType, ulong unitID)** *function: 静态函数,获取指定类型单位指定单位值的字符串 *parameters: - [i]TypeID unitType: 单位类型 - [i] ulong unitID: 单位值 *return value: {{anchor:getunittypestring}} **static const char * getUnitTypeString(TypeID unitType)** *function: 静态函数,获取指定类型单位的字符串 *parameters: - [i]TypeID unitType: 单位类型 *return value: 指定类型单位的字符串 {{anchor:converttosi}} **static double convertToSI(TypeID unitType, ulong unitID, double curValue)** *function: 将值转换为SI单位系统的值 *parameters: - [i]TypeID unitType: 单位类型 - [i] ulong unitID: 源单位值 - [i] double curValue: 源单位系下的值 *return value: SI单位系下的值 {{anchor:convertfromsi}} **static double convertFromSI(TypeID unitType, ulong unitID, double coreValue)** *function: 将SI单位系下的值转换为目标单位系的值 *parameters: - [i]TypeID unitType: 单位类型 - [i] ulong unitID: 目标单位值 - [i] double coreValue: SI单位系下的值 *return value: 目标单位系下的值 {{anchor:getsiunit}} **static int getSIUnit(TypeID unitType)** *function: 获取SI单位系下的指定类型的单位值 *parameters: - [i]TypeID unitType: 单位类型 *return value: SI单位系下的指定类型的单位值 {{anchor:getvalue}} **double getValue(TypeID unitType, double siValue) const** *function: 将SI系下的值转换为获取本单位系统下的值 *parameters: - [i]TypeID unitType: 单位类型 - [i] double siValue: SI系下的值 *return value: 本单位系统下的值 {{anchor:getsivalue}} **double getSIValue(TypeID unitType, double value) const** *function: 将本单位系统下的值转为SI系下的值 *parameters: - [i]TypeID unitType: 单位类型 - [i] double value: 本单位系统下的值 *return value: SI系下的值 {{anchor:getunit}} **int & getUnit(TypeID unitType)** *function: 获取指定类型的单位值选项 *parameters: - [i]TypeID unitType: 单位类型 *return value: 指定类型的单位值选项 {{anchor:getunit}} **int getUnit(TypeID unitType) const** *function: 获取指定类型的单位值选项 *parameters: - [i]TypeID unitType: 单位类型 *return value: 指定类型的单位值选项 {{anchor:setunit}} **void setUnit(TypeID unitType, ulong unitID)** *function: 设置指定类型的单位值 *parameters: - [i]TypeID unitType: 单位类型 - [i] ulong unitID: 指定类型的单位值 *return value: 无 {{anchor:write}} **virtual void write(XBinaryIO * io)** *function: 将对象数据写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:read}} **virtual ErrorCode read(XBinaryIO * io)** *function: 从二进制文件中读取对象数据 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 如成功读取返回Error_None, 否则返回相应错误码