Exemple #1
0
CPDData::CPDData(const dynamo::SimData& Sim, const CRange& range1, 
		 const CRange& range2):
  dt(HUGE_VAL),
  p1(NULL),
  p2(NULL)
{
  Vector  COMVel1(0,0,0), COMVel2(0,0,0), COMPos1(0,0,0), COMPos2(0,0,0);
  
  double structmass1(0), structmass2(0);
    
  BOOST_FOREACH(const size_t& ID, range1)
    {
      double mass = Sim.dynamics.getSpecies(Sim.particleList[ID]).getMass(ID);

      structmass1 += mass;
      COMVel1 += Sim.particleList[ID].getVelocity() * mass;
      COMPos1 += Sim.particleList[ID].getPosition() * mass;
    }
Exemple #2
0
NEventData
DynNewtonian::multibdyCollision(const IDRange& range1, const IDRange& range2, const double&, const EEventType& eType) const
{
    Vector COMVel1(0,0,0), COMVel2(0,0,0), COMPos1(0,0,0), COMPos2(0,0,0);

    double structmass1(0), structmass2(0);

    BOOST_FOREACH(const size_t& ID, range1)
    {
        updateParticle(Sim->particles[ID]);

        double mass = Sim->species[Sim->particles[ID]]->getMass(ID);
        structmass1 += mass;

        Vector pos(Sim->particles[ID].getPosition()),
               vel(Sim->particles[ID].getVelocity());

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

        COMVel1 += vel * mass;

        COMPos1 += pos * mass;
    }