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

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Jun 21 10:55:58 CDT 2010


Author: kraftche
Date: 2010-06-21 10:55:57 -0500 (Mon, 21 Jun 2010)
New Revision: 4013

Modified:
   MOAB/trunk/tools/convert.cpp
   MOAB/trunk/tools/mbconvert.man
Log:
make mbconvert accept multiple input files, where all input meshes are written to a single combined output file

Modified: MOAB/trunk/tools/convert.cpp
===================================================================
--- MOAB/trunk/tools/convert.cpp	2010-06-19 05:55:10 UTC (rev 4012)
+++ MOAB/trunk/tools/convert.cpp	2010-06-21 15:55:57 UTC (rev 4013)
@@ -28,6 +28,7 @@
 #include <sstream>
 #include <iomanip>
 #include <set>
+#include <list>
 #include <cstdlib>
 #include <algorithm>
 #ifndef WIN32
@@ -57,7 +58,7 @@
 void print_usage( const char* name, std::ostream& stream )
 {
   stream << "Usage: " << name << 
-    " [-a <sat_file>|-A] [-t] [subset options] [-f format] <input_file> <output_file>" << std::endl
+    " [-a <sat_file>|-A] [-t] [subset options] [-f format] <input_file> [<input_file2> ...] <output_file>" << std::endl
     << "\t-f <format>    - Specify output file format" << std::endl
     << "\t-a <acis_file> - ACIS SAT file dumped by .cub reader (same as \"-o SAT_FILE=acis_file\"" << std::endl
     << "\t-A             - .cub file reader should not dump a SAT file (depricated default)" << std::endl
@@ -153,9 +154,10 @@
   bool append_rank = false;
   bool percent_rank_subst = false;      
   int i, dim;
+  std::list< std::string >::iterator j;
   bool dims[4] = {false, false, false, false};
   const char* format = NULL; // output file format
-  std::string in;    // input file name
+  std::list< std::string > in; // input file name list
   std::string out;   // output file name
   bool verbose = false;
   std::set<int> geom[4], mesh[3];       // user-specified IDs 
@@ -243,19 +245,17 @@
       }
     }
       // do file names
-    else if (in.empty())
-      in = argv[i];
-    else if (out.empty())
-      out = argv[i];
-    else  { // too many file names
-      std::cerr << "Unexpexed argument: " << argv[i] << std::endl;
-      usage_error(argv[0]);
+    else {
+      in.push_back( argv[i] );
     }
   }
-  if (in.empty() || out.empty()) {
+  if (in.size() < 2) {
     std::cerr << "No output file name specified." << std::endl;


More information about the moab-dev mailing list