Commit 71cdde71 authored by Nathan Coppin's avatar Nathan Coppin
Browse files

adding ignoring a given material

parent d605d6d6
......@@ -158,7 +158,6 @@ class ParticleProblem :
self._lib.particle_problem_get_delassus(self._p,_np2c(delassus))
return delassus
def body_velocity(self):
return self._get_array("body", self._bodytype)["velocity"]
......@@ -612,8 +611,10 @@ class ParticleProblem :
invertI = 0 if forced else 1/I
invertM = 0 if forced else 1/np.sum(masses)
idd = self.add_body(x, invertM, invertI)
if not isinstance(material,(list, np.ndarray)):
material = [material for i in range(positions.shape[0])]
for i in range(positions.shape[0]):
self.add_particle_to_body(positions[i,:]-x,radii[i],idd, material)
self.add_particle_to_body(positions[i,:]-x,radii[i],idd, material[i])
def add_particle_to_body(self, x, r, body, material="default"):
"""Adds a particle in the particle problem.
......@@ -624,6 +625,8 @@ class ParticleProblem :
material -- Particle material
"""
imat = self.get_material_id(material)
if material.lower() == "ignore":
imat = -1
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):
......
......@@ -805,6 +805,7 @@ static void particle_problem_gen_contacts(ParticleProblem *p, const double alert
}
#endif
for (size_t i = 0; i < vectorSize(p->particles); ++i) {
if(p->particles[i].material >= 0)
contact_tree_add_particle(tree, i, old_contacts, &iold);
}
for (size_t i = 0; i < vectorSize(p->segments); ++i) {
......
Markdown is supported
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