本文整理汇总了C++中magnet::xml::Node::hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::hasAttribute方法的具体用法?C++ Node::hasAttribute怎么用?C++ Node::hasAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magnet::xml::Node
的用法示例。
在下文中一共展示了Node::hasAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
CSRingDSMC::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"RingDSMC"))
M_throw() << "Attempting to load RingDSMC from a "
<< XML.getAttribute("Type") << " entry";
try {
tstep = XML.getAttribute("tStep").as<double>() * Sim->dynamics.units().unitTime();
chi12 = XML.getAttribute("Chi12").as<double>();
chi13 = XML.getAttribute("Chi13").as<double>();
sysName = XML.getAttribute("Name");
diameter = XML.getAttribute("Diameter").as<double>() * Sim->dynamics.units().unitLength();
e = XML.getAttribute("Inelasticity").as<double>();
d2 = diameter * diameter;
range1 = std::tr1::shared_ptr<CRange>(CRange::getClass(XML.getNode("Range1"), Sim));
if (XML.hasAttribute("MaxProbability12"))
maxprob12 = XML.getAttribute("MaxProbability12").as<double>();
if (XML.hasAttribute("MaxProbability13"))
maxprob13 = XML.getAttribute("MaxProbability13").as<double>();
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CGGlobal";
}
}
示例2: 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";
}
}
示例3: catch
void
OPThermalDiffusionE::operator<<(const magnet::xml::Node& XML)
{
try
{
try {
species1name = std::string(XML.getAttribute("Species"));
} catch (std::exception& nex)
{
M_throw() << "The name of the Species must be specified"
<< nex.what();
}
if (XML.hasAttribute("Length"))
CorrelatorLength = XML.getAttribute("Length").as<size_t>();
if (XML.hasAttribute("dt"))
dt = Sim->dynamics.units().unitTime() *
XML.getAttribute("dt").as<double>();
if (XML.hasAttribute("t"))
dt = Sim->dynamics.units().unitTime() *
XML.getAttribute("t").as<double>() / CorrelatorLength;
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in OPMutualDiffusion";
}
}
示例4: catch
void
CSysGhost::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"Andersen"))
M_throw() << "Attempting to load Andersen from non Andersen entry";
try {
meanFreeTime = XML.getAttribute("MFT").as<double>() * Sim->dynamics.units().unitTime();
Temp = XML.getAttribute("Temperature").as<double>() * Sim->dynamics.units().unitEnergy();
sysName = XML.getAttribute("Name");
if (XML.hasAttribute("SetFrequency") && XML.hasAttribute("SetPoint"))
{
tune = true;
setFrequency = XML.getAttribute("SetFrequency").as<unsigned long long>();
setPoint = boost::lexical_cast<double>(XML.getAttribute("SetPoint"));
}
range = std::tr1::shared_ptr<CRange>(CRange::getClass(XML,Sim));
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CGGlobal";
}
}
示例5:
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>();
}
示例6:
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();
}
示例7:
void
OPStructureImaging::operator<<(const magnet::xml::Node& XML)
{
if (!XML.hasAttribute("Structure"))
M_throw() << "You must specify the name of the structure to monitor for StructureImaging";
structureName = XML.getAttribute("Structure");
if (XML.hasAttribute("MaxImages"))
imageCount = XML.getAttribute("MaxImages").as<size_t>();
}
示例8:
void
IHardSphere::operator<<(const magnet::xml::Node& XML)
{
Interaction::operator<<(XML);
_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());
if (XML.hasAttribute("Elasticity"))
_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
if (XML.hasAttribute("TangentialElasticity"))
_et = Sim->_properties.getProperty(XML.getAttribute("TangentialElasticity"), Property::Units::Dimensionless());
}
示例9:
void
OPRGyration::operator<<(const magnet::xml::Node& XML)
{
if (XML.hasAttribute("binwidth1"))
binwidth1 = XML.getAttribute("binwidth1").as<double>();
if (XML.hasAttribute("binwidth2"))
binwidth2 = XML.getAttribute("binwidth2").as<double>();
if (XML.hasAttribute("binwidth3"))
binwidth3 = XML.getAttribute("binwidth3").as<double>();
}
示例10:
void
SysRescale::operator<<(const magnet::xml::Node& XML)
{
if (XML.hasAttribute("Freq"))
_frequency = XML.getAttribute("Freq").as<size_t>();
if (XML.hasAttribute("kT"))
_kT = XML.getAttribute("kT").as<double>();
_kT *= Sim->units.unitEnergy();
if (XML.hasAttribute("TimeStep"))
_timestep = XML.getAttribute("TimeStep").as<double>();
_timestep *= Sim->units.unitTime();
sysName = XML.getAttribute("Name");
}
示例11: 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";
}
}
示例12: catch
void
OPMFT::operator<<(const magnet::xml::Node& XML)
{
try
{
if (XML.hasAttribute("binwidth"))
binwidth = XML.getAttribute("binwidth").as<double>();
if (XML.hasAttribute("length"))
collisionHistoryLength = XML.getAttribute("length").as<size_t>();
}
catch (boost::bad_lexical_cast&)
{
M_throw() << "Failed a lexical cast in OPMFL";
}
}
示例13: sqrt
void
LWall::operator<<(const magnet::xml::Node& XML)
{
range = shared_ptr<IDRange>(IDRange::getClass(XML.getNode("IDRange"),Sim));
_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"), Property::Units::Length());
if (_diameter->getMaxValue() == 0)
M_throw() << "Cannot have a wall with a diameter of zero";
_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());
sqrtT = 0;
if (XML.hasAttribute("Temperature"))
sqrtT = sqrt(XML.getAttribute("Temperature").as<double>()
* Sim->units.unitEnergy());
if (sqrtT < 0)
M_throw() << "Cannot use negative temperatures on a Wall";
magnet::xml::Node xBrowseNode = XML.getNode("Norm");
localName = XML.getAttribute("Name");
vNorm << xBrowseNode;
if (vNorm.nrm() == 0)
M_throw() << "The normal for the Local Wall named \"" << getName() << "\" has a length of 0. Cannot load";
vNorm /= vNorm.nrm();
xBrowseNode = XML.getNode("Origin");
vPosition << xBrowseNode;
vPosition *= Sim->units.unitLength();
}
示例14: catch
void
ISquareWell::operator<<(const magnet::xml::Node& XML)
{
Interaction::operator<<(XML);
try {
_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
Property::Units::Length());
_lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"),
Property::Units::Dimensionless());
_wellDepth = Sim->_properties.getProperty(XML.getAttribute("WellDepth"),
Property::Units::Energy());
if (XML.hasAttribute("Elasticity"))
_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
Property::Units::Dimensionless());
else
_e = Sim->_properties.getProperty(1.0, Property::Units::Dimensionless());
intName = XML.getAttribute("Name");
ISingleCapture::loadCaptureMap(XML);
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in ISquareWell";
}
}
示例15: 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"; }
}