Example #1
0
void
IMultiCapture::loadCaptureMap(const magnet::xml::Node& XML)
{
    if (XML.hasNode("CaptureMap"))
    {
        noXmlLoad = false;
        clear();

        for (magnet::xml::Node node = XML.getNode("CaptureMap").fastGetNode("Pair");
                node.valid(); ++node)
            captureMap[cMapKey(node.getAttribute("ID1").as<size_t>(),
                               node.getAttribute("ID2").as<size_t>())]
                = node.getAttribute("val").as<size_t>();
    }
}
Example #2
0
  void 
  IMultiCapture::initCaptureMap(const std::vector<Particle>& particleList)
  {
    //If not loaded or invalidated
    if (noXmlLoad)
      {      
	captureMap.clear();
      
	for (std::vector<Particle>::const_iterator iPtr 
	       = particleList.begin();
	     iPtr != particleList.end(); iPtr++) 
	  for (std::vector<Particle>::const_iterator iPtr2 = iPtr + 1;
	       iPtr2 != particleList.end(); iPtr2++)
	    {
	      int capval = captureTest(*iPtr,*iPtr2);
	      if (captureTest(*iPtr,*iPtr2))
		captureMap[cMapKey(iPtr->getID(), iPtr2->getID())] 
		  = capval; 
	    }
      }
  }
Example #3
0
void
IStepped::runEvent(const Particle& p1, 
		    const Particle& p2,
		    const IntEvent& iEvent) const
{
  ++Sim->eventCount;

  switch (iEvent.getType())
    {
    case WELL_OUT:
      {
	cmap_it capstat = getCMap_it(p1,p2);
	
	double d = steps[capstat->second-1].first * _unitLength->getMaxValue();
	double d2 = d * d;
	double dE = steps[capstat->second-1].second;
	if (capstat->second > 1)
	  dE -= steps[capstat->second - 2].second;
	dE *= _unitEnergy->getMaxValue();

	PairEventData retVal(Sim->dynamics.getLiouvillean().SphereWellEvent
			      (iEvent, dE, d2));
	
	if (retVal.getType() != BOUNCE)
	  if (!(--capstat->second))
	    //capstat is zero so delete
	    captureMap.erase(capstat);

	Sim->signalParticleUpdate(retVal);

	Sim->ptrScheduler->fullUpdate(p1, p2);
	
	BOOST_FOREACH(magnet::ClonePtr<OutputPlugin> & Ptr, Sim->outputPlugins)
	  Ptr->eventUpdate(iEvent, retVal);
	break;
      }
    case WELL_IN:
      {
	cmap_it capstat = getCMap_it(p1, p2);
	
	if (capstat == captureMap.end())
	  capstat = captureMap.insert
	    (captureMapType::value_type
	     ((p1.getID() < p2.getID())
	      ? cMapKey(p1.getID(), p2.getID())
	      : cMapKey(p2.getID(), p1.getID()),
	      0)).first;
	
	double d = steps[capstat->second].first * _unitLength->getMaxValue();
	double d2 = d * d;
	double dE = steps[capstat->second].second;
	if (capstat->second > 0)
	  dE -= steps[capstat->second - 1].second;
	dE *= _unitEnergy->getMaxValue();


	PairEventData retVal = Sim->dynamics.getLiouvillean().SphereWellEvent(iEvent, -dE, d2);
	
	if (retVal.getType() != BOUNCE)
	  ++(capstat->second);
	else if (!capstat->second)
	  captureMap.erase(capstat);
	
	Sim->signalParticleUpdate(retVal);
	
	Sim->ptrScheduler->fullUpdate(p1, p2);
	
	BOOST_FOREACH(magnet::ClonePtr<OutputPlugin> & Ptr, Sim->outputPlugins)
	  Ptr->eventUpdate(iEvent, retVal);
	    
	break;
      }
    default:
      M_throw() << "Unknown collision type";
    } 
}
Example #4
0
void
IMultiCapture::testAddToCaptureMap(const Particle& p1, const size_t& p2) const
{
    int capval = captureTest(p1, Sim->particles[p2]);
    if (capval) captureMap[cMapKey(p1.getID(), p2)] = capval;
}