本文整理汇总了C++中magnet::xml::Node::findNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::findNode方法的具体用法?C++ Node::findNode怎么用?C++ Node::findNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magnet::xml::Node
的用法示例。
在下文中一共展示了Node::findNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TChain::operator<<(const magnet::xml::Node& XML)
{
Topology::operator<<(XML);
for (magnet::xml::Node node = XML.findNode("Molecule"); node.valid(); ++node)
ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim)));
size_t Clength = (*ranges.begin())->size();
for (const shared_ptr<IDRange>& nRange : ranges)
if (nRange->size() != Clength)
M_throw() << "Size mismatch in loading one of the ranges in Chain topology \""
<< _name << "\"";
}
示例2: Vector
void
LBoundary::operator<<(const magnet::xml::Node& XML)
{
range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim));
localName = XML.getAttribute("Name");
_oscillationData._origin << XML.getNode("Origin");
_oscillationData._origin *= Sim->units.unitLength();
_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());
if (_diameter->getMaxValue() == 0)
M_throw() << "Cannot have a boundary with a diameter of zero";
_oscillationData._amplitude = Vector();
_oscillationData._freq = 0;
_oscillationData._t_shift = 0;
const size_t data_count = XML.hasNode("Amplitude") + XML.hasAttribute("Frequency") + XML.hasAttribute("Phase");
if ((data_count != 3) && (data_count != 0))
M_throw() << "For oscillating walls you must have an Amplitude, Frequency, and Phase specified."
<< XML.getPath();
if (data_count == 3) {
_oscillationData._freq = XML.getAttribute("Frequency").as<double>() / Sim->units.unitTime();
_oscillationData._t_shift = XML.getAttribute("Phase").as<double>() * Sim->units.unitTime();
_oscillationData._amplitude << XML.getNode("Amplitude");
_oscillationData._amplitude *= Sim->units.unitLength();
}
_kT = 0;
if (XML.hasAttribute("kT")) {
if (data_count == 3)
M_throw() << "Cannot have both a thermalised wall and a oscillating wall"
<< XML.getPath();
_kT = XML.getAttribute("kT").as<double>() * Sim->units.unitEnergy();
}
if (_kT < 0)
M_throw() << "Temperature is less than zero" << XML.getPath();
for (magnet::xml::Node node = XML.findNode("Object"); node.valid(); ++node)
_objects.push_back(boundary::Object::getClass(node, Sim, _oscillationData));
if (_objects.empty())
M_throw() << "Boundary Locals must have at least one Object.\n" << XML.getPath();
}