[cig-commits] r13842 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Mon Jan 12 14:10:11 PST 2009


Author: luis
Date: 2009-01-12 14:10:11 -0800 (Mon, 12 Jan 2009)
New Revision: 13842

Modified:
   cs/cigma/trunk/src/io_file_reader.cpp
Log:
Create ExodusReader object in FileReader::New() factory method (for .exo files)

Modified: cs/cigma/trunk/src/io_file_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_file_reader.cpp	2009-01-12 22:10:10 UTC (rev 13841)
+++ cs/cigma/trunk/src/io_file_reader.cpp	2009-01-12 22:10:11 UTC (rev 13842)
@@ -2,6 +2,7 @@
 #include "io_null_reader.h"
 #include "io_text_reader.h"
 #include "io_hdf5_reader.h"
+#include "io_exo_reader.h"
 #include "io_vtk_reader.h"
 
 #include <string>
@@ -27,6 +28,7 @@
 
     if (fs::exists(p))
     {
+        // XXX: similarities are obvious, so combine these somehow
         if (is_hdf5_extension(ext.c_str()))
         {
             reader.reset(new HDF5_Reader());
@@ -38,6 +40,17 @@
                 throw cigma::Exception("FileReader::New", stream.str());
             }
         }
+        else if (is_exo_extension(ext.c_str()))
+        {
+            reader.reset(new ExodusReader());
+            int status = reader->open(filename.c_str(), mode.c_str());
+            if (status < 0)
+            {
+                std::ostringstream stream;
+                stream << "Could not open ExodusII mesh file '" << filename << "' for reading" << std::ends;
+                throw cigma::Exception("FileReader::New", stream.str());
+            }
+        }
         else if (is_vtk_extension(ext.c_str()))
         {
             reader.reset(new VtkReader());



More information about the CIG-COMMITS mailing list