本文整理汇总了C++中magnet::xml::Node::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getPath方法的具体用法?C++ Node::getPath怎么用?C++ Node::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magnet::xml::Node
的用法示例。
在下文中一共展示了Node::getPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: checkNodeNameAttribute
void checkNodeNameAttribute(magnet::xml::Node node)
{
//Check for unique names
std::set<std::string> names;
for (; node.valid(); ++node)
{
std::string currentname = node.getAttribute("Name").as<std::string>();
if (names.find(currentname) != names.end())
M_throw() << node.getName() << " at path :" << node.getPath() << "\n Does not have a unique name (Name=\"" << currentname << "\")";
names.insert(currentname);
}
}
示例3: if
void
PotentialLennardJones::operator<<(const magnet::xml::Node& XML) {
_r_cache.clear();
_u_cache.clear();
_sigma = XML.getAttribute("Sigma").as<double>();
_epsilon = XML.getAttribute("Epsilon").as<double>();
_cutoff = XML.getAttribute("CutOff").as<double>();
if (_cutoff <= minimum())
M_throw() << "The cutoff (" << _cutoff << ") cannot be before the minimum ("
<< minimum() << ") in the potential for this Lennard-Jones potential due to the stepping parameters used. Please use a WCA potential instead (if available).";
_r_cache.push_back(_cutoff);
_attractiveSteps = XML.getAttribute("AttractiveSteps").as<double>();
const std::string umode_string = XML.getAttribute("UMode").as<std::string>();
if (!umode_string.compare("Midpoint")) _U_mode = MIDPOINT;
else if (!umode_string.compare("Left")) _U_mode = LEFT;
else if (!umode_string.compare("Right")) _U_mode = RIGHT;
else if (!umode_string.compare("Volume")) _U_mode = VOLUME;
else if (!umode_string.compare("MidVolume")) _U_mode = MIDVOLUME;
else if (!umode_string.compare("Virial"))
{
_kT = XML.getAttribute("Temperature").as<double>();
_U_mode = VIRIAL;
}
else
M_throw() << "Unknown LennardJones UMode (" << umode_string << ") at " << XML.getPath();
const std::string rmode_string = XML.getAttribute("RMode").as<std::string>();
if (!rmode_string.compare("DeltaR")) _R_mode = DELTAR;
else if (!rmode_string.compare("DeltaU")) _R_mode = DELTAU;
else if (!rmode_string.compare("DeltaV")) _R_mode = DELTAV;
else
M_throw() << "Unknown LennardJones RMode (" << rmode_string << ") at " << XML.getPath();
}
示例4: if
void
PotentialStepped::operator<<(const magnet::xml::Node& XML) {
if (XML.getAttribute("Direction").as<std::string>() == "Left")
_direction = false;
else if (XML.getAttribute("Direction").as<std::string>() == "Right")
_direction = true;
else
M_throw() << "Could not parse Direction, should be either \"Left\" or \"Right\"\nXML path:"
<< XML.getPath();
std::vector<std::pair<double, double> > steps;
for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
steps.push_back(std::pair<double, double>(node.getAttribute("R").as<double>(),
node.getAttribute("E").as<double>()));
if (steps.empty())
M_throw() << "You cannot load a stepped potential with no steps.\nXML path: " << XML.getPath();
*this = PotentialStepped(steps, _direction);
}
示例5: CellOrigins
void
GSOCells::operator<<(const magnet::xml::Node& XML)
{
globName = XML.getAttribute("Name");
if (XML.hasNode("CellOrigins")) {
Vector pos;
for (magnet::xml::Node node = XML.getNode("CellOrigins").findNode("Origin"); node.valid(); ++node) {
pos << node;
pos *= Sim->units.unitLength();
cell_origins.push_back(pos);
}
if (cell_origins.size() != Sim->N())
M_throw() << "Number of CellOrigins (" << cell_origins.size() << ") does not match number of particles (" << Sim->N() << ")\n" << XML.getPath();
}
if (XML.hasAttribute("Diameter"))
_cellD = XML.getAttribute("Diameter").as<double>() * Sim->units.unitLength();
}