def test_get_triangles_per_vertex(): "Tests part of the get_triangles_per_vertex function" dagmc_tags = dagmc_stats.get_dagmc_tags(my_core) native_ranges = dagmc_stats.get_native_ranges(my_core, root_set, entity_types) t_p_v_data = dagmc_stats.get_triangles_per_vertex(my_core, native_ranges) vertices = my_core.get_entities_by_type(root_set, types.MBVERTEX).size() assert(len(t_p_v_data) == vertices)
def collect_statistics(my_core, root_set, tar_meshset, display_options): """ Collects statistics for a range of different areas inputs ------ my_core : a MOAB Core instance root_set : the root set for a file tar_meshset : the meshset for the triangle aspect ratio statistic outputs ------- stats : a dictionary containing statistics for a variety of different areas """ stats = {} data = {} dagmc_tags = dagmc_stats.get_dagmc_tags(my_core) entity_types = [types.MBVERTEX, types.MBTRI, types.MBENTITYSET] native_ranges = dagmc_stats.get_native_ranges(my_core, root_set, entity_types) # get Ranges of various entities entityset_ranges = dagmc_stats.get_entityset_ranges(my_core, root_set, dagmc_tags['geom_dim']) if display_options['NR']: stats['native_ranges'] = native_ranges if display_options['ER']: stats['entity_ranges'] = entityset_ranges if display_options['SPV'] or display_options['SPV_data']: spv_key = 'S_P_V' data[spv_key] = dagmc_stats.get_surfaces_per_volume( my_core, entityset_ranges) stats[spv_key] = get_stats(data[spv_key].values()) if display_options['TPS'] or display_options['SPV']: tps_key = 'T_P_S' data[tps_key] = dagmc_stats.get_triangles_per_surface( my_core, entityset_ranges) stats[tps_key] = get_stats(data[tps_key].values()) if display_options['TPV']: tpv_key = 'T_P_V' data[tpv_key] = dagmc_stats.get_triangles_per_vertex( my_core, native_ranges) stats[tpv_key] = get_stats(data[tpv_key]) if display_options['TAR'] or (tar_meshset != my_core.get_root_set()): tar_key = 'T_A_R' data[tar_key] = dagmc_stats.get_triangle_aspect_ratio( my_core, tar_meshset, dagmc_tags['geom_dim']) stats[tar_key] = get_stats(data[tar_key]) if display_options['SPV_data']: data['SPV_Entity'] = entity_specific_stats.get_spv_data(my_core, entityset_ranges, dagmc_tags['global_id']) if display_options['TPS_data']: data['TPS_Entity'] = entity_specific_stats.get_tps_data(my_core, entityset_ranges, dagmc_tags['global_id']) return stats, data