Commit e6e1505a authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

backward compatibility

parent b9edf0b6
Pipeline #9370 failed with stages
in 1 minute
......@@ -607,17 +607,31 @@ class ParticleProblem :
self.add_particle(positions[i,:]-x,radii[i],idd, material)
def add_particle(self, x, r, body=0, material="default"):
def add_particle_to_body(self, x, r, body, material="default"):
"""Adds a particle in the particle problem.
Keyword arguments:
x -- Tuple to set the centre particle position
r -- Particle radius
tag -- Particle material
material -- Particle material
imat = self.get_material_id(material)
self._lib.particle_problem_add_particle(self._p, self._coord_type(*x), c_double(r), c_size_t(body), c_int(imat))
def add_particle(self, x, r, m, tag="default",forced=False, inverse_inertia=None):
"""Add a particle in the particle container.
Keyword arguments:
x -- tuple to set the centre particle position
r -- particle radius
m -- particle mass
tag -- particle material
if (not forced) and inverse_inertia is None:
inverse_inertia = 2/(m*r**2) if self._dim == 2 else 5/(2*m*r**2)
body = self.add_body(x, 0 if forced else 1/m, 0 if forced else inverse_inertia)
self.add_particle_to_body([0]*self._dim, r, body, tag)
def set_use_queue(self, use_queue=1):
"""Enables the use of the queue if 1 and disables it if 0."""
......@@ -675,7 +689,7 @@ class ParticleProblem :
def add_disk(t, stag) :
if t in addv : return
self.add_particle(x[t]+shift, 0, bndbody, material)
self.add_particle(x[t]+shift, 0, bndbody, material, forced=True)
def add_segment(t0, t1, stag) :
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment