for dn in domains_from_config: if (len(domain_density[dn]) - 1) < continue_from: sn = len(domain_density[dn]) - 1 msg = "\nINFO: elements from the domain " + dn + " were set to the highest state.\n" beso_lib.write_to_log(file_name, msg) print(msg) else: sn = continue_from for en in domains[dn]: elm_states[en] = sn elif continue_from[-4:] == ".frd": elm_states = beso_lib.import_frd_state(continue_from, elm_states, number_of_states, file_name) elif continue_from[-4:] == ".inp": elm_states = beso_lib.import_inp_state(continue_from, elm_states, number_of_states, file_name) elif continue_from[-4:] == ".csv": elm_states = beso_lib.import_csv_state(continue_from, elm_states, file_name) else: for dn in domains_from_config: for en in domains[dn]: elm_states[en] = len(domain_density[dn]) - 1 # set to highest state # computing volume or area, and centre of gravity of each element [cg, cg_min, cg_max, volume_elm, area_elm] = beso_lib.elm_volume_cg(file_name, nodes, Elements) mass = [0.0] mass_full = 0 # sum from initial states TODO make it independent on starting elm_states? for dn in domains_from_config: if domain_optimized[dn] is True: for en in domain_shells[dn]: mass[0] += domain_density[dn][elm_states[en]] * area_elm[en] * domain_thickness[dn][elm_states[en]] mass_full += domain_density[dn][len(domain_density[dn]) - 1] * area_elm[en] * domain_thickness[dn][