[MOAB-dev] r2783 - in MOAB/trunk: . parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Mar 30 18:39:05 CDT 2009


Author: kraftche
Date: 2009-03-30 18:39:05 -0500 (Mon, 30 Mar 2009)
New Revision: 2783

Modified:
   MOAB/trunk/MBCore.cpp
   MOAB/trunk/MBCore.hpp
   MOAB/trunk/MBReaderIface.hpp
   MOAB/trunk/ReadCGM.cpp
   MOAB/trunk/ReadCGM.hpp
   MOAB/trunk/ReadGmsh.cpp
   MOAB/trunk/ReadGmsh.hpp
   MOAB/trunk/ReadHDF5.cpp
   MOAB/trunk/ReadHDF5.hpp
   MOAB/trunk/ReadIDEAS.cpp
   MOAB/trunk/ReadIDEAS.hpp
   MOAB/trunk/ReadNCDF.cpp
   MOAB/trunk/ReadNCDF.hpp
   MOAB/trunk/ReadSTL.cpp
   MOAB/trunk/ReadSTL.hpp
   MOAB/trunk/ReadSms.cpp
   MOAB/trunk/ReadSms.hpp
   MOAB/trunk/ReadTetGen.cpp
   MOAB/trunk/ReadTetGen.hpp
   MOAB/trunk/ReadVtk.cpp
   MOAB/trunk/ReadVtk.hpp
   MOAB/trunk/Tqdcfr.cpp
   MOAB/trunk/Tqdcfr.hpp
   MOAB/trunk/cub_file_test.cc
   MOAB/trunk/exodus_test.cc
   MOAB/trunk/parallel/ReadParallel.cpp
   MOAB/trunk/parallel/ReadParallel.hpp
   MOAB/trunk/parallel/mbparallelcomm_test.cpp
Log:
o Consolidate code duplication between ReadParallel and MBCore

o Rather than block ID list, pass input {tag_name, tag_value_list}
  to readers.

o Make all readers (except Exodus) return MB_UNSUPPORTED_OPERATION if any 
  input tag_name for subset is specfied.  Previously most readers ignored 
  the input block ID list and read the entire file.

o Make ExodusII reader fail if specified subset tag is anything other
  than MATERAIAL_SET_TAG_ID.


Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/MBCore.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -364,25 +364,9 @@
                                const int* set_tag_values,
                                int num_set_tag_values )
 {
-  if (num_set_tag_values < 0)
-    return MB_INDEX_OUT_OF_RANGE;
-   
   FileOptions opts(options);
-  file_set = 0;
-  
   MBErrorCode rval;
-  const MBReaderWriterSet* set = reader_writer_set();
   
-    // convert from to old block-based reader interface
-  const int* block_id_list = 0;
-  int num_blocks = 0;
-  if (set_tag_name) {
-    if (strcmp(set_tag_name, MATERIAL_SET_TAG_NAME ))
-      return MB_NOT_IMPLEMENTED;
-    block_id_list = set_tag_values;
-    num_blocks = num_set_tag_values;
-  }
-  
     // if reading in parallel, call a different reader
   std::string parallel_opt;
   rval = opts.get_option( "PARALLEL", parallel_opt);
@@ -399,19 +383,42 @@
     else if (rval != MB_ENTITY_NOT_FOUND) 
       return rval;
     return ReadParallel(this,pcomm).load_file(file_name, file_set, opts,
-                                        block_id_list, num_blocks);
+                                        set_tag_name, set_tag_values, 
+                                        num_set_tag_values);
 #else
     mError->set_last_error( "PARALLEL option not valid, this instance"
                             " compiled for serial execution.\n" );
     return MB_NOT_IMPLEMENTED;
 #endif
   }
+  else {
+    return serial_load_file( file_name, file_set,
+                             opts, set_tag_name,
+                             set_tag_values, num_set_tag_values );
+  }
+}
 
+MBErrorCode MBCore::serial_load_file( const char* file_name,
+                                      MBEntityHandle& file_set,
+                                      const FileOptions& opts,
+                                      const char* set_tag_name,
+                                      const int* set_tag_values,
+                                      int num_set_tag_values )
+{
+  if (num_set_tag_values < 0)
+    return MB_INDEX_OUT_OF_RANGE;
+   
+  file_set = 0;
+  
+  MBErrorCode rval;
+  const MBReaderWriterSet* set = reader_writer_set();
+
     // otherwise try using the file extension to select a reader
   MBReaderIface* reader = set->get_file_extension_reader( file_name );
   if (reader)
   { 
-    rval = reader->load_file( file_name, file_set, opts, block_id_list, num_blocks );
+    rval = reader->load_file( file_name, file_set, opts, set_tag_name, 
+                              set_tag_values, num_set_tag_values );
     delete reader;
   }
   else
@@ -423,7 +430,8 @@
       MBReaderIface* reader = iter->make_reader( this );
       if (NULL != reader)
       {
-        rval = reader->load_file( file_name, file_set, opts, block_id_list, num_blocks );
+        rval = reader->load_file( file_name, file_set, opts, set_tag_name,
+                                  set_tag_values, num_set_tag_values );
         delete reader;
         if (MB_SUCCESS == rval)
           break;

Modified: MOAB/trunk/MBCore.hpp
===================================================================
--- MOAB/trunk/MBCore.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/MBCore.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -26,6 +26,7 @@
 class TagServer;
 class MBError;
 class MBReaderWriterSet;
+class FileOptions;
 
 #ifdef XPCOM_MB
 
@@ -97,6 +98,14 @@
                                  const char* set_tag_name = 0,
                                  const int* set_tag_values = 0,
                                  int num_set_tag_values = 0 );
+
+  /**Load or import a file. */
+  virtual MBErrorCode serial_load_file( const char* file_name,
+                                 MBEntityHandle& file_set,
+                                 const FileOptions& opts,
+                                 const char* set_tag_name = 0,
+                                 const int* set_tag_values = 0,
+                                 int num_set_tag_values = 0 );
   
   virtual MBErrorCode write_mesh(const char *file_name,
                                   const MBEntityHandle *output_list = NULL,

Modified: MOAB/trunk/MBReaderIface.hpp
===================================================================
--- MOAB/trunk/MBReaderIface.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/MBReaderIface.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -49,8 +49,9 @@
     virtual MBErrorCode load_file( const char* file_name,
                                    MBEntityHandle& file_set,
                                    const FileOptions& opts,
-                                   const int* material_set_list,
-                                   int material_set_list_len ) = 0;
+                                   const char* set_tag_name = 0,
+                                   const int* set_tag_values = 0,
+                                   int num_set_tag_values = 0 ) = 0;
 
 };
 

Modified: MOAB/trunk/ReadCGM.cpp
===================================================================
--- MOAB/trunk/ReadCGM.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadCGM.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -98,13 +98,18 @@
 MBErrorCode ReadCGM::load_file(const char *cgm_file_name,
                       MBEntityHandle& file_set,
                       const FileOptions& opts,
-                      const int* blocks_to_load,
-                      const int num_blocks)
+                      const char* name,
+                      const int*, const int)
 {
   // blocks_to_load and num_blocks are ignored.
   MBErrorCode rval;
   file_set = 0;
 
+  if (name) {
+    readUtilIface->report_error( "Reading subset of files not supported for CGM data." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   std::string filename( cgm_file_name );
   cgmFile = filename;
 

Modified: MOAB/trunk/ReadCGM.hpp
===================================================================
--- MOAB/trunk/ReadCGM.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadCGM.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -53,8 +53,9 @@
   MBErrorCode load_file(const char *cgm_file_name,
                          MBEntityHandle& file_set,
                          const FileOptions& opts,
-                         const int* blocks_to_load,
-                         const int num_blocks);
+                         const char* set_tag_name,
+                         const int* set_tag_values,
+                         int num_set_tag_values );
 
    //! Constructor
    ReadCGM(MBInterface* impl = NULL);

Modified: MOAB/trunk/ReadGmsh.cpp
===================================================================
--- MOAB/trunk/ReadGmsh.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadGmsh.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -83,9 +83,14 @@
 MBErrorCode ReadGmsh::load_file( const char* filename, 
                                  MBEntityHandle& file_set,
                                  const FileOptions& ,
-                                 const int* blocks,
-                                 const int num_blocks )
+                                 const char* set_tag_name,
+                                 const int* blocks, const int num_blocks )
 {
+  if (!strcmp( set_tag_name, MATERIAL_SET_TAG_NAME )) {
+    readMeshIface->report_error( "GMsh supports subset read only by material ID." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   mCurrentMeshHandle = 0;
   const MBErrorCode result = load_file_impl( filename, blocks, num_blocks );
   

Modified: MOAB/trunk/ReadGmsh.hpp
===================================================================
--- MOAB/trunk/ReadGmsh.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadGmsh.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -41,8 +41,9 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions& opts,
-                        const int* material_set_list,
-                        int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
     //! Constructor
   ReadGmsh(MBInterface* impl = NULL);

Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadHDF5.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -122,13 +122,18 @@
 MBErrorCode ReadHDF5::load_file( const char* filename, 
                                  MBEntityHandle& file_set, 
                                  const FileOptions& opts,
-                                 const int* p, 
-                                 const int num_blocks )
+                                 const char* name,
+                                 const int*, const int )
 {
   MBErrorCode rval;
   mhdf_Status status;
   ioProp = H5P_DEFAULT;
 
+  if (name) {
+    readUtil->report_error( "Reading subset of files not supported for HDF5." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   if (MB_SUCCESS != init())
     return MB_FAILURE;
 
@@ -188,7 +193,7 @@
   }
     
   
-  rval = load_file_impl( file_set, p, num_blocks, use_mpio );
+  rval = load_file_impl( file_set, use_mpio );
   mhdf_closeFile( filePtr, &status );
   filePtr = 0;
   if (ioProp != H5P_DEFAULT)
@@ -221,8 +226,6 @@
 
 MBErrorCode ReadHDF5::load_file_impl( 
                                  MBEntityHandle file_set, 
-                                 const int*, 
-                                 const int num_blocks,
                                  bool use_mpio )
 {
   MBErrorCode rval;
@@ -235,9 +238,6 @@
   unsigned int i, num_groups;
   bool have_nodes = true;
 
-  if (num_blocks)
-    return MB_FAILURE;
-
 DEBUGOUT("Reading Nodes.\n");
   
   rval = read_nodes();

Modified: MOAB/trunk/ReadHDF5.hpp
===================================================================
--- MOAB/trunk/ReadHDF5.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadHDF5.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -49,13 +49,12 @@
   MBErrorCode load_file( const char* filename,
                          MBEntityHandle& file_set,
                          const FileOptions& opts,
-                         const int* material_set_list,
-                         int material_set_count  );
+                         const char* set_tag_name,
+                         const int* set_tag_values,
+                         int num_set_tag_values );
 protected:
 
   MBErrorCode load_file_impl( MBEntityHandle file_set, 
-                              const int*, 
-                              const int num_blocks,
                               bool use_mpio );
 
 private:

Modified: MOAB/trunk/ReadIDEAS.cpp
===================================================================
--- MOAB/trunk/ReadIDEAS.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadIDEAS.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -23,9 +23,14 @@
 MBErrorCode ReadIDEAS::load_file(const char* fname, 
                                  MBEntityHandle& meshset, 
                                  const FileOptions& options,
-                                 const int* material_set_list,
-                                 int num_material_sets ) {
+                                 const char* name,
+                                 const int*, const int ) {
 
+  if (name) {
+    readMeshIface->report_error( "Reading subset of files not supported for IDEAS." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   file.open( fname );
 
   MBErrorCode rval;

Modified: MOAB/trunk/ReadIDEAS.hpp
===================================================================
--- MOAB/trunk/ReadIDEAS.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadIDEAS.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -23,8 +23,9 @@
   MBErrorCode load_file(const char* fname, 
 			MBEntityHandle& meshset, 
 			const FileOptions&,
-			const int* material_set_list,
-			int num_material_sets );
+			const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
   //! Constructor
   ReadIDEAS(MBInterface* impl = NULL);

Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadNCDF.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -432,10 +432,17 @@
 MBErrorCode ReadNCDF::load_file(const char *exodus_file_name,
                                 MBEntityHandle& file_set,
                                 const FileOptions& opts,
+                                const char* set_tag_name,
                                 const int *blocks_to_load,
                                 const int num_blocks)
 {
   MBErrorCode status;
+
+  if (!strcmp( set_tag_name, MATERIAL_SET_TAG_NAME )) {
+    readMeshIface->report_error( "Exodus reader supports subset read only by block ID." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   
   file_set = 0;
     // this function directs the reading of an exoii file, but doesn't do any of

Modified: MOAB/trunk/ReadNCDF.hpp
===================================================================
--- MOAB/trunk/ReadNCDF.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadNCDF.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -72,6 +72,7 @@
   MBErrorCode load_file(const char *exodus_file_name,
                          MBEntityHandle& file_set,
                          const FileOptions& opts,
+                         const char* set_tag_name,
                          const int* blocks_to_load,
                          const int num_blocks);
   

Modified: MOAB/trunk/ReadSTL.cpp
===================================================================
--- MOAB/trunk/ReadSTL.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadSTL.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -77,12 +77,17 @@
 MBErrorCode ReadSTL::load_file( const char* filename,
                                 MBEntityHandle& file_set, 
                                 const FileOptions& opts,
-                                const int* blocks, 
-                                const int num_blocks )
+                                const char* name,
+                                const int*, const int )
 {
   mCurrentMeshHandle = 0;
-  const MBErrorCode result = load_file_impl( filename, opts, blocks, num_blocks );
+  const MBErrorCode result = load_file_impl( filename, opts );
   
+  if (name) {
+    readMeshIface->report_error( "Reading subset of files not supported for STL." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+  
     // If file read has failed, destroy anything that was
     // created during the read.
   if (MB_SUCCESS != result && mCurrentMeshHandle)
@@ -102,8 +107,7 @@
 // pure-virtual function implemented in subclasses to read
 // the data from the file.
 MBErrorCode ReadSTL::load_file_impl(const char *filename,
-                                    const FileOptions& opts,
-                                    const int*, const int) 
+                                    const FileOptions& opts ) 
 {
   MBErrorCode result;
 

Modified: MOAB/trunk/ReadSTL.hpp
===================================================================
--- MOAB/trunk/ReadSTL.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadSTL.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -74,8 +74,9 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions& opts,
-                        const int* material_set_list,
-                        int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
     //! Constructor
   ReadSTL(MBInterface* impl = NULL);
@@ -116,10 +117,7 @@
 
     //! Generic file loading code for both binary and ASCII readers.
     //! Calls reader-specific *_read_triangles function to do actual I/O.
-  MBErrorCode load_file_impl(const char *file_name,
-                             const FileOptions& opts,
-                             const int* material_set_list,
-                             const int num_material_sets );
+  MBErrorCode load_file_impl(const char *file_name, const FileOptions& opts );
 
     //! Meshset Handle for the mesh that is currently being read
   MBEntityHandle mCurrentMeshHandle;

Modified: MOAB/trunk/ReadSms.cpp
===================================================================
--- MOAB/trunk/ReadSms.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadSms.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -61,13 +61,18 @@
 }
 
 MBErrorCode ReadSms::load_file( const char* filename, 
-                                 MBEntityHandle& file_set,
-                                 const FileOptions& ,
-                                 const int* blocks,
-                                 const int num_blocks )
+                                MBEntityHandle& file_set,
+                                const FileOptions& ,
+                                const char* name,
+                                const int*, const int )
 {
+  if (name) {
+    readMeshIface->report_error( "Reading subset of files not supported for Sms." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+
   mCurrentMeshHandle = 0;
-  const MBErrorCode result = load_file_impl( filename, blocks, num_blocks );
+  const MBErrorCode result = load_file_impl( filename );
   
     // If file read has failed, destroy anything that was
     // created during the read.
@@ -84,9 +89,7 @@
   return result;
 }
 
-MBErrorCode ReadSms::load_file_impl( const char* filename, 
-                                     const int* material_set_list,
-                                     const int num_material_sets )
+MBErrorCode ReadSms::load_file_impl( const char* filename )
 {
   bool warned = false;
   

Modified: MOAB/trunk/ReadSms.hpp
===================================================================
--- MOAB/trunk/ReadSms.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadSms.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -20,8 +20,9 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions& opts,
-                        const int* material_set_list,
-                        int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
     //! Constructor
   ReadSms(MBInterface* impl = NULL);
@@ -31,9 +32,7 @@
 
 private:
 
-  MBErrorCode load_file_impl( const char *file_name,
-                              const int* material_set_list,
-                              const int num_material_sets);
+  MBErrorCode load_file_impl( const char *file_name );
   
   MBErrorCode get_set(std::vector<MBEntityHandle> *sets,
                       int set_type, int set_id,

Modified: MOAB/trunk/ReadTetGen.cpp
===================================================================
--- MOAB/trunk/ReadTetGen.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadTetGen.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -64,11 +64,17 @@
 MBErrorCode ReadTetGen::load_file( const char* file_name_c,
                                    MBEntityHandle& file_set,
                                    const FileOptions& opts,
-                                   const int*, int )
+                                   const char* name,
+                                   const int*, const int )
 {
   std::ifstream node_file, ele_file, face_file, edge_file;
   MBErrorCode rval;
   
+  if (name) {
+    readTool->report_error( "Reading subset of files not supported for TetGen." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
+  
   std::string suffix, base, filename(file_name_c);
   size_t dot_idx = filename.find_last_of( '.' );
   if (dot_idx == std::string::npos) {

Modified: MOAB/trunk/ReadTetGen.hpp
===================================================================
--- MOAB/trunk/ReadTetGen.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadTetGen.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -39,8 +39,9 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions&,
-                        const int* material_set_list,
-                        int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
     //! Constructor
   ReadTetGen(MBInterface* impl = NULL);

Modified: MOAB/trunk/ReadVtk.cpp
===================================================================
--- MOAB/trunk/ReadVtk.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadVtk.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -173,6 +173,7 @@
 MBErrorCode ReadVtk::load_file(const char *filename,
                                MBEntityHandle& file_set,
                                const FileOptions& opts,
+                               const char* name,
                                const int*, const int) 
 {
   MBErrorCode result;
@@ -182,6 +183,11 @@
   char vendor_string[257];
   std::vector<MBRange> element_list;
   MBRange vertices;
+  
+  if (name) {
+    readMeshIface->report_error( "Reading subset of files not supported for VTK." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
 
   // Does the caller want a field to be used for partitioning the entities?
   // If not, we'll assume any scalar integer field named MATERIAL_SET specifies partitions.

Modified: MOAB/trunk/ReadVtk.hpp
===================================================================
--- MOAB/trunk/ReadVtk.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/ReadVtk.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -35,8 +35,9 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions&,
-                        const int* material_set_list,
-                        int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        int num_set_tag_values );
   
     //! Constructor
   ReadVtk(MBInterface* impl = NULL);

Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/Tqdcfr.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -193,10 +193,16 @@
 MBErrorCode Tqdcfr::load_file(const char *file_name,
                               MBEntityHandle& file_set,
                               const FileOptions& opts,
+                              const char* block_tag_name,
                               const int*, const int) 
 {
   MBErrorCode result;
   file_set = mFileSet = 0;
+
+  if (block_tag_name) {
+    readUtilIface->report_error( "Reading subset of files not supported for CUB files." );
+    return MB_UNSUPPORTED_OPERATION;
+  }
   
     // open file
   cubFile = fopen(file_name, "rb");
@@ -2577,7 +2583,7 @@
   MBEntityHandle file_set;
   FileOptions opts(NULL);
   
-  MBErrorCode result = my_tqd->load_file(file, file_set, opts, 0, 0);
+  MBErrorCode result = my_tqd->load_file(file, file_set, opts, 0, 0, 0);
 
   if (MB_SUCCESS == result)
     std::cout << "Success." << std::endl;
@@ -2596,7 +2602,7 @@
   my_impl = new MBCore;
   my_tqd = new Tqdcfr(my_impl);
   
-  result = my_tqd->load_file(file, file_set, opts, 0, 0);
+  result = my_tqd->load_file(file, file_set, opts, 0, 0, 0);
 
   if (MB_SUCCESS == result)
     std::cout << "Success." << std::endl;

Modified: MOAB/trunk/Tqdcfr.hpp
===================================================================
--- MOAB/trunk/Tqdcfr.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/Tqdcfr.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -295,6 +295,7 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions& opts,
+                        const char* block_tag_name,
                         const int* block_list,
                         int num_blocks );
   MBErrorCode read_nodeset(ModelEntry *model,

Modified: MOAB/trunk/cub_file_test.cc
===================================================================
--- MOAB/trunk/cub_file_test.cc	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/cub_file_test.cc	2009-03-30 23:39:05 UTC (rev 2783)
@@ -181,7 +181,7 @@
   MBEntityHandle set;
   Tqdcfr reader( &moab );
   FileOptions opts("");
-  rval = reader.load_file( input_file, set, opts, 0, 0 );
+  rval = reader.load_file( input_file, set, opts, 0, 0, 0 );
   if (file_set)
     *file_set = set;
   CHECK_ERR(rval);

Modified: MOAB/trunk/exodus_test.cc
===================================================================
--- MOAB/trunk/exodus_test.cc	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/exodus_test.cc	2009-03-30 23:39:05 UTC (rev 2783)
@@ -78,7 +78,7 @@
   MBEntityHandle set;
   ReadNCDF reader( &moab );
   FileOptions opts("");
-  rval = reader.load_file( input_file, set, opts, 0, 0 );
+  rval = reader.load_file( input_file, set, opts, 0, 0, 0 );
   CHECK_ERR(rval);
 }
 
@@ -103,7 +103,7 @@
     remove(tmp_file);
   CHECK_ERR(rval);
   
-  rval = reader.load_file( tmp_file, set, opts, 0, 0 );
+  rval = reader.load_file( tmp_file, set, opts, 0, 0, 0 );
   remove( tmp_file );
   CHECK_ERR(rval);
 }

Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/parallel/ReadParallel.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -52,8 +52,9 @@
                                     const int num_files,
                                     MBEntityHandle& file_set,
                                     const FileOptions &opts,
-                                    const int* material_set_list,
-                                    const int num_material_sets ) 
+                                    const char* set_tag_name,
+                                    const int* set_tag_values,
+                                    const int num_tag_values ) 
 {
   MBError *merror = ((MBCore*)mbImpl)->get_error_handler();
 
@@ -185,8 +186,9 @@
   
   return load_file(file_names, num_files, file_set, parallel_mode, 
                    partition_tag_name,
-                   partition_tag_vals, distrib, pa_vec, material_set_list,
-                   num_material_sets, opts, reader_rank, cputime, 
+                   partition_tag_vals, distrib, pa_vec, opts,
+                   set_tag_name, set_tag_values, num_tag_values,
+                   reader_rank, cputime, 
                    resolve_dim, shared_dim,
                    ghost_dim, bridge_dim, num_layers);
 }
@@ -199,9 +201,10 @@
                                     std::vector<int> &partition_tag_vals, 
                                     bool distrib,
                                     std::vector<int> &pa_vec,
-                                    const int* material_set_list,
-                                    const int num_material_sets,
                                     const FileOptions &opts,
+                                    const char* set_tag_name,
+                                    const int* set_tag_values,
+                                    const int num_tag_values,
                                     const int reader_rank,
                                     const bool cputime,
                                     const int resolve_dim,
@@ -217,7 +220,6 @@
   MBRange entities; 
   MBTag file_set_tag = 0;
   int other_sets = 0;
-  MBReaderIface* reader;
   MBReaderWriterSet::iterator iter;
   MBRange other_file_sets, file_sets;
   MBCore *impl = dynamic_cast<MBCore*>(mbImpl);
@@ -248,33 +250,12 @@
               std::cout << "Reading file " << file_names[j] << std::endl;
 
             MBEntityHandle new_file_set = 0;
-          
-            reader = impl->reader_writer_set()->
-                get_file_extension_reader( file_names[j] );
-            if (reader)
-            { 
-              tmp_result = reader->load_file( file_names[j], new_file_set, opts, 
-                                              material_set_list, num_material_sets );
-              delete reader;
-            }
-            else
-            {  
-                // Try all the readers
-              for (iter = impl->reader_writer_set()->begin(); 
-                   iter != impl->reader_writer_set()->end(); ++iter)
-              {
-                reader = iter->make_reader( mbImpl );
-                if (NULL != reader)
-                {
-                  tmp_result = reader->load_file( file_names[j], new_file_set, opts, 
-                                                  material_set_list, num_material_sets );
-                  delete reader;
-                  if (MB_SUCCESS == tmp_result)
-                    break;
-                }
-              }
-            }
-
+            tmp_result = impl->serial_load_file( file_names[j], 
+                                                 new_file_set, 
+                                                 opts,
+                                                 set_tag_name,
+                                                 set_tag_values,
+                                                 num_tag_values );
             if (MB_SUCCESS != tmp_result) break;
 
               // put the contents of each file set for the reader into the 

Modified: MOAB/trunk/parallel/ReadParallel.hpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.hpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/parallel/ReadParallel.hpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -20,16 +20,18 @@
   MBErrorCode load_file(const char *file_name,
                         MBEntityHandle& file_set,
                         const FileOptions &opts,
-                        const int* material_set_list,
-                        const int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        const int num_tag_values );
   
     //! load multiple files
   MBErrorCode load_file(const char **file_names,
                         const int num_files,
                         MBEntityHandle& file_set,
                         const FileOptions &opts,
-                        const int* material_set_list,
-                        const int num_material_sets );
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        const int num_tag_values );
   
     //! Constructor
   ReadParallel(MBInterface* impl = NULL, MBParallelComm *pc = NULL);
@@ -54,9 +56,10 @@
                         std::vector<int> &partition_tag_vals, 
                         bool distrib,
                         std::vector<int> &pa_vec,
-                        const int* material_set_list,
-                        const int num_material_sets,
                         const FileOptions &opts,
+                        const char* set_tag_name,
+                        const int* set_tag_values,
+                        const int num_tag_values,
                         const int reader_rank,
                         const bool cputime,
                         const int resolve_dim,
@@ -81,11 +84,12 @@
 inline MBErrorCode ReadParallel::load_file(const char *file_name,
                                            MBEntityHandle& file_set,
                                            const FileOptions &opts,
-                                           const int* material_set_list,
-                                           const int num_material_sets ) 
+                                           const char* set_tag_name,
+                                           const int* set_tag_values,
+                                           const int num_tag_values )
 {
   return load_file(&file_name, 1, file_set, opts, 
-                   material_set_list, num_material_sets);
+                   set_tag_name, set_tag_values, num_tag_values);
 }
   
 #endif

Modified: MOAB/trunk/parallel/mbparallelcomm_test.cpp
===================================================================
--- MOAB/trunk/parallel/mbparallelcomm_test.cpp	2009-03-30 23:35:24 UTC (rev 2782)
+++ MOAB/trunk/parallel/mbparallelcomm_test.cpp	2009-03-30 23:39:05 UTC (rev 2783)
@@ -339,7 +339,7 @@
       rps[i] = new ReadParallel(mbImpl, pcs[i]);
     
       result = rps[i]->load_file(filenames[i].c_str(), filesets[i], 
-                                 FileOptions(options.str().c_str()), NULL, 0);
+                                 FileOptions(options.str().c_str()), 0, 0, 0);
       if (MB_SUCCESS != result) 
         PRINT_LAST_ERROR;
 



More information about the moab-dev mailing list