Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1505 - trunk/Model/Primitives


Chronological Thread 
  • From: thiago@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1505 - trunk/Model/Primitives
  • Date: Wed, 18 Jul 2007 20:58:48 -0600 (MDT)

Author: thiago
Date: Wed Jul 18 20:58:47 2007
New Revision: 1505

Modified:
   trunk/Model/Primitives/Heightfield.cc
Log:
replacing horrible exit() with beautiful throws. Haven't actually run this to 
see if it works, but it compiles...

Modified: trunk/Model/Primitives/Heightfield.cc
==============================================================================
--- trunk/Model/Primitives/Heightfield.cc       (original)
+++ trunk/Model/Primitives/Heightfield.cc       Wed Jul 18 20:58:47 2007
@@ -1,9 +1,11 @@
 
 #include <Model/Primitives/Heightfield.h>
 #include <Interface/RayPacket.h>
+#include <Core/Exceptions/InternalError.h>
 #include <Core/Geometry/BBox.h>
 #include <Core/Geometry/Vector.h>
 
+
 #include <limits>
 #include <sgi_stl_warnings_off.h>
 #include <fstream>
@@ -25,14 +27,14 @@
   cout << "\n\nbounds are: " << minBound << " " <<maxBound<<endl;
   ifstream in(filename.c_str());
   if(!in){
-    cerr << "Error opening " << filename << "\n";
-    exit(1);
+    throw SCIRun::InternalError("Error opening " + filename, 
+                                __FILE__, __LINE__); 
   }
   Real minz, maxz;
   in >> nx >> ny >> minz >> maxz;
   if(!in){
-    cerr << "Error reading header from " << filename << "\n";
-    exit(1);
+    throw SCIRun::InternalError("Error reading header from " + filename,
+                                __FILE__, __LINE__); 
   }
   in.get();
   data = new float*[nx+1];
@@ -41,8 +43,8 @@
     data[i] = p+i*(ny+1);
   in.read(reinterpret_cast<char*>(data[0]), sizeof(float)*(nx+1)*(ny+1));
   if(!in){
-    cerr << "Error reading data from " << filename << "\n";
-    exit(1);
+    throw SCIRun::InternalError("Error reading data from " + filename,
+                                __FILE__, __LINE__); 
   }
   Real dz = maxz-minz;
   if(dz < 1.e-3)




  • [MANTA] r1505 - trunk/Model/Primitives, thiago, 07/18/2007

Archive powered by MHonArc 2.6.16.

Top of page