当前位置: 首页>>代码示例>>C++>>正文


C++ Node::hasAttribute方法代码示例

本文整理汇总了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";
      }
  }
开发者ID:armando-2011,项目名称:DynamO,代码行数:28,代码来源:RingDSMC.cpp

示例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";
      }
  }
开发者ID:armando-2011,项目名称:DynamO,代码行数:28,代码来源:rescale.cpp

示例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";
    }
}
开发者ID:herbsolo,项目名称:DynamO,代码行数:30,代码来源:thermaldiffE.cpp

示例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";
      }
  }
开发者ID:armando-2011,项目名称:DynamO,代码行数:25,代码来源:ghost.cpp

示例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>();
  }
开发者ID:g-rutter,项目名称:DynamO,代码行数:9,代码来源:radiusGyration.cpp

示例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();
 }
开发者ID:luyao1986,项目名称:DynamO,代码行数:11,代码来源:LEBC.cpp

示例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>();
 }
开发者ID:BigMacchia,项目名称:DynamO,代码行数:11,代码来源:structureImage.cpp

示例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());
  }
开发者ID:g-rutter,项目名称:DynamO,代码行数:12,代码来源:hardsphere.cpp

示例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>();
  }
开发者ID:Bradleydi,项目名称:DynamO,代码行数:12,代码来源:radiusGyration.cpp

示例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");
 }
开发者ID:MChudak,项目名称:DynamO,代码行数:13,代码来源:rescale.cpp

示例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";
      }
  }
开发者ID:pviswanathan,项目名称:DynamO,代码行数:29,代码来源:oscillatingplate.cpp

示例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";
      }
  }
开发者ID:pviswanathan,项目名称:DynamO,代码行数:16,代码来源:MFT.cpp

示例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();
  }
开发者ID:MChudak,项目名称:DynamO,代码行数:29,代码来源:lwall.cpp

示例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";
      }
  }
开发者ID:dhouhadhouha,项目名称:DynamO,代码行数:26,代码来源:squarewell.cpp

示例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"; }
}
开发者ID:herbsolo,项目名称:DynamO,代码行数:31,代码来源:umbrella.cpp


注:本文中的magnet::xml::Node::hasAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。