[MOAB-dev] r4251 - MOAB/trunk/src/io

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Thu Nov 4 16:28:07 CDT 2010


Author: sjackson
Date: 2010-11-04 16:28:07 -0500 (Thu, 04 Nov 2010)
New Revision: 4251

Modified:
   MOAB/trunk/src/io/ReadCGM.cpp
Log:
Avoid printing too many curve/faceting mismatch warnings from ReadCGM.
Ten warnings are printed in this version; the old verbose behavior
can be had by passing VERBOSE_CGM_CURVE_WARNINGS as an file load option.

Modified: MOAB/trunk/src/io/ReadCGM.cpp
===================================================================
--- MOAB/trunk/src/io/ReadCGM.cpp	2010-11-04 01:19:00 UTC (rev 4250)
+++ MOAB/trunk/src/io/ReadCGM.cpp	2010-11-04 21:28:07 UTC (rev 4251)
@@ -144,6 +144,10 @@
   if (MB_SUCCESS != opts.get_real_option("MAX_FACET_EDGE_LENGTH", len_tol))
     len_tol = DEFAULT_LEN_TOL;
 
+  bool verbose_curve_warnings = false;
+  if (MB_SUCCESS == opts.get_null_option("VERBOSE_CGM_CURVE_WARNINGS"))
+    verbose_curve_warnings = true;
+
   const char* name = "CGM_ATTRIBS";
   const char* value = "no";
   rval = opts.match_option(name,value); 
@@ -441,6 +445,11 @@
     
     ci->second = vh;
   }
+
+  // maximum allowable curve-endpoint proximity warnings
+  // if this integer becomes negative, then abs(curve_warnings) is the 
+  // number of warnings that were suppressed.
+  int curve_warnings = 10;
   
     // create geometry for all curves
   GMem data;
@@ -489,7 +498,15 @@
       // check proximity of vertices to end coordinates
     if ((start_vtx->coordinates() - points.front()).length() > GEOMETRY_RESABS
      || (  end_vtx->coordinates() - points.back() ).length() > GEOMETRY_RESABS ) {
-      std::cerr << "Warning: vertices not at ends of curve " << edge->id() << std::endl;
+
+      curve_warnings--;
+      if( curve_warnings >= 0 || verbose_curve_warnings ){ 
+	std::cerr << "Warning: vertices not at ends of curve " << edge->id() << std::endl;
+	if( curve_warnings == 0 && !verbose_curve_warnings ){
+	  std::cerr << "         further instances of this warning will be suppressed..." << std::endl;
+	}
+      }
+
     }
     
       // create interior points
@@ -525,6 +542,12 @@
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
   }
+
+  if( !verbose_curve_warnings && curve_warnings < 0 ){
+    std::cerr << "Suppressed " << -curve_warnings 


More information about the moab-dev mailing list