コード例 #1
0
ファイル: multicanonical.cpp プロジェクト: MChudak/DynamO
  void 
  DynNewtonianMC::swapSystem(Dynamics& oDynamics)
  {
#ifdef DYNAMO_DEBUG
    if (dynamic_cast<const DynNewtonianMC*>(&oDynamics) == NULL)
      M_throw() << "Trying to swap Dynamicss with different derived types!";
#endif

    DynNewtonianMC& ol(static_cast<DynNewtonianMC&>(oDynamics));

    std::swap(EnergyPotentialStep, ol.EnergyPotentialStep);
    std::swap(_W, ol._W);
  }
コード例 #2
0
  void 
  GCellsShearing::initialise(size_t nID)
  {
    ID=nID;
   
    if (!(Sim->dynamics.BCTypeTest<BCLeesEdwards>()))
      derr << "You should not use the shearing neighbour list"
	   << " in a system without Lees Edwards BC's" << std::endl;

    if (overlink != 1) M_throw() << "Cannot shear with overlinking yet";

    reinitialise();
  }
コード例 #3
0
ファイル: hardsphere.cpp プロジェクト: g-rutter/DynamO
  Event 
  IHardSphere::getEvent(const Particle &p1, const Particle &p2) const 
  { 
#ifdef DYNAMO_DEBUG
    if (!Sim->dynamics->isUpToDate(p1))
      M_throw() << "Particle 1 is not up to date: ID1=" << p1.getID() << ", ID2=" << p2.getID() << ", delay1=" << Sim->dynamics->getParticleDelay(p1);
  
    if (!Sim->dynamics->isUpToDate(p2))
      M_throw() << "Particle 2 is not up to date: ID1=" << p1.getID() << ", ID2=" << p2.getID() << ", delay2=" << Sim->dynamics->getParticleDelay(p2);

    if (p1 == p2)
      M_throw() << "You shouldn't pass p1==p2 events to the interactions!";
#endif 

    const double d = _diameter->getProperty(p1, p2);
    const double dt = Sim->dynamics->SphereSphereInRoot(p1, p2, d);

    if (dt != HUGE_VAL)
      return Event(p1, dt, INTERACTION, CORE, ID, p2);
  
    return Event(p1, HUGE_VAL, INTERACTION, NONE, ID, p2);
  }
コード例 #4
0
ファイル: buffer.hpp プロジェクト: armando-2011/DynamO
      /*! \brief Destroys any OpenGL resources associated with this
       * object.
       */
      inline void deinit() 
      {
#ifdef MAGNET_DEBUG
	if (_cl_buffer_acquired)
	  M_throw() << "Deinitialising a buffer which is acquired by the OpenCL system!";
#endif
	_cl_handle = ::cl::BufferGL();
	_cl_handle_init = false;
	if (_size)
	  glDeleteBuffersARB(1, &_buffer);
	_context = NULL;
	_size = 0;
      }
コード例 #5
0
ファイル: thinthread.cpp プロジェクト: MChudak/DynamO
  void
  IThinThread::runEvent(Particle& p1, Particle& p2, const IntEvent& iEvent)
  {
    ++Sim->eventCount;

    double d = (_diameter->getProperty(p1.getID())
		+ _diameter->getProperty(p2.getID())) * 0.5;
    double d2 = d * d;

    double e = (_e->getProperty(p1.getID())
		+ _e->getProperty(p2.getID())) * 0.5;

    double l = (_lambda->getProperty(p1.getID())
		+ _lambda->getProperty(p2.getID())) * 0.5;
    double ld2 = d * l * d * l;

    double wd = (_wellDepth->getProperty(p1.getID())
		 + _wellDepth->getProperty(p2.getID())) * 0.5;
    switch (iEvent.getType())
      {
      case CORE:
	{
	  PairEventData retVal(Sim->dynamics->SmoothSpheresColl(iEvent, e, d2, CORE));
	  IntEvent event(iEvent);
	  if (!isCaptured(p1, p2))
	    {
	      event.setType(STEP_IN);
	      retVal.setType(STEP_IN);
	      ICapture::add(p1, p2);
	    }
	  
	  (*Sim->_sigParticleUpdate)(retVal);
	  Sim->ptrScheduler->fullUpdate(p1, p2);
	  for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins)
	    Ptr->eventUpdate(event, retVal);
	  break;
	}
      case STEP_OUT:
	{
	  PairEventData retVal(Sim->dynamics->SphereWellEvent(iEvent, -wd, ld2, 0));
	  if (retVal.getType() != BOUNCE) ICapture::remove(p1, p2);
	  (*Sim->_sigParticleUpdate)(retVal);
	  Sim->ptrScheduler->fullUpdate(p1, p2);
	  for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins)
	    Ptr->eventUpdate(iEvent, retVal);
	  break;
	}
      default:
	M_throw() << "Unknown collision type";
      } 
  }
コード例 #6
0
ファイル: newtonian.cpp プロジェクト: vladutzik/DynamO
int
DynNewtonian::getSquareCellCollision3(const Particle& part, const Vector & origin, const Vector & width) const
{
    Vector  rpos(part.getPosition() - origin);
    Vector  vel(part.getVelocity());

    Sim->BCs->applyBC(rpos, vel);

    int retVal(0);
    double time(HUGE_VAL);

#ifdef DYNAMO_DEBUG
    for (size_t iDim = 0; iDim < NDIM; ++iDim)
        if ((vel[iDim] == 0) && (std::signbit(vel[iDim])))
            M_throw() << "You have negative zero velocities, dont use them."
                      << "\nPlease think of the neighbour lists.";
#endif

    for (size_t iDim = 0; iDim < NDIM; ++iDim)
    {
        double tmpdt = ((vel[iDim] < 0)
                        ? -rpos[iDim]/vel[iDim]
                        : (width[iDim]-rpos[iDim]) / vel[iDim]);

        if (tmpdt < time)
        {
            time = tmpdt;
            retVal = (vel[iDim] < 0) ? -(iDim+1) : (iDim+1);
        }
    }

    if (((retVal < 0) && (vel[abs(retVal)-1] > 0))
            || ((retVal > 0) && (vel[abs(retVal)-1] < 0)))
        M_throw() << "Found an error! retVal " << retVal
                  << " vel is " << vel[abs(retVal)-1];

    return retVal;
}
コード例 #7
0
ファイル: roughhardsphere.cpp プロジェクト: herbsolo/DynamO
IntEvent 
IRoughHardSphere::getEvent(const Particle& p1, const Particle& p2) const 
{ 
#ifdef DYNAMO_DEBUG
  if (!Sim->dynamics.getLiouvillean().isUpToDate(p1))
    M_throw() << "Particle 1 is not up to date";
  
  if (!Sim->dynamics.getLiouvillean().isUpToDate(p2))
    M_throw() << "Particle 2 is not up to date";
#endif

#ifdef DYNAMO_DEBUG
  if (p1 == p2)
    M_throw() << "You shouldn't pass p1==p2 events to the interactions!";
#endif 

  CPDData colldat(*Sim, p1, p2);

  double d2 = (_diameter->getProperty(p1.getID())
	       + _diameter->getProperty(p2.getID())) * 0.5;
  d2 *= d2;

  if (Sim->dynamics.getLiouvillean()
      .SphereSphereInRoot(colldat, d2,
			  p1.testState(Particle::DYNAMIC), p2.testState(Particle::DYNAMIC)))
    {
#ifdef DYNAMO_OverlapTesting
      if (Sim->dynamics.getLiouvillean().sphereOverlap(colldat, d2))
	M_throw() << "Overlapping particles found" 
		  << ", particle1 " << p1.getID() << ", particle2 " 
		  << p2.getID() << "\nOverlap = " << (sqrt(colldat.r2) - sqrt(d2))/Sim->dynamics.units().unitLength();
#endif

      return IntEvent(p1, p2, colldat.dt, CORE, *this);
    }
  
  return IntEvent(p1,p2,HUGE_VAL, NONE, *this);  
}
コード例 #8
0
ファイル: sphericalTop.cpp プロジェクト: pviswanathan/DynamO
  void 
  SpSphericalTop::operator<<(const magnet::xml::Node& XML)
  {
    SpPoint::operator<<(XML);

    try {
      inertiaConstant 
	= XML.getAttribute("InertiaConstant").as<double>() * Sim->dynamics.units().unitArea();
    } 
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CSSphericalTop";
      }
  }
コード例 #9
0
ファイル: fixedCollider.cpp プロジェクト: armando-2011/DynamO
  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";
      }
  }
コード例 #10
0
  void 
  IRotatedParallelCubes::operator<<(const magnet::xml::Node& XML)
  { 
    if (strcmp(XML.getAttribute("Type"),"RotatedParallelCubes"))
      M_throw() << "Attempting to load RotatedParallelCubes from " 
		<< XML.getAttribute("Type") << " entry";
  
    Interaction::operator<<(XML);
  
    try 
      {
	_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
						 Property::Units::Length());
	_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					  Property::Units::Dimensionless());
	intName = XML.getAttribute("Name");
	magnet::math::operator<<(Rotation, XML.getNode("Rotation"));
      }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CIRotatedParallelCubes";
      }
  }
コード例 #11
0
ファイル: oscillatingplate.hpp プロジェクト: MarkRunWu/DynamO
    double eval() const
    {
      switch (deriv)
	{
	case 0:
	  return (rp | nhat) - ( Sigma + wallnHatPosition());
	case 1:
	  return (vp | nhat) - velnHatWall();
	case 2:
	  return Delta * Omega * Omega * std::cos(Omega * t); 
	default:
	  M_throw() << "Invalid access";
	}
    }
コード例 #12
0
ファイル: sort.hpp プロジェクト: armando-2011/DynamO
      size_t padding()
      {
	switch(_mode)
	  {
	  case CPU:
	    return 1;
	  case NVIDIA:
	    return 1024;
	  case AMD:
	    return 64 * 256;
	  default:
	    M_throw() << "Functor has not yet been built";
	  }
      }
コード例 #13
0
ファイル: chain.cpp プロジェクト: g-rutter/DynamO
  void 
  TChain::operator<<(const magnet::xml::Node& XML) 
  {
    Topology::operator<<(XML);

    for (magnet::xml::Node node = XML.findNode("Molecule"); node.valid(); ++node)
      ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim)));
  
    size_t Clength = (*ranges.begin())->size();
    for (const shared_ptr<IDRange>& nRange : ranges)
      if (nRange->size() != Clength)
	M_throw() << "Size mismatch in loading one of the ranges in Chain topology \"" 
		  << _name << "\"";
  }
コード例 #14
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";
    }
コード例 #15
0
ファイル: liouvillean.cpp プロジェクト: armando-2011/DynamO
  void 
  Liouvillean::loadParticleXMLData(const magnet::xml::Node& XML)
  {
    dout << "Loading Particle Data" << std::endl;

    bool outofsequence = false;  
  
    for (magnet::xml::Node node = XML.getNode("ParticleData").fastGetNode("Pt"); 
	 node.valid(); ++node)
      {
	if (!node.hasAttribute("ID")
	    || node.getAttribute("ID").as<size_t>() != Sim->particleList.size())
	  outofsequence = true;
      
	Particle part(node, Sim->particleList.size());
	part.getVelocity() *= Sim->dynamics.units().unitVelocity();
	part.getPosition() *= Sim->dynamics.units().unitLength();
	Sim->particleList.push_back(part);
      }

    if (outofsequence)
      dout << "Particle ID's out of sequence!\n"
	   << "This can result in incorrect capture map loads etc.\n"
	   << "Erase any capture maps in the configuration file so they are regenerated." << std::endl;

    Sim->N = Sim->particleList.size();

    dout << "Particle count " << Sim->N << std::endl;

    if (XML.getNode("ParticleData").hasAttribute("OrientationData"))
      {
	orientationData.resize(Sim->N);
	size_t i(0);
	for (magnet::xml::Node node = XML.getNode("ParticleData").fastGetNode("Pt"); 
	     node.valid(); ++node, ++i)
	  {
	    orientationData[i].orientation << node.getNode("U");
	    orientationData[i].angularVelocity << node.getNode("O");
      
	    double oL = orientationData[i].orientation.nrm();
      
	    if (!(oL > 0.0))
	      M_throw() << "Particle ID " << i 
			<< " orientation vector is zero!";
      
	    //Makes the vector a unit vector
	    orientationData[i].orientation /= oL;
	  }
      }
  }
コード例 #16
0
ファイル: neighbourlist.cpp プロジェクト: rollin312018/DynamO
  std::unique_ptr<IDRange>
  SNeighbourList::getParticleNeighbours(const Particle& part) const
  {
#ifdef DYNAMO_DEBUG
    if (!std::dynamic_pointer_cast<GNeighbourList>(Sim->globals[NBListID]))
      M_throw() << "Not a GNeighbourList!";
#endif

    //Grab a reference to the neighbour list
    const GNeighbourList& nblist(*static_cast<const GNeighbourList*>(Sim->globals[NBListID].get()));
    IDRangeList* range_ptr = new IDRangeList();
    nblist.getParticleNeighbours(part, range_ptr->getContainer());
    return std::unique_ptr<IDRange>(range_ptr);
  }
コード例 #17
0
ファイル: offcentre_sphere.hpp プロジェクト: MarkRunWu/DynamO
    double max() const
    {
      switch (deriv)
	{
	case 1:
	  return _f1max;
	case 2:
	  return _f2max;
	case 3:
	  return _f3max;
	default:
	  M_throw() << "Invalid access";
	}
    }
コード例 #18
0
ファイル: swsequence.cpp プロジェクト: g-rutter/DynamO
  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());
    
    ICapture::loadCaptureMap(XML);
    
    //Load the sequence
    sequence.clear();
    std::set<size_t> letters;
    
    for (magnet::xml::Node node = XML.getNode("Sequence").findNode("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").findNode("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>();
      }
  }
コード例 #19
0
ファイル: property.hpp プロジェクト: MChudak/DynamO
    /*! \brief Method which loads the properties from the XML configuration file.
      \param node A xml Node at the root dynamoconfig Node of the config file.
    */
    inline PropertyStore& operator<<(const magnet::xml::Node& node)
    {
      if (node.hasNode("Properties"))
	for (magnet::xml::Node propNode = node.getNode("Properties").fastGetNode("Property");
	     propNode.valid(); ++propNode)
	  {
	    if (!std::string("PerParticle").compare(propNode.getAttribute("Type")))
	      _namedProperties.push_back(Value(new ParticleProperty(propNode)));
	    else
	      M_throw() << "Unsupported Property type, " << propNode.getAttribute("Type").getValue();
	  }
    
      return *this;
    }
コード例 #20
0
ファイル: nblistentry.cpp プロジェクト: MarkRunWu/DynamO
  void 
  SCENBList::getParticleNeighbourhood(const Particle& part, 
				       const GNeighbourList::nbHoodFunc& func) const
  {
#ifdef DYNAMO_DEBUG
    if (!isApplicable(part))
      M_throw() << "This complexNBlist entry ("
		<< name << ") is not valid for this particle (" 
		<< part.getID() << ") yet it is being used anyway!";
#endif

//    static_cast<const GNeighbourList&>(*Sim->globals[nblistID])
//      .getParticleNeighbourhood(part, func);
  }
コード例 #21
0
ファイル: lines.cpp プロジェクト: pinggy/DynamO
  void
  ILines::runEvent(Particle& p1, Particle& p2, const IntEvent& iEvent)
  {
    PairEventData retval;

    switch (iEvent.getType())
      {
      case CORE:
	{
	  ++Sim->eventCount;
	  //We have a line interaction! Run it
	  double e = (_e->getProperty(p1.getID())
		      + _e->getProperty(p2.getID())) * 0.5;
	  double l = (_length->getProperty(p1.getID())
		      + _length->getProperty(p2.getID())) * 0.5;

	  retval = Sim->dynamics->runLineLineCollision(iEvent, e, l);
	  break;
	}
      case NBHOOD_IN:
	{
	  ICapture::add(p1, p2);
	  retval = PairEventData(p1, p2, *Sim->species[p1], *Sim->species[p2], VIRTUAL);
	  iEvent.setType(VIRTUAL);
	  break;
	}
      case NBHOOD_OUT:
	{
	  ICapture::remove(p1, p2);
	  retval = PairEventData(p1, p2, *Sim->species[p1], *Sim->species[p2], VIRTUAL);
	  iEvent.setType(VIRTUAL);
	  break;
	}
      case VIRTUAL:
	{
	  retval = PairEventData(p1, p2, *Sim->species[p1], *Sim->species[p2], VIRTUAL);
	  iEvent.setType(VIRTUAL);
	  break;
	}
      default:
	M_throw() << "Unknown collision type";
      }
    
    Sim->_sigParticleUpdate(retval);
    
    Sim->ptrScheduler->fullUpdate(p1, p2);
    
    for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins)
      Ptr->eventUpdate(iEvent, retval);
  }
コード例 #22
0
ファイル: roughhardsphere.cpp プロジェクト: herbsolo/DynamO
void 
IRoughHardSphere::operator<<(const magnet::xml::Node& XML)
{ 
  if (strcmp(XML.getAttribute("Type"),"RoughHardSphere"))
    M_throw() << "Attempting to load Hardsphere from non RoughHardSphere entry";
  
  range.set_ptr(C2Range::getClass(XML,Sim));
  
  try 
    {
      _diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
					       Property::Units::Length());
      _e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					Property::Units::Dimensionless());
      _et = Sim->_properties.getProperty(XML.getAttribute("TangentialElasticity"),
					 Property::Units::Dimensionless());
      intName = XML.getAttribute("Name");
    }
  catch (boost::bad_lexical_cast &)
    {
      M_throw() << "Failed a lexical cast in IRoughHardSphere";
    }
}
コード例 #23
0
ファイル: outputplugin.cpp プロジェクト: Bradleydi/DynamO
  shared_ptr<OutputPlugin>
  OutputPlugin::getPlugin(std::string Details, const dynamo::Simulation* Sim)
  {
    typedef boost::tokenizer<boost::char_separator<char> > tokenizer;

    rapidxml::xml_document<> doc;
    rapidxml::xml_node<> *node = doc.allocate_node(rapidxml::node_element, 
						   doc.allocate_string("OP"));

    boost::char_separator<char> DetailsSep(":");
    boost::char_separator<char> OptionsSep(",");
    boost::char_separator<char> ValueSep("=", "", boost::keep_empty_tokens);

    tokenizer tokens(Details, DetailsSep);
    tokenizer::iterator details_iter = tokens.begin();

    node->append_attribute(doc.allocate_attribute
			   ("Type", doc.allocate_string(details_iter->c_str())));

    ++details_iter;
    if (details_iter != tokens.end())
      {
	tokenizer option_tokens(*details_iter, OptionsSep);

	if (++details_iter != tokens.end())
	  M_throw() << "Two colons in outputplugin options " << *details_iter;

	for (tokenizer::iterator options_iter = option_tokens.begin();
	     options_iter != option_tokens.end(); ++options_iter)
	  {
	    tokenizer value_tokens(*options_iter, ValueSep);

	    tokenizer::iterator value_iter = value_tokens.begin();
	    std::string opName(*value_iter);
	    std::string val;
	    if (++value_iter == value_tokens.end())
	      //There is no value to save, must be a flag
	      val = "";
	    else
	      val = *value_iter;

	    node->append_attribute(doc.allocate_attribute
				   (doc.allocate_string(opName.c_str()), 
				    doc.allocate_string(val.c_str())));
	  }
      }

    return getPlugin(magnet::xml::Node(node, NULL), Sim);
  }
コード例 #24
0
ファイル: systemonly.cpp プロジェクト: ctianjin/DynamO
  void
  SSystemOnly::initialise()
  {
    dout << "Reinitialising on collision " << Sim->eventCount << std::endl;

    if (Sim->systems.empty())
      M_throw() << "A SystemOnlyScheduler used when there are no system events?";
  
    sorter->clear();
    sorter->resize(Sim->N+1);
    eventCount.clear();
    eventCount.resize(Sim->N+1, 0);  
    sorter->init();
    rebuildSystemEvents();
  }
コード例 #25
0
ファイル: radiusGyration.cpp プロジェクト: Bradleydi/DynamO
  void 
  OPRGyration::replicaExchange(OutputPlugin& plug)
  {
    std::swap(Sim, static_cast<OPRGyration&>(plug).Sim);

    std::list<CTCdata>::iterator iPtr1 = chains.begin(), iPtr2 = static_cast<OPRGyration&>(plug).chains.begin();

#ifdef DYNAMO_DEBUG
    if (chains.size() != static_cast<OPRGyration&>(plug).chains.size())
      M_throw() << "Size mismatch when exchanging!";
#endif

    while (iPtr1 != chains.end())
      {
#ifdef DYNAMO_DEBUG
	if (iPtr1->chainPtr->getName() != iPtr2->chainPtr->getName())
	  M_throw() << "Name mismatch while replexing!";
#endif
	std::swap(iPtr1->chainPtr, iPtr2->chainPtr);

	++iPtr1;
	++iPtr2;
      }
  }
コード例 #26
0
ファイル: dumbbells.cpp プロジェクト: armando-2011/DynamO
  void 
  IDumbbells::operator<<(const magnet::xml::Node& XML)
  { 
    if (strcmp(XML.getAttribute("Type"),"Dumbbells"))
      M_throw() << "Attempting to load Dumbbells from non Dumbbells entry";
  
    Interaction::operator<<(XML);
  
    try 
      {
	_length = Sim->_properties.getProperty(XML.getAttribute("Length"),
					       Property::Units::Length());
	_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
					  Property::Units::Dimensionless());
	_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
						 Property::Units::Length());
	intName = XML.getAttribute("Name");
	ISingleCapture::loadCaptureMap(XML);
      }
    catch (boost::bad_lexical_cast &)
      {
	M_throw() << "Failed a lexical cast in CIDumbbells";
      }
  }
コード例 #27
0
ファイル: scheduler.cpp プロジェクト: pviswanathan/DynamO
  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";
  }
コード例 #28
0
ファイル: liouvillean.cpp プロジェクト: armando-2011/DynamO
  Liouvillean* 
  Liouvillean::loadClass(const magnet::xml::Node& XML, dynamo::SimData* tmp)
  {
    if (!strcmp(XML.getAttribute("Type"),"Newtonian"))
      return new LNewtonian(tmp);
    if (!strcmp(XML.getAttribute("Type"),"NewtonianGravity"))
      return new LNewtonianGravity(tmp, XML);
    else if (!strcmp(XML.getAttribute("Type"),"SLLOD"))
      return new LSLLOD(tmp);
    else if (!strcmp(XML.getAttribute("Type"),"NewtonianMC"))
      return new LNewtonianMC(tmp, XML);
    else 
      M_throw() << XML.getAttribute("Type")
		<< ", Unknown type of Liouvillean encountered";
  }
コード例 #29
0
ファイル: dynamics.cpp プロジェクト: MChudak/DynamO
  shared_ptr<Dynamics>
  Dynamics::getClass(const magnet::xml::Node& XML, dynamo::Simulation* tmp)
  {
    if (!XML.getAttribute("Type").getValue().compare("Newtonian"))
      return shared_ptr<Dynamics>(new DynNewtonian(tmp));
    if (!XML.getAttribute("Type").getValue().compare("NewtonianGravity"))
      return shared_ptr<Dynamics>(new DynGravity(tmp, XML));
    else if (!XML.getAttribute("Type").getValue().compare("NewtonianMC"))
      return shared_ptr<Dynamics>(new DynNewtonianMC(tmp, XML));
    else if (!XML.getAttribute("Type").getValue().compare("NewtonianMCCMap"))
      return shared_ptr<Dynamics>(new DynNewtonianMCCMap(tmp, XML));
    else
      M_throw() << XML.getAttribute("Type").getValue()
		<< ", Unknown type of Dynamics encountered";
  }
コード例 #30
0
ファイル: context.hpp プロジェクト: BigMacchia/DynamO
      inline void testAndSetState(const bool newstate, bool& oldstate, const GLenum cap)
      {
#ifdef MAGNET_DEBUG
	if (glIsEnabled(cap) != oldstate)
	  M_throw() << "Something is altering the GL state outside of Magnet!";
#endif

	if (newstate==oldstate) return;

	if (newstate) 
	  glEnable(cap);
	else 
	  glDisable(cap);
	oldstate = newstate;
      }