Esempio n. 1
0
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();
}
Esempio n. 2
0
  void 
  LTriangleMesh::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());
    _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"), Property::Units::Dimensionless());

    localName = XML.getAttribute("Name");

    {//Load the vertex coordinates
      std::istringstream is(XML.getNode("Vertices").getValue());
      is.exceptions(std::ostringstream::badbit | std::ostringstream::failbit);
      is.peek(); //Set the eof flag if needed
      Vector tmp;
      while (!is.eof())
	{
	  is >> tmp[0];
	  if (is.eof()) M_throw() << "The vertex coordinates is not a multiple of 3";

	  is >> tmp[1];
	  if (is.eof()) M_throw() << "The vertex coordinates is not a multiple of 3";

	  is >> tmp[2];	  
	  _vertices.push_back(tmp * Sim->units.unitLength());
	}
    }

    {//Load the triangle elements
      std::istringstream is(XML.getNode("Elements").getValue());
      is.exceptions(std::ostringstream::badbit | std::ostringstream::failbit);
      is.peek(); //Set the eof flag if needed

      TriangleElements tmp;
      while (!is.eof())
	{
	  is >> std::get<0>(tmp);
	  if (is.eof()) M_throw() << "The triangle elements are not a multiple of 3";
	  
	  is >> std::get<1>(tmp);
	  if (is.eof()) M_throw() << "The triangle elements are not a multiple of 3";

	  is >> std::get<2>(tmp);

	  if ((std::get<0>(tmp) >= _vertices.size()) 
	      || (std::get<1>(tmp) >= _vertices.size()) 
	      || (std::get<2>(tmp) >= _vertices.size()))
	    M_throw() << "Triangle " << _elements.size() << " has an out of range vertex ID";

	  Vector normal
	    = (_vertices[std::get<1>(tmp)] - _vertices[std::get<0>(tmp)])
	    ^ (_vertices[std::get<2>(tmp)] - _vertices[std::get<1>(tmp)]);

	  if (normal.nrm() == 0) 
	    M_throw() << "Triangle " << _elements.size() << " has a zero normal!";


	  _elements.push_back(tmp);
	}
    }
  }
Esempio n. 3
0
  void 
  GVolumetricPotential::operator<<(const magnet::xml::Node& XML) {
    globName = XML.getAttribute("Name");
    _fileName = XML.getAttribute("RawFile");
    _sampleBytes = XML.getAttribute("SampleBytes").as<size_t>();


    //Load the dimensions of the data set (and its subset of data if
    //only processing a smaller section)
    auto XMLdim = XML.getNode("Dimensions");
    _imageDimensions = std::array<size_t, 3>{{XMLdim.getAttribute("x").as<size_t>(), XMLdim.getAttribute("y").as<size_t>(), XMLdim.getAttribute("z").as<size_t>()}};
    
    _offset = std::array<size_t, 3>{{0, 0, 0}};
    if (XML.hasNode("Offset"))
      {
	auto XMLdim = XML.getNode("Offset");
	_offset = std::array<size_t, 3>{{XMLdim.getAttribute("x").as<size_t>(), XMLdim.getAttribute("y").as<size_t>(), XMLdim.getAttribute("z").as<size_t>()}};
      }

    std::array<size_t, 3> sampleDimensions = _imageDimensions;
    if (XML.hasNode("SampleDimensions"))
      {
	auto XMLdim = XML.getNode("SampleDimensions");
	sampleDimensions = std::array<size_t, 3>{{XMLdim.getAttribute("x").as<size_t>(), XMLdim.getAttribute("y").as<size_t>(), XMLdim.getAttribute("z").as<size_t>()}};
      }

    Ordering fileOrdering(_imageDimensions);
    std::vector<unsigned char> fileData(fileOrdering.size() * _sampleBytes);
    dout << "Opening " << _fileName << std::endl;
    std::ifstream file(_fileName.c_str(), std::ifstream::binary);

    if (!file.good())
      M_throw() << "Failed open the file " << _fileName;
    dout << "Reading " << fileOrdering.size() * _sampleBytes << " bytes of data into memory" <<  std::endl;
    file.read(reinterpret_cast<char*>(fileData.data()), fileOrdering.size() * _sampleBytes);
    
    if (!file)
      M_throw() << "Failed reading volumetric data (read " << file.gcount() << " bytes of an expected " << fileOrdering.size() * _sampleBytes << "  from " << _fileName << ")";
    file.close();

    _ordering = Ordering(sampleDimensions);
    _volumeData.resize(_ordering.size());

    dout << "Resampling " << _ordering.size() << " bytes of data from the file into the simulation" <<  std::endl;
    if (_sampleBytes == 1)
      {
	if (sampleDimensions == _imageDimensions)
	  std::swap(_volumeData, fileData);
	else
	  for (size_t z = 0; z < sampleDimensions[2]; ++z)
	    for (size_t y = 0; y < sampleDimensions[1]; ++y)
	      {
		size_t startindex = fileOrdering.toIndex(std::array<size_t, 3>{{_offset[0], y + _offset[1], z + _offset[2]}});
		std::copy(fileData.begin() + startindex, fileData.begin() + startindex + sampleDimensions[0], _volumeData.begin() + _ordering.toIndex(std::array<size_t, 3>{{0, y, z}}));
	      }
      }
    else
      M_throw() << "Do not have an optimised loader for resampling data yet";
    dout << "Loading complete" <<  std::endl;
  }
Esempio n. 4
0
  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();
  }
Esempio n. 5
0
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";
    }
}
Esempio n. 6
0
  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";
      }
  }
Esempio n. 7
0
 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);   
 }
Esempio n. 8
0
  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>();
  }
Esempio n. 9
0
  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";
  }
Esempio n. 10
0
 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));
 }
Esempio n. 11
0
    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>());
    }
Esempio n. 12
0
 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));
 }
Esempio n. 13
0
  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";
      }
  }
Esempio n. 14
0
 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();
 }
Esempio n. 15
0
 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>();
 }
Esempio n. 16
0
  void 
  ISWSequence::operator<<(const magnet::xml::Node& XML)
  {
    Interaction::operator<<(XML);

    _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
					     Property::Units::Length());
    _lambda = Sim->_properties.getProperty(XML.getAttribute("Lambda"),
					   Property::Units::Dimensionless());
    
    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");
    ICapture::loadCaptureMap(XML);
    
    //Load the sequence
    sequence.clear();
    std::set<size_t> letters;
    
    for (magnet::xml::Node node = XML.getNode("Sequence").fastGetNode("Element");
	 node.valid(); ++node)
      {
	if (node.getAttribute("seqID").as<size_t>() != sequence.size())
	  M_throw() << "Sequence of letters not in order, missing element " << sequence.size();
	
	size_t letter = node.getAttribute("Letter").as<size_t>();
	letters.insert(letter);
	sequence.push_back(letter);
      }
    
    //Initialise all the well depths to 1.0
    alphabet.resize(letters.size());
    
    for (std::vector<double>& vec : alphabet)
      vec.resize(letters.size(), 0.0);
    
    for (magnet::xml::Node node = XML.getNode("Alphabet").fastGetNode("Word");
	 node.valid(); ++node)
      {
	alphabet
	  .at(node.getAttribute("Letter1").as<size_t>())
	  .at(node.getAttribute("Letter2").as<size_t>())
	  = node.getAttribute("Depth").as<double>();
	
	alphabet
	  .at(node.getAttribute("Letter2").as<size_t>())
	  .at(node.getAttribute("Letter1").as<size_t>())
	  = node.getAttribute("Depth").as<double>();
      }
  }
Esempio n. 17
0
    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);
    }
Esempio n. 18
0
  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";
  }
Esempio n. 19
0
  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());
  }
Esempio n. 20
0
  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>();
  }
Esempio n. 21
0
  shared_ptr<Dynamics>
  Dynamics::getClass(const magnet::xml::Node& XML, dynamo::Simulation* tmp)
  {
    if (!strcmp(XML.getAttribute("Type"),"Newtonian"))
      return shared_ptr<Dynamics>(new DynNewtonian(tmp));
    if (!strcmp(XML.getAttribute("Type"),"NewtonianGravity"))
      return shared_ptr<Dynamics>(new DynGravity(tmp, XML));
    else if (!strcmp(XML.getAttribute("Type"),"NewtonianMC"))
      return shared_ptr<Dynamics>(new DynNewtonianMC(tmp, XML));
    else
      M_throw() << XML.getAttribute("Type")
		<< ", Unknown type of Dynamics encountered";
  }
Esempio n. 22
0
  C2RRings::C2RRings(const magnet::xml::Node& XML, const dynamo::SimData*):
    range1(0),range2(0), interval(0)
  { 
    if (strcmp(XML.getAttribute("Range"),"Rings"))
      M_throw() << "Attempting to load a rings from a non rings";
  
    range1 = XML.getAttribute("Start").as<unsigned long>();
    range2 = XML.getAttribute("End").as<unsigned long>();
    interval = XML.getAttribute("Interval").as<unsigned long>();

    if ((range2-range1 + 1) % interval)
      M_throw() << "Range of C2RChains does not split evenly into interval";
  }
Esempio n. 23
0
  shared_ptr<Scheduler>
  Scheduler::getClass(const magnet::xml::Node& XML, dynamo::Simulation* const Sim)
  {
    if (!XML.getAttribute("Type").getValue().compare("NeighbourList"))
      return shared_ptr<Scheduler>(new SNeighbourList(XML, Sim));
    else if (!XML.getAttribute("Type").getValue().compare("Dumb"))
      return shared_ptr<Scheduler>(new SDumb(XML, Sim));
    else if (!XML.getAttribute("Type").getValue().compare("SystemOnly"))
      return shared_ptr<Scheduler>(new SSystemOnly(XML, Sim));
    else 
      M_throw() << XML.getAttribute("Type").getValue()
		<< ", Unknown type of Scheduler encountered";
  }
Esempio n. 24
0
 void 
 IThinThread::operator<<(const magnet::xml::Node& XML)
 {
   Interaction::operator<<(XML);
   _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());
   ICapture::loadCaptureMap(XML);   
 }
Esempio n. 25
0
 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");
 }
Esempio n. 26
0
  void 
  SpFixedCollider::operator<<(const magnet::xml::Node& XML)
  {
    range = std::tr1::shared_ptr<CRange>(CRange::getClass(XML, Sim));
  
    try {
      spName = XML.getAttribute("Name");
      intName = XML.getAttribute("IntName");
    } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in SpFixedCollider";
      }
  }
Esempio n. 27
0
    IDPairRangeChainEnds(const magnet::xml::Node& XML, const dynamo::Simulation*):
      rangeStart(0),rangeEnd(0), interval(0) 
    { 
      rangeStart = XML.getAttribute("Start").as<size_t>();
      rangeEnd = XML.getAttribute("End").as<size_t>();
      interval = XML.getAttribute("Interval").as<size_t>();

      //Guarrantee that they are ordered
      if (rangeStart > rangeEnd) std::swap(rangeStart, rangeEnd);
  
      if ((rangeEnd - rangeStart + 1) % interval)
	M_throw() << "Length of range does not split into an integer"
		  << " number of intervals";
    }
Esempio n. 28
0
  shared_ptr<Scheduler>
  Scheduler::getClass(const magnet::xml::Node& XML, dynamo::SimData* const Sim)
  {
    if (!strcmp(XML.getAttribute("Type"),"NeighbourList"))
      return shared_ptr<Scheduler>(new SNeighbourList(XML, Sim));
    else if (!strcmp(XML.getAttribute("Type"),"Dumb"))
      return shared_ptr<Scheduler>(new SDumb(XML, Sim));
    else if (!strcmp(XML.getAttribute("Type"),"SystemOnly"))
      return shared_ptr<Scheduler>(new SSystemOnly(XML, Sim));
    else if (!strcmp(XML.getAttribute("Type"),"Complex"))
      return shared_ptr<Scheduler>(new SComplex(XML, Sim));
    else 
      M_throw() << XML.getAttribute("Type")
		<< ", Unknown type of Scheduler encountered";
  }
Esempio n. 29
0
void
CRRange::operator<<(const magnet::xml::Node& XML)
{
    if (strcmp(XML.getAttribute("Range"), "Ranged"))
        M_throw() << "Attempting to load CRRange from non range";

    try {
        startID = XML.getAttribute("Start").as<unsigned long>();
        endID = XML.getAttribute("End").as<unsigned long>();
    }
    catch (boost::bad_lexical_cast &)
    {
        M_throw() << "Failed a lexical cast in CRRange";
    }
}
Esempio n. 30
0
  void
  SysUmbrella::operator<<(const magnet::xml::Node& XML)
  {
    sysName = XML.getAttribute("Name");
    magnet::xml::Node rangeNode = XML.getNode("IDRange");
    range1 = shared_ptr<IDRange>(IDRange::getClass(rangeNode, Sim));
    ++rangeNode;
    range2 = shared_ptr<IDRange>(IDRange::getClass(rangeNode, Sim));
    _potential = Potential::getClass(XML.getNode("Potential"));

    _lengthScale = XML.getAttribute("LengthScale").as<double>() * Sim->units.unitLength();
    _energyScale = XML.getAttribute("EnergyScale").as<double>() * Sim->units.unitEnergy();

    if (XML.hasAttribute("CurrentStep"))
      _stepID = XML.getAttribute("CurrentStep").as<size_t>();
  }