[MOAB-dev] r3249 - MOAB/trunk/tools

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Oct 28 16:26:25 CDT 2009


Author: kraftche
Date: 2009-10-28 16:26:24 -0500 (Wed, 28 Oct 2009)
New Revision: 3249

Modified:
   MOAB/trunk/tools/convert.cpp
Log:
add MPI_Init and MPI_Finalize calls

Modified: MOAB/trunk/tools/convert.cpp
===================================================================
--- MOAB/trunk/tools/convert.cpp	2009-10-28 21:26:01 UTC (rev 3248)
+++ MOAB/trunk/tools/convert.cpp	2009-10-28 21:26:24 UTC (rev 3249)
@@ -114,6 +114,9 @@
 void usage_error( const char* name )
 {
   print_usage( name, std::cerr );
+#ifdef USE_MPI
+  MPI_Finalize();
+#endif
   exit(USAGE_ERROR);
 } 
 
@@ -129,6 +132,11 @@
 
 int main(int argc, char* argv[])
 {
+#ifdef USE_MPI
+  MPI_Init(&argc,&argv);
+#endif
+
+
   MBInterface* gMB;
   MBErrorCode result;
   MBRange range;
@@ -253,10 +261,14 @@
     // construct options string from individual options
   std::string read_options, write_options;
   if (!make_opts_string(  read_opts,  read_options ) ||
-      !make_opts_string( write_opts, write_options ))
+      !make_opts_string( write_opts, write_options )) 
+  {
+#ifdef USE_MPI
+    MPI_Finalize();
+#endif
     return USAGE_ERROR;
+  }
   
-  
     // Read the input file.
   reset_times();
   MBEntityHandle read_meshset;
@@ -268,6 +280,9 @@
     std::string message;
     if (MB_SUCCESS == gMB->get_last_error(message) && !message.empty())
       std::cerr << "Error message: " << message << std::endl;
+#ifdef USE_MPI
+    MPI_Finalize();
+#endif
     return READ_ERROR;
   }
   std::cerr << "Read \"" << in << "\"" << std::endl;
@@ -470,6 +485,9 @@
   if (have_sets && set_list.empty())
   {
     std::cerr << "Nothing to write." << std::endl;
+#ifdef USE_MPI
+    MPI_Finalize();
+#endif
     return ENT_NOT_FOUND;
   }
   
@@ -495,6 +513,9 @@
     std::string message;
     if (MB_SUCCESS == gMB->get_last_error(message) && !message.empty())
       std::cerr << "Error message: " << message << std::endl;
+#ifdef USE_MPI
+    MPI_Finalize();
+#endif
     return WRITE_ERROR;
   }
   std::cerr << "Wrote \"" << out << "\"" << std::endl;



More information about the moab-dev mailing list