Beispiel #1
0
  void
  Scheduler::initialise()
  {
    //Now, the scheduler is used to test the state of the system.
    dout << "Checking the simulation configuration for any errors" << std::endl;
    size_t warnings(0);

    for (const auto& interaction_ptr : Sim->interactions)
      {
	dout << "Checking Interaction \"" << interaction_ptr->getName() << "\" for invalid states" << std::endl;
	warnings += interaction_ptr->validateState(warnings < 101, 101 - warnings);
      }
    
    for (size_t id1(0); id1 < Sim->particles.size(); ++id1)
      {
	std::unique_ptr<IDRange> ids(getParticleNeighbours(Sim->particles[id1]));
	for (const size_t id2 : *ids)
	  if (id2 > id1)
	    if (Sim->getInteraction(Sim->particles[id1], Sim->particles[id2])
		->validateState(Sim->particles[id1], Sim->particles[id2], (warnings < 101)))
	      ++warnings;
      }
    
    for(const Particle& part : Sim->particles)
      for (const shared_ptr<Local>& lcl : Sim->locals)
      if (lcl->isInteraction(part))
	if (lcl->validateState(part, (warnings < 101)))
	  ++warnings;
    
    if (warnings > 100)
      derr << "Over 100 warnings of invalid states, further output was suppressed (total of " << warnings << " warnings detected)" << std::endl;

    dout << "Building all events on collision " << Sim->eventCount << std::endl;
    rebuildList();
  }
Beispiel #2
0
  void 
  Scheduler::addEvents(Particle& part)
  {  
    Sim->dynamics->updateParticle(part);

    //Add the global events
    for (const shared_ptr<Global>& glob : Sim->globals)
      if (glob->isInteraction(part))
	sorter->push(glob->getEvent(part));
  
    //Add the local cell events
    std::unique_ptr<IDRange> ids(getParticleLocals(part));
    
    for (const size_t id2 : *ids)
      addLocalEvent(part, id2);

    //Now add the interaction events
    ids = getParticleNeighbours(part);
    for (const size_t id2 : *ids)
      addInteractionEvent(part, id2);
  }
Beispiel #3
0
 IDRangeList
 GCells::getParticleNeighbours(const Vector& vec) const
 {
   return getParticleNeighbours(getCellID(vec));
 }
Beispiel #4
0
 IDRangeList
 GCells::getParticleNeighbours(const Particle& part) const
 {
   return getParticleNeighbours(partCellData[part.getID()]);
 }