本文整理汇总了C++中magnet::xml::Node类的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: M_throw
void
IStepped::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"Stepped"))
M_throw() << "Attempting to load Stepped from non Stepped entry";
range.set_ptr(C2Range::getClass(XML,Sim));
try {
intName = XML.getAttribute("Name");
if (!XML.hasNode("Step"))
M_throw() << "No steppings defined for stepped potential "
<< intName;
for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
steps.push_back(steppair(node.getAttribute("R").as<double>(),
node.getAttribute("E").as<double>()));
std::sort(steps.rbegin(), steps.rend());
IMultiCapture::loadCaptureMap(XML);
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CIStepped";
}
if (steps.empty())
M_throw() << "No steps defined in SteppedPotential Interaction with name "
<< getName();
}
示例2: catch
void
LOscillatingPlate::operator<<(const magnet::xml::Node& XML)
{
range = shared_ptr<Range>(Range::getClass(XML,Sim));
try {
e = XML.getAttribute("Elasticity").as<double>();
nhat << XML.getNode("Norm");
nhat /= nhat.nrm();
rw0 << XML.getNode("Origin");
rw0 *= Sim->dynamics.units().unitLength();
if (XML.hasAttribute("StrongPlate"))
strongPlate = XML.getAttribute("StrongPlate").as<double>();
omega0 = XML.getAttribute("Omega0").as<double>() / Sim->dynamics.units().unitTime();
sigma = XML.getAttribute("Sigma").as<double>() * Sim->dynamics.units().unitLength();
delta = XML.getAttribute("Delta").as<double>() * Sim->dynamics.units().unitLength();
mass = XML.getAttribute("Mass").as<double>() * Sim->dynamics.units().unitMass();
timeshift = XML.getAttribute("TimeShift").as<double>() * Sim->dynamics.units().unitTime();
localName = XML.getAttribute("Name");
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in LOscillatingPlate";
}
}
示例3:
void
Topology::operator<<(const magnet::xml::Node& XML)
{
_name = XML.getAttribute("Name");
if (!XML.hasNode("Molecule"))
M_throw() << "Cannot load a Topology which has no molecules!";
}
示例4:
C2RPair::C2RPair(const magnet::xml::Node& XML, const dynamo::SimData* Sim)
{
if (strcmp(XML.getAttribute("Range"), "Pair"))
M_throw() << "Attempting to load a pair from a non pair";
range1 = shared_ptr<Range>(Range::getClass(XML.getNode("Range1"), Sim));
range2 = shared_ptr<Range>(Range::getClass(XML.getNode("Range2"), Sim));
}
示例5:
void
IDSMC::operator<<(const magnet::xml::Node& XML)
{
Interaction::operator<<(XML);
_length = Sim->_properties.getProperty(XML.getAttribute("Length"), Property::Units::Length());
_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
ICapture::loadCaptureMap(XML);
}
示例6:
void
OPRGyration::operator<<(const magnet::xml::Node& XML)
{
if (XML.hasAttribute("BinWidthGyration"))
_binWidthGyration = XML.getAttribute("BinWidthGyration").as<double>();
if (XML.hasAttribute("BinWidthGyration"))
_binWidthNematic = XML.getAttribute("BinWidthGyration").as<double>();
}
示例7: TChain
shared_ptr<Topology>
Topology::getClass(const magnet::xml::Node& XML, dynamo::Simulation* Sim, size_t ID)
{
if (!strcmp(XML.getAttribute("Type"),"Chain"))
return shared_ptr<Topology>(new TChain(XML, Sim, ID));
else
M_throw() << XML.getAttribute("Type")
<< ", Unknown type of Topology encountered";
}
示例8:
void
SSleep::operator<<(const magnet::xml::Node& XML)
{
sysName = XML.getAttribute("Name");
_sleepVelocity = XML.getAttribute("SleepV").as<double>() * Sim->units.unitVelocity();
_sleepDistance = Sim->units.unitLength() * 0.01;
_sleepTime = Sim->units.unitTime() * 0.0001;
_range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"), Sim));
}
示例9:
Particle::Particle(const magnet::xml::Node& XML, unsigned long nID):
_ID(nID),
_peculiarTime(0.0),
_state(DEFAULT)
{
if (XML.hasAttribute("Static")) clearState(DYNAMIC);
_pos << XML.getNode("P");
_vel << XML.getNode("V");
}
示例10: ParticleProperty
inline ParticleProperty(const magnet::xml::Node& node):
Property(Property::Units(node.getAttribute("Units").getValue())),
_name(node.getAttribute("Name").getValue())
{
//Move up to the particles nodes, and start loading the property values
for (magnet::xml::Node pNode = node.getParent().getParent()
.getNode("ParticleData").fastGetNode("Pt");
pNode.valid(); ++pNode)
_values.push_back(pNode.getAttribute(_name).as<double>());
}
示例11:
void
GFrancesco::operator<<(const magnet::xml::Node& XML)
{
globName = XML.getAttribute("Name");
const double MFT = XML.getAttribute("MFT").as<double>() * Sim->units.unitTime();
const double MFTstddev = XML.getAttribute("MFTstddev").as<double>() * Sim->units.unitTime();
_dist = std::normal_distribution<>(MFT, MFTstddev);
_vel = XML.getAttribute("Velocity").as<double>() * Sim->units.unitVelocity();
range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"), Sim));
}
示例12: catch
void
SysRescale::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"Rescale"))
M_throw() << "Attempting to load Rescale from "
<< XML.getAttribute("Type") << " entry";
try {
if (XML.hasAttribute("Freq"))
_frequency = XML.getAttribute("Freq").as<size_t>();
if (XML.hasAttribute("kT"))
_kT = XML.getAttribute("kT").as<double>();
_kT *= Sim->dynamics.units().unitEnergy();
if (XML.hasAttribute("TimeStep"))
_timestep = XML.getAttribute("TimeStep").as<double>();
_timestep *= Sim->dynamics.units().unitTime();
sysName = XML.getAttribute("Name");
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in SysRescale";
}
}
示例13: catch
void
CSUmbrella::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"Umbrella"))
M_throw() << "Attempting to load Umbrella from a "
<< XML.getAttribute("Type") << " entry";
try {
sysName = XML.getAttribute("Name");
a = XML.getAttribute("a").as<double>()
* Sim->dynamics.units().unitEnergy()
/ Sim->dynamics.units().unitArea();
b = XML.getAttribute("b").as<double>()
* Sim->dynamics.units().unitLength();
delU = XML.getAttribute("delU").as<double>() * Sim->dynamics.units().unitEnergy();
range1.set_ptr(CRange::getClass(XML.getNode("Range1"), Sim));
range2.set_ptr(CRange::getClass(XML.getNode("Range2"), Sim));
if (XML.hasAttribute("currentulevel"))
{
ulevel = XML.getAttribute("currentulevel").as<size_t>();
ulevelset = true;
}
}
catch (boost::bad_lexical_cast &)
{ M_throw() << "Failed a lexical cast in CSUmbrella"; }
}
示例14:
void
BCLeesEdwards::operator<<(const magnet::xml::Node& XML)
{
if (XML.hasAttribute("DXD"))
_dxd = XML.getAttribute("DXD").as<double>();
_dxd *= Sim->units.unitLength();
if (XML.hasAttribute("Rate"))
_shearRate = XML.getAttribute("Rate").as<double>();
_shearRate /= Sim->units.unitTime();
}
示例15: IDPairRangeChainGroups
IDPairRangeChainGroups(const magnet::xml::Node& XML, const dynamo::Simulation*):
range1(0),range2(0), length(0)
{
range1 = XML.getAttribute("Start1").as<size_t>();
range2 = XML.getAttribute("Start2").as<size_t>();
length = XML.getAttribute("Length").as<size_t>();
//Guarrantee that they are ordered
if (range1 > range2)
std::swap(range1, range2);
}