本文整理汇总了C++中Bond::atomJ方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::atomJ方法的具体用法?C++ Bond::atomJ怎么用?C++ Bond::atomJ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::atomJ方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retrieveAccessor
// Retrieve desired value
bool BondVariable::retrieveAccessor(int i, ReturnValue& rv, bool hasArrayIndex, int arrayIndex)
{
Messenger::enter("BondVariable::retrieveAccessor");
// Cast 'i' into Accessors enum value
if ((i < 0) || (i >= nAccessors))
{
printf("Internal Error: Accessor id %i is out of range for Bond type.\n", i);
Messenger::exit("BondVariable::retrieveAccessor");
return false;
}
Accessors acc = (Accessors) i;
// Check for correct lack/presence of array index given
if ((accessorData[i].arraySize == 0) && hasArrayIndex)
{
Messenger::print("Error: Unnecessary array index provided for member '%s'.", qPrintable(accessorData[i].name));
Messenger::exit("BondVariable::retrieveAccessor");
return false;
}
else if ((accessorData[i].arraySize > 0) && (hasArrayIndex))
{
if ((arrayIndex < 1) || (arrayIndex > accessorData[i].arraySize))
{
Messenger::print("Error: Array index out of bounds for member '%s' (%i, range is 1-%i).", qPrintable(accessorData[i].name), arrayIndex, accessorData[i].arraySize);
Messenger::exit("BondVariable::retrieveAccessor");
return false;
}
}
// Get current data from ReturnValue
bool result = true;
Bond* ptr = (Bond*) rv.asPointer(VTypes::BondData, result);
if ((!result) || (ptr == NULL))
{
Messenger::print("Invalid (NULL) %s reference encountered.", VTypes::dataType(VTypes::BondData));
result = false;
}
if (result) switch (acc)
{
case (BondVariable::I):
rv.set(VTypes::AtomData, ptr->atomI());
break;
case (BondVariable::J):
rv.set(VTypes::AtomData, ptr->atomJ());
break;
case (BondVariable::Order):
rv.set(ptr->order());
break;
case (BondVariable::Type):
rv.set(Bond::bondType(ptr->type()));
break;
default:
printf("Internal Error: Access to member '%s' has not been defined in BondVariable.\n", qPrintable(accessorData[i].name));
result = false;
break;
}
Messenger::exit("BondVariable::retrieveAccessor");
return result;
}