本文整理汇总了C++中Quantity::system方法的典型用法代码示例。如果您正苦于以下问题:C++ Quantity::system方法的具体用法?C++ Quantity::system怎么用?C++ Quantity::system使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quantity
的用法示例。
在下文中一共展示了Quantity::system方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wl
bool operator==(const Quantity& lQuantity,const Quantity& rQuantity) {
if ((lQuantity.system() == rQuantity.system()) && (lQuantity.units() == rQuantity.units())) {
Quantity wl(lQuantity), wr(rQuantity);
wl.setScale(0);
wr.setScale(0);
return equal(wl.value(),wr.value());
}
return false;
}
示例2: siu
TEST_F(UnitsFixture,Quantity_MixedTypeOperations) {
openstudio::SIUnit siu(SIExpnt(0,1), 0, "");
Quantity l1(3.0, siu);
openstudio::IPUnit ipu(IPExpnt(0,1), 0, "");
Quantity l2(2.0, ipu);
openstudio::BTUUnit btuu(BTUExpnt(0,1), 0, "");
Quantity l3(0.5, btuu);
Quantity r;
r = l1*l2;
EXPECT_EQ(UnitSystem(UnitSystem::Mixed),r.system());
r = l1 / l2;
EXPECT_EQ(UnitSystem(UnitSystem::Mixed),r.system());
l3 *= l1;
EXPECT_EQ(UnitSystem(UnitSystem::Mixed),l3.system());
ASSERT_THROW(l1 + l2,Exception);
}
示例3: convert
TEST_F(IdfFixture, IdfObject_GetQuantity)
{
std::string text = "Building, !- Building \n\
Building, !- Name \n\
30., !- North Axis {deg} \n\
City, !- Terrain \n\
0.04, !- Loads Convergence Tolerance Value \n\
0.4, !- Temperature Convergence Tolerance Value {deltaC} \n\
FullExterior, !- Solar Distribution \n\
25; !- Maximum Number of Warmup Days";
// make an idf object
OptionalIdfObject oObj = IdfObject::load(text);
ASSERT_TRUE(oObj);
// Test get.
OSOptionalQuantity ooq = oObj->getQuantity (4);
ASSERT_TRUE(ooq.isSet());
Quantity q = ooq.get();
EXPECT_TRUE(q.value() == 0.4);
EXPECT_TRUE(q.system() == UnitSystem::SI);
EXPECT_TRUE(q.standardUnitsString() == "K");
// Test set.
OptionalQuantity oq = convert(q,UnitSystem(UnitSystem::IP));
ASSERT_TRUE(oq);
EXPECT_TRUE(oq->system() == UnitSystem::IP);
EXPECT_DOUBLE_EQ(0.72,oq->value());
oq->setValue(1.5);
EXPECT_TRUE(oObj->setQuantity(4, *oq));
ooq = oObj->getQuantity(4);
ASSERT_TRUE(ooq.isSet());
q = ooq.get();
EXPECT_DOUBLE_EQ(0.83333333333333333,q.value());
EXPECT_TRUE(q.system() == UnitSystem::SI);
EXPECT_TRUE(q.standardUnitsString() == "K");
}
示例4: result
Quantity operator/(double d,const Quantity& rQuantity) {
Quantity result(d,rQuantity.system());
result /= rQuantity;
return result;
}