[MOAB-dev] r3993 - MOAB/trunk/tools
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed Jun 2 15:14:05 CDT 2010
Author: kraftche
Date: 2010-06-02 15:14:05 -0500 (Wed, 02 Jun 2010)
New Revision: 3993
Modified:
MOAB/trunk/tools/surfplot.cpp
Log:
add option to plot entire mesh to mbsurfplot util
Modified: MOAB/trunk/tools/surfplot.cpp
===================================================================
--- MOAB/trunk/tools/surfplot.cpp 2010-06-02 20:00:30 UTC (rev 3992)
+++ MOAB/trunk/tools/surfplot.cpp 2010-06-02 20:14:05 UTC (rev 3993)
@@ -21,7 +21,7 @@
<< "\t-g - Write GNU Plot data file (default)." << std::endl
<< "\t-p - Write encapsulated postscript file" << std::endl
<< "\t-s - Write an SVG file" << std::endl
- << "\t<Surface_ID> - ID of surface containing mesh to export." << std::endl
+ << "\t<Surface_ID> - ID of surface containing mesh to export (0 for entire file)." << std::endl
<< "\t<input_file> - Mesh file to read." << std::endl
<< std::endl
<< " This utility plots the mesh of a single geometric surface "
@@ -199,7 +199,7 @@
usage_error(argv[0]);
char* endptr;
surface_id = strtol( argv[idx], &endptr, 0 );
- if (!endptr || *endptr || surface_id < 1)
+ if (!endptr || *endptr)
usage_error(argv[0]);
++idx;
@@ -214,32 +214,38 @@
}
// Get tag handles
- Tag tags[2];
- result = moab->tag_get_handle( GEOM_DIMENSION_TAG_NAME, tags[0] );
- if (MB_SUCCESS != result) {
- std::cerr << "No geometry tag.\n";
- return OTHER_ERROR;
+ EntityHandle surface;
+ const int dimension = 2; // surface
+ if (surface_id) {
+ Tag tags[2];
+ result = moab->tag_get_handle( GEOM_DIMENSION_TAG_NAME, tags[0] );
+ if (MB_SUCCESS != result) {
+ std::cerr << "No geometry tag.\n";
+ return OTHER_ERROR;
+ }
+ result = moab->tag_get_handle( GLOBAL_ID_TAG_NAME, tags[1] );
+ if (MB_SUCCESS != result) {
+ std::cerr << "No ID tag.\n";
+ return OTHER_ERROR;
+ }
+
+ // Find entityset for surface.
+ const void* tag_values[] = { &dimension, &surface_id };
+ Range surfaces;
+ moab->get_entities_by_type_and_tag( 0, MBENTITYSET,
+ tags, tag_values,
More information about the moab-dev
mailing list