public ParticleSpring(int ID, Particle particleA, Particle particleB, double restLength, double springConstant, double damping) { m_ID = ID; m_particleA = particleA; m_particleB = particleB; m_restLength = restLength; m_springConstant = springConstant; m_Damping = damping; }
public ParticleSpring makeSpringFromElementID(ElementId eid, Particle a, Particle b, double restLength, double springConstant, double damping) { bool found = false; for (int i = 0; i < springs.Count(); ++i) { if (eid != null && (springs[i].getElementID() != null)) { if (eid == springs[i].getElementID()) { found = true; return springs[i]; } } } if (found == false) { ParticleSpring s = new ParticleSpring(springID++, eid, a, b, restLength, springConstant, damping); springs.Add(s); return s; } return null; }
public ParticleSpring makeSpring(Particle a, Particle b, double restLength, double springConstant, double damping) { ParticleSpring s = new ParticleSpring(springID++, a, b, restLength, springConstant, damping); springs.Add(s); return s; }
public Particle makeParticleFromXYZ(ElementId eid, double mass, XYZ position, bool fix) { bool found = false; for (int i = 0; i < particles.Count(); ++i) { if (eid != null && (particles[i].getElementID() != null)&& position!=null) { if (position.IsAlmostEqualTo(particles[i].getPosition())) { found = true; particles[i].setPosition(position); return particles[i]; } } } if (found == false)//if we did not find one make a new one { Particle part = new Particle(partID++, eid, mass, position, fix); particles.Add(part); return part; } return null; }
public Particle makeParticle(double mass, XYZ position, bool fix) { Particle p = new Particle(partID++, mass, position, fix); particles.Add(p); return p; }
public ParticleSpring makeOrUpdateSpring(int ID, Particle a, Particle b, double restLength, double springConstant, double damping) { bool found = false; for (int i = 0; i < springs.Count(); ++i) { if (ID != null && (springs[i].ID() != null)) { if (ID == springs[i].ID()) { found = true; return springs[i]; } } } if (found == false) { ParticleSpring s = new ParticleSpring(ID++, a, b, restLength, springConstant, damping); springs.Add(s); return s; } return null; }
public Particle makeOrUpdateParticle(int ID, double mass, XYZ position, bool fix) { bool found = false; for (int i = 0; i < particles.Count(); ++i) { if (ID != null && (particles[i].ID() != null)) { if (ID == particles[i].ID()) { found = true; particles[i].setPosition(position); return particles[i]; } } } if (found == false)//if we did not find one make a new one { Particle part = new Particle(ID++, mass, position, fix); particles.Add(part); return part; } return null; }