# Create rigid bodies bodies = [] body_types = [] body_names = [] for ID, structure in enumerate(structures): print 'Creating structures = ', structure[1] # Read vertex and clones files struct_ref_config = read_vertex_file.read_vertex_file(structure[0]) num_bodies_struct, struct_locations, struct_orientations = read_clones_file.read_clones_file(structure[1]) # Read slip file if it exists slip = None if(len(structure) > 2): slip = read_slip_file.read_slip_file(structure[2]) body_types.append(num_bodies_struct) body_names.append(structures_ID[ID]) # Create each body of type structure for i in range(num_bodies_struct): b = body.Body(struct_locations[i], struct_orientations[i], struct_ref_config, a) b.mobility_blobs = set_mobility_blobs(read.mobility_blobs_implementation) b.ID = structures_ID[ID] # Calculate body length for the RFD if i == 0: b.calc_body_length() else: b.body_length = bodies[-1].body_length multi_bodies_functions.set_slip_by_ID(b, slip) # Append bodies to total bodies list bodies.append(b)
with open(output_name + '.random_state', 'wb') as f: cpickle.dump(np.random.get_state(), f) # Create rigid bodies bodies = [] body_types = [] body_names = [] for ID, structure in enumerate(structures): print('Creating structures = ', structure[1]) # Read vertex and clones files struct_ref_config = read_vertex_file.read_vertex_file(structure[0]) num_bodies_struct, struct_locations, struct_orientations = read_clones_file.read_clones_file(structure[1]) # Read slip file if it exists slip = None if(len(structure) > 2): slip = read_slip_file.read_slip_file(structure[2]) body_types.append(num_bodies_struct) body_names.append(structures_ID[ID]) # Create each body of type structure for i in range(num_bodies_struct): b = body.Body(struct_locations[i], struct_orientations[i], struct_ref_config, a) b.mobility_blobs = set_mobility_blobs(read.mobility_blobs_implementation) b.ID = structures_ID[ID] # Calculate body length for the RFD if i == 0: b.calc_body_length() else: b.body_length = bodies[-1].body_length multi_bodies_functions.set_slip_by_ID(b, slip) # Append bodies to total bodies list bodies.append(b)