2017-01-19 5 views
1

siシステムの質量流量はboost::unitsderived_dimensionを作成しようとしています。私はこの簡単な作業を行う方法に関するドキュメントを見つけることができません。これは私が今までに持っているものですが、コンパイル中にエラーが発生しています。ブーストユニットで派生ユニットを正しく定義する方法

typedef boost::units::derived_dimension< 
boost::units::mass_base_dimension, 3, 
boost::units::time_base_dimension, -1 
>::type mass_flow_rate_dimension; 

typedef boost::units::unit< 
mass_flow_rate_dimension, 
boost::units::si::system 
> mass_flow_rate_unit; 

typedef boost::units::quantity<mass_flow_rate_unit, double> mass_flow_rate; 

BOOST_UNITS_STATIC_CONSTANT(kilogram_per_seconds, mass_flow_rate); 

これは、私はエラーを取得する方法です:

mass_flow_rate MFR; 
quantity<mass_density> density = 1.0 * kilogram_per_cubic_meter; 
quantity<si::time> Time = 1.0 * second; 
quantity<volume> vol = 1.0 * cubic_meters; 
MFR = density * vol/Time; 

エラー:C2338(is_simply_convertible ::値== true)を

答えて

0

mass_flow_rate_dimensionが間違った寸法を有します。あなたは質量の代わりに3番目の質量を持っています

typedef boost::units::derived_dimension< 
boost::units::mass_base_dimension, 1, 
boost::units::time_base_dimension, -1 
>::type mass_flow_rate_dimension; 

修正します。このエラーは、寸法が整列していない場合にのみ意味されます。

関連する問題