本文整理汇总了C++中Bond::getOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::getOrder方法的具体用法?C++ Bond::getOrder怎么用?C++ Bond::getOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::getOrder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyBondOrders
void Bond::copyBondOrders(const std::vector<Bond> &fromBonds, std::vector<Bond> &toBonds)
{
std::map<std::pair<MIAtom*, MIAtom*>, unsigned char> bondOrders;
std::vector<Bond>::const_iterator constBondIter;
for (constBondIter = fromBonds.begin(); constBondIter != fromBonds.end(); ++constBondIter)
{
Bond b = *constBondIter;
if (b.getAtom1() < b.getAtom2())
{
bondOrders[std::make_pair(b.getAtom1(), b.getAtom2())] = b.getOrder();
}
else
{
bondOrders[std::make_pair(b.getAtom2(), b.getAtom1())] = b.getOrder();
}
}
std::vector<Bond>::iterator bondIter;
for (bondIter = toBonds.begin(); bondIter != toBonds.end(); ++bondIter)
{
Bond b = *bondIter;
if (b.getAtom1() < b.getAtom2())
{
bondIter->setOrder(bondOrders[std::make_pair(b.getAtom1(), b.getAtom2())]);
}
else
{
bondIter->setOrder(bondOrders[std::make_pair(b.getAtom2(), b.getAtom1())]);
}
}
}
示例2: throw
Atom a2;
Bond b1, b2;
b1.setFirstAtom(&a1);
TEST_EQUAL(b1.getFirstAtom(), &a1);
b1.setFirstAtom(&a2);
TEST_EQUAL(b1.getFirstAtom(), &a2);
RESULT
CHECK(Bond(const String& name, Atom& first, Atom& second, Order order = BALL_BOND_DEFAULT_ORDER, Type type = BALL_BOND_DEFAULT_TYPE) throw(TooManyBonds))
Atom a1;
Atom a2;
Bond b1("name", a1, a2, 1, 2);
TEST_EQUAL(b1.getName(), "name")
TEST_EQUAL(b1.getFirstAtom(), &a1)
TEST_EQUAL(b1.getSecondAtom(), &a2)
TEST_EQUAL(b1.getOrder(), 1)
TEST_EQUAL(b1.getType(), 2)
RESULT
CHECK(static Bond* createBond(Bond& bond, Atom& first, Atom& second) throw(TooManyBonds))
Atom a1;
Atom a2;
Atom a3;
Bond b1;
Bond b2;
TEST_NOT_EQUAL(b1.createBond(b1, a2, a1), 0)
TEST_EQUAL(a2.countBonds(), 1);
TEST_EQUAL(b1.getFirstAtom(), &a1);
TEST_EQUAL(b1.getSecondAtom(), &a2);