• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ xml::Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中magnet::xml::Node的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:herbsolo,项目名称:DynamO,代码行数:32,代码来源:stepped.cpp


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


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


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


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


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


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


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


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


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


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


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


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


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


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


示例16:

 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


示例17: if

  shared_ptr<Potential>
  Potential::getClass(const magnet::xml::Node& XML)
  {
    if (!XML.getAttribute("Type").getValue().compare("Stepped"))
      return shared_ptr<Potential>(new PotentialStepped(XML));
    else if (!XML.getAttribute("Type").getValue().compare("LennardJones"))
      return shared_ptr<Potential>(new PotentialLennardJones(XML));
    else 
      M_throw() << XML.getAttribute("Type").getValue()
		<< ", Unknown type of Potential encountered";
  }
开发者ID:BigMacchia,项目名称:DynamO,代码行数:11,代码来源:potential.cpp


示例18:

  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


示例19: catch

  void 
  Topology::operator<<(const magnet::xml::Node& XML)
  {
    try { spName = XML.getAttribute("Name"); } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CTopology";
      }
    
    for (magnet::xml::Node node = XML.fastGetNode("Molecule"); node.valid(); ++node)
      ranges.push_back(shared_ptr<Range>(Range::getClass(node, Sim)));
  }
开发者ID:pviswanathan,项目名称:DynamO,代码行数:12,代码来源:topology.cpp


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ mail::callback类代码示例发布时间:2022-05-31
下一篇:
C++ magick::Image类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap