MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <iostream>
#include <cstdlib>
#include "moab/Range.hpp"
#include "moab/Core.hpp"
#include "MBTagConventions.hpp"
#include "moab/GeomTopoTool.hpp"
Go to the source code of this file.
Enumerations | |
enum | Link { NONE = 0, SOLID, DASHED } |
Functions | |
static void | usage (const char *name, bool brief=true) |
static void | write_dot (Link contained, Link children) |
static void | dot_nodes (std::ostream &s, Range &sets_out) |
static void | dot_children (std::ostream &s, const Range &sets, bool dashed) |
static void | dot_contained (std::ostream &s, const Range &sets, bool dashed) |
int | main (int argc, char *argv[]) |
static void | dot_get_sets (Range &curr_sets, Range &result_sets, Tag tag, void *tag_val=0) |
static void | dot_write_node (std::ostream &s, EntityHandle h, const char *label, int *id=0) |
static void | dot_write_id_nodes (std::ostream &s, const Range &entites, Tag id_tag, const char *type_name) |
static void | dot_down_link (std::ostream &s, EntityHandle parent, EntityHandle child, bool dashed, const char *label=0) |
Variables | |
Tag | geomTag = 0 |
Tag | blockTag = 0 |
Tag | sideTag = 0 |
Tag | nodeTag = 0 |
Tag | nameTag = 0 |
Tag | idTag = 0 |
bool | printAnonSets = false |
bool | printSVSense = false |
Core | mb |
enum Link |
void dot_children | ( | std::ostream & | s, |
const Range & | sets, | ||
bool | dashed | ||
) | [static] |
Definition at line 285 of file gsets.cpp.
References moab::Range::begin(), dot_down_link(), moab::Range::end(), moab::Core::get_parent_meshsets(), moab::intersect(), mb, MB_SUCCESS, printSVSense, and SENSE_FORWARD.
Referenced by write_dot().
{ int sense; const char *fstr = "forward", *rstr = "reverse"; for( Range::iterator i = sets.begin(); i != sets.end(); ++i ) { Range parents; mb.get_parent_meshsets( *i, parents ); parents = intersect( parents, sets ); for( Range::iterator j = parents.begin(); j != parents.end(); ++j ) { const char* linklabel = 0; if( printSVSense && MB_SUCCESS == geomTool.get_sense( *i, *j, sense ) ) // check here only one sense, as before... linklabel = ( sense == (int)SENSE_FORWARD ) ? fstr : rstr; dot_down_link( s, *j, *i, dashed, linklabel ); } } }
void dot_contained | ( | std::ostream & | s, |
const Range & | sets, | ||
bool | dashed | ||
) | [static] |
Definition at line 308 of file gsets.cpp.
References moab::Range::begin(), contained(), dot_down_link(), moab::Range::end(), moab::Core::get_entities_by_type(), moab::intersect(), mb, and MBENTITYSET.
Referenced by write_dot().
{ for( Range::iterator i = sets.begin(); i != sets.end(); ++i ) { Range contained; mb.get_entities_by_type( *i, MBENTITYSET, contained ); contained = intersect( contained, sets ); for( Range::iterator j = contained.begin(); j != contained.end(); ++j ) dot_down_link( s, *i, *j, dashed ); } }
static void dot_down_link | ( | std::ostream & | s, |
EntityHandle | parent, | ||
EntityHandle | child, | ||
bool | dashed, | ||
const char * | label = 0 |
||
) | [static] |
Definition at line 269 of file gsets.cpp.
References moab::Core::id_from_handle(), and mb.
Referenced by dot_children(), and dot_contained().
{ s << 's' << mb.id_from_handle( parent ) << " -> " << 's' << mb.id_from_handle( child ); if( dashed && label ) s << " [style = dashed label = \"" << label << "\"]"; else if( dashed ) s << " [style = dashed]"; else if( label ) s << " [label = \"" << label << "\"]"; s << ';' << std::endl; }
static void dot_get_sets | ( | Range & | curr_sets, |
Range & | result_sets, | ||
Tag | tag, | ||
void * | tag_val = 0 |
||
) | [static] |
Definition at line 191 of file gsets.cpp.
References moab::Range::clear(), moab::Core::get_entities_by_type_and_tag(), mb, MBENTITYSET, moab::Range::merge(), and moab::subtract().
Referenced by dot_nodes().
{ if( !tag ) return; result_sets.clear(); mb.get_entities_by_type_and_tag( 0, MBENTITYSET, &tag, &tag_val, 1, result_sets ); result_sets = subtract( result_sets, curr_sets ); curr_sets.merge( result_sets ); }
Definition at line 215 of file gsets.cpp.
References moab::Range::begin(), blockTag, dim, dot_get_sets(), dot_write_id_nodes(), dot_write_node(), moab::Range::end(), geomTag, moab::Core::get_entities_by_type(), moab::Core::id_from_handle(), idTag, mb, MB_SUCCESS, MBENTITYSET, NAME_TAG_SIZE, nameTag, nodeTag, printAnonSets, sideTag, moab::subtract(), moab::Range::swap(), and moab::Core::tag_get_data().
Referenced by write_dot().
{ Range vol_sets, surf_sets, curv_sets, vert_sets; Range block_sets, side_sets, node_sets; Range named_sets, other_sets; dot_get_sets( sets, named_sets, nameTag ); int dim = 3; dot_get_sets( sets, vol_sets, geomTag, &dim ); dim = 2; dot_get_sets( sets, surf_sets, geomTag, &dim ); dim = 1; dot_get_sets( sets, curv_sets, geomTag, &dim ); dim = 0; dot_get_sets( sets, vert_sets, geomTag, &dim ); dot_get_sets( sets, block_sets, blockTag ); dot_get_sets( sets, side_sets, sideTag ); dot_get_sets( sets, node_sets, nodeTag ); if( printAnonSets ) { mb.get_entities_by_type( 0, MBENTITYSET, other_sets ); Range xsect = subtract( other_sets, sets ); sets.swap( other_sets ); other_sets.swap( xsect ); } dot_write_id_nodes( s, vol_sets, idTag, "Volume" ); dot_write_id_nodes( s, surf_sets, idTag, "Surface" ); dot_write_id_nodes( s, curv_sets, idTag, "Curve" ); dot_write_id_nodes( s, vert_sets, idTag, "Vertex" ); dot_write_id_nodes( s, block_sets, blockTag, "Block" ); dot_write_id_nodes( s, side_sets, sideTag, "Neumann Set" ); dot_write_id_nodes( s, node_sets, nodeTag, "Dirichlet Set" ); Range::iterator i; char name[NAME_TAG_SIZE + 1]; for( i = named_sets.begin(); i != named_sets.end(); ++i ) { if( MB_SUCCESS == mb.tag_get_data( nameTag, &*i, 1, name ) ) { name[NAME_TAG_SIZE] = '\0'; dot_write_node( s, *i, name ); } } for( i = other_sets.begin(); i != other_sets.end(); ++i ) { int id = mb.id_from_handle( *i ); dot_write_node( s, *i, "EntitySet ", &id ); } }
static void dot_write_id_nodes | ( | std::ostream & | s, |
const Range & | entites, | ||
Tag | id_tag, | ||
const char * | type_name | ||
) | [static] |
Definition at line 208 of file gsets.cpp.
References moab::Range::begin(), dot_write_node(), moab::Range::end(), mb, MB_SUCCESS, and moab::Core::tag_get_data().
Referenced by dot_nodes().
{ int id; for( Range::iterator i = entites.begin(); i != entites.end(); ++i ) if( MB_SUCCESS == mb.tag_get_data( id_tag, &*i, 1, &id ) ) dot_write_node( s, *i, type_name, &id ); }
static void dot_write_node | ( | std::ostream & | s, |
EntityHandle | h, | ||
const char * | label, | ||
int * | id = 0 |
||
) | [static] |
Definition at line 201 of file gsets.cpp.
References moab::Core::id_from_handle(), and mb.
Referenced by dot_nodes(), and dot_write_id_nodes().
{ s << 's' << mb.id_from_handle( h ) << " [label = \"" << label; if( id ) s << ' ' << *id; s << "\"];" << std::endl; }
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 60 of file gsets.cpp.
References blockTag, children, contained(), DASHED, DIRICHLET_SET_TAG_NAME, GEOM_DIMENSION_TAG_NAME, geomTag, moab::Core::globalId_tag(), idTag, input_file, moab::Core::load_mesh(), MATERIAL_SET_TAG_NAME, mb, MB_SUCCESS, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, NAME_TAG_NAME, NAME_TAG_SIZE, nameTag, NEUMANN_SET_TAG_NAME, nodeTag, NONE, printAnonSets, printSVSense, sideTag, SOLID, t, moab::Core::tag_get_handle(), usage, and write_dot().
{ Link children = SOLID, contained = SOLID; bool printGeomSets = true; bool printMeshSets = true; bool printNamedSets = true; const char* input_file = 0; bool geom_flag = false, mesh_flag = false, name_flag = false, all_flag = false; bool no_more_flags = false; for( int i = 1; i < argc; ++i ) { if( no_more_flags || argv[i][0] != '-' ) { if( input_file ) usage( argv[0] ); input_file = argv[i]; continue; } for( int j = 1; argv[i][j]; ++j ) { switch( argv[i][j] ) { case 'a': all_flag = true; break; case 'g': geom_flag = true; break; case 'm': mesh_flag = true; break; case 'n': name_flag = true; break; case 's': printSVSense = true; break; case 'P': children = NONE; break; case 'p': children = DASHED; break; case 'C': contained = NONE; break; case 'c': contained = DASHED; break; case '-': no_more_flags = true; break; case 'h': usage( argv[0], false ); break; default: std::cerr << "Unknown flag: '" << argv[i][j] << "'" << std::endl; usage( argv[0] ); } } } if( !input_file ) { std::cerr << "No input file specified." << std::endl; usage( argv[0] ); } if( all_flag ) { printGeomSets = printMeshSets = printNamedSets = printAnonSets = true; } else if( geom_flag || mesh_flag || name_flag ) { printGeomSets = geom_flag; printMeshSets = mesh_flag; printNamedSets = name_flag; } if( MB_SUCCESS != mb.load_mesh( input_file ) ) { std::cerr << input_file << ": file read failed." << std::endl; return 1; } Tag t; if( printGeomSets ) { if( MB_SUCCESS == mb.tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, t ) ) { geomTag = t; } } if( printMeshSets ) { if( MB_SUCCESS == mb.tag_get_handle( MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, t ) ) { blockTag = t; } if( MB_SUCCESS == mb.tag_get_handle( DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, t ) ) { nodeTag = t; } if( MB_SUCCESS == mb.tag_get_handle( NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, t ) ) { sideTag = t; } } if( printNamedSets ) { if( MB_SUCCESS == mb.tag_get_handle( NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE, t ) ) { nameTag = t; } } idTag = mb.globalId_tag(); write_dot( contained, children ); return 0; }
static void usage | ( | const char * | name, |
bool | brief = true |
||
) | [static] |
Definition at line 22 of file gsets.cpp.
{ std::ostream& str = brief ? std::cerr : std::cout; if( !brief ) str << name << ": A tool to export entity set parent/child relations" << std::endl << " for use as input to graphviz" << std::endl; str << "Usage: " << name << " [-a | [-g] [-m] [-n] ] <input_file>" << std::endl << " " << name << " -h" << std::endl; if( brief ) exit( 1 ); str << " The default behavior is equivalent to \"-gmn\"." << std::endl << " If any of the following options are used to specify which " << std::endl << " sets to output, then there are no defaults. Only the " << std::endl << " indicated sets will be output." << std::endl << " -a : write all sets (default is only geom, mesh, and named)" << std::endl << " -g : write geometric topology sets" << std::endl << " -m : write material sets and boundary condition sets" << std::endl << " -n : write named sets" << std::endl << " -s : label surface-volume links with sense" << std::endl << " The default link behavior is to both child links" << std::endl << " and containment with solid lines." << std::endl << " -P : do not write child links" << std::endl << " -p : write child links with dashed lines" << std::endl << " -C : do not write containment links" << std::endl << " -c : write containment links with dashed lines" << std::endl; exit( 0 ); }
Definition at line 180 of file gsets.cpp.
References DASHED, dot_children(), dot_contained(), and dot_nodes().
Referenced by main().
{ Range sets; std::cout << "digraph {" << std::endl; dot_nodes( std::cout, sets ); std::cout << std::endl; if( contained ) dot_contained( std::cout, sets, contained == DASHED ); if( children ) dot_children( std::cout, sets, children == DASHED ); std::cout << "}" << std::endl; }
Definition at line 10 of file gsets.cpp.
Referenced by dot_nodes(), FBiGeom_getEntSets(), FBiGeom_getNumEntSets(), main(), and test_root_sets_resize().
Definition at line 15 of file gsets.cpp.
Referenced by add_dead_elems_to_impl_compl(), dot_nodes(), fix_surface_senses(), main(), and replace_faceted_cgm_surfs().
GeomTopoTool geomTool & mb |
Definition at line 19 of file gsets.cpp.
Referenced by build_mesh(), check_big_meshset(), check_bit_tag(), check_handle_tag(), check_handle_tag_type(), check_meshset_common(), check_node_coords(), check_order(), check_order_by_sets_and_adj(), check_quad_conn(), check_varlen_tag(), compute_area(), compute_normals(), moab::ParCommGraph::compute_partition(), create_elements_single(), create_input_file(), moab::NCHelperDomain::create_mesh(), moab::NCHelperScrip::create_mesh(), create_mesh(), create_missing_elements(), create_missing_vertices(), create_simple_mesh(), create_vertices_single(), cube_edge_adjacencies_test(), cube_tri_curve_coincidence_test(), cube_tri_vertex_test(), cube_tris_connectivity_test(), cube_verts_connectivity_test(), delete_elem(), delete_mesh(), delete_vert(), do_test(), do_test_mode(), dot_children(), dot_contained(), dot_down_link(), dot_get_sets(), dot_nodes(), dot_write_id_nodes(), dot_write_node(), forward_order_query_element_verts(), forward_order_query_elements(), forward_order_query_vertices(), gather_one_cell_var(), gather_related_test(), gather_set_stats(), gather_tag_counts(), init(), initialize_area_and_tracer(), leaf_iterator_test(), main(), mb_adjacent_vertex_test(), mb_memory_use_test(), memstr(), merge_all_test(), merge_with_tag_test(), mergesimple_test(), multiple_loads_of_same_file(), perf_inmesh(), prism_issue(), random_order_query_element_verts(), random_order_query_elements(), random_order_query_vertices(), read_cube_curves_test(), read_cube_surfs_test(), read_cube_tris_test(), read_cube_vertex_pos_test(), read_cube_verts_test(), read_cube_vols_test(), read_cylcube_curve_senses_test(), read_cylcube_groups_test(), read_cylcube_surf_senses_test(), read_map_from_disk(), read_mesh_parallel(), read_multiple_test(), read_one_cell_var(), moab::ParCommGraph::receive_mesh(), moab::ParCommGraph::receive_tag_values(), regression_insert_set_1(), regression_mmiller_8_2010(), reverse_order_query_element_verts(), reverse_order_query_elements(), reverse_order_query_vertices(), moab::ParCommGraph::send_tag_values(), split_quads_test(), split_test_across(), tag_time(), test_add_entities(), test_assign_global_ids(), test_bc_sets(), test_blocks(), test_bound_box(), test_bvh_tree(), test_clear(), test_clear_bit(), test_cone_curve_facet(), test_coords_connect_iterate(), test_correct_ghost(), test_create_tag(), test_create_variable_length_tag(), test_cube_curve_facet(), test_cubit12(), test_cubit14(), test_element(), test_entities(), test_entities_by_dimension(), test_entities_by_type(), test_eul_read_write_across_files(), test_eul_read_write_append(), test_eul_read_write_T(), test_eul_read_write_timestep(), test_fv_read_write_T(), test_gather_onevar(), test_gather_sets_common(), test_gather_sets_ranged(), test_gcrm_read_write_vars(), test_geometric_sets(), test_geometric_topology(), test_get_by_tag(), test_get_set(), test_get_set_bit(), test_ghosted_entity_shared_data(), test_global_opaque_common(), test_global_value_common(), test_ho_elements(), test_homme_read_write_T(), test_interface_owners_common(), test_intersect(), test_intx_in_parallel_elem_based(), test_iterates(), test_iterator_back(), test_iterators(), test_kd_tree(), test_leaf_merge(), test_linear_hex(), test_linear_quad(), test_linear_tet(), test_list_set_with_stale_handles(), test_mesh(), test_moab_v3_poly_format(), test_mpas_read_write_vars(), test_multiple_files(), test_normal_linear_hex(), test_normal_linear_quad(), test_normal_linear_tet(), test_normal_linear_tri(), test_pack_bit_tag_data(), test_pack_tag_data_default_value(), test_pack_tag_data_dense(), test_pack_tag_data_sparse(), test_pack_variable_length_tag(), test_point_search(), test_polygon_mix(), test_polyhedra(), test_quadratic_hex(), test_ranged_set_with_stale_handles(), test_read(), test_read_adjacencies(), test_read_all(), test_read_alternate_coord_format(), test_read_and_ghost_after(), test_read_containing_sets(), test_read_double_tag(), test_read_eul_all(), test_read_eul_nomesh(), test_read_eul_novars(), test_read_eul_onetimestep(), test_read_eul_onevar(), test_read_fv_all(), test_read_fv_nomesh(), test_read_fv_novars(), test_read_fv_onetimestep(), test_read_fv_onevar(), test_read_geom_set(), test_read_handle_tag_common(), test_read_ids_common(), test_read_material_on_nodes(), test_read_material_set(), test_read_no_edges(), test_read_nodes(), test_read_nodes_common(), test_read_nomesh(), test_read_nothing_common(), test_read_novars(), test_read_one_set_elems(), test_read_one_set_polyhedra(), test_read_onetimestep(), test_read_onevar(), test_read_opaque_tag(), test_read_parallel(), test_read_polygons(), test_read_polyhedra(), test_read_quads(), test_read_set_sets(), test_read_tagged_elems(), test_read_tagged_nodes(), test_read_two_sets_elems(), test_read_with_ghost(), test_read_with_ghost_no_augment(), test_read_with_thin_ghost_layer(), test_read_write(), test_reduce_tag_explicit_dest(), test_reduce_tag_failures(), test_reduce_tags(), test_remove_entities(), test_scd_invalid(), test_set_flags(), test_shared_sets(), test_spectral_hex(), test_spectral_quad(), test_subtract(), test_tree(), test_tree_delete(), test_tree_merge_nodes(), test_tree_readwrite(), test_unite(), test_unstructured_field(), test_var_length_parallel(), test_vertices(), test_wedges(), test_write(), test_write_polygons(), test_write_polyhedra(), test_write_read_many_tags(), TestErrorHandling_1(), TestErrorHandling_2(), TestErrorHandling_3(), TestErrorHandling_4(), TestErrorHandlingPar_1(), TestErrorHandlingPar_2(), umr_perf_test(), update_tracer(), update_tracer_test(), v_quad_aspect_ratio(), verdict_test1(), verify_split(), and volume_test().
Definition at line 14 of file gsets.cpp.
Referenced by dot_nodes(), main(), and smoab::Interface::name().
bool printAnonSets = false |
Definition at line 16 of file gsets.cpp.
Referenced by dot_nodes(), and main().
bool printSVSense = false |
Definition at line 17 of file gsets.cpp.
Referenced by dot_children(), and main().