← Back to team overview

yade-users team mailing list archive

[Question #701637]: Why are some particles white

 

New question #701637 on Yade:
https://answers.launchpad.net/yade/+question/701637

I wrote a program to identify the force chain particles. In order to display each force chain, I deleted the non force chain particles and set the color for each force chain, but there is no white. However, as a result, many particles appear white.
This is my display program:

def force_chain_display(force_chain,neighbors):
	""" Remove particles other than force chains, so the force chain is displayed
	use the index in array force_chain to find the id of force chain particles in neighbors,
	then delete the irrelevant particles
	"""

	## Only force chain particles are displayed
	fc_particle_index_list = force_chain.flatten().tolist()
	fc_particle_index_list = list(set(fc_particle_index_list))
	fc_particle_index_list.remove(-1)
	fc_particle_id_list = []
	for index in fc_particle_index_list:
		fc_particle_id_list.append(neighbors[index,0])
	for b in O.bodies:
		if isinstance(b.shape,Sphere):
			if b.id not in fc_particle_id_list:
				O.bodies.erase(b.id)

	## Make the particles of the same force chain the same color
	fcn = force_chain.shape[0]
	valueToBeRemoved = -1
	## Create RGB color array
	RGB_array = np.array([[47,79,79],[105,105,105],[112,128,144],[0,0,128],[100,149,237],[72,61,139],[0,191,255],[0,100,0],[85,107,47],[255,255,0],[205,92,92],[139,69,19],[255,0,0],[255,20,147],[160,32,240],[255,165,0],
	[205,133,63],[244,164,96],[192,255,62]])
	for i in range(fcn):
		single_force_chain_index_list = list(force_chain[i,:])
		single_force_chain_index_list = [value for value in single_force_chain_index_list if value != valueToBeRemoved]
		ran = random.randint(0,18)
		print(ran)
		for particle_index in single_force_chain_index_list:
			pid = neighbors[particle_index,0]
			O.bodies[pid].shape.color = (RGB_array[ran,0],RGB_array[ran,1],RGB_array[ran,2])

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.