[MOAB-dev] r3791 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Sun Apr 18 18:44:49 CDT 2010


Author: kraftche
Date: 2010-04-18 18:44:49 -0500 (Sun, 18 Apr 2010)
New Revision: 3791

Modified:
   MOAB/trunk/src/Core.cpp
Log:
Move check for whether or not a file exists to a later point in load_file,
so that for a parallel read modes where not all processors read the file, the
file is only checked for on the node(s) that are actually reading it.  


Modified: MOAB/trunk/src/Core.cpp
===================================================================
--- MOAB/trunk/src/Core.cpp	2010-04-18 13:59:39 UTC (rev 3790)
+++ MOAB/trunk/src/Core.cpp	2010-04-18 23:44:49 UTC (rev 3791)
@@ -368,28 +368,6 @@
                                const int* set_tag_vals,
                                int num_set_tag_vals )
 {
-  int status;
-#if defined(WIN32) || defined(WIN64) || defined(MSC_VER)
-  struct _stat stat_data;
-  status = _stat(file_name, &stat_data);
-#else
-  struct stat stat_data;
-  status = stat(file_name, &stat_data);
-#endif
-  if (status) {
-    mError->set_last_error( "%s: %s", file_name, strerror(errno) );
-    return MB_FILE_DOES_NOT_EXIST;
-  }
-#if defined(WIN32) || defined(WIN64) || defined(MSC_VER)
-  else if (_S_IFDIR(stat_data.st_mode)) {
-#else
-  else if (S_ISDIR(stat_data.st_mode)) {
-#endif
-    mError->set_last_error( "%s: Cannot read directory/folder.", file_name );
-    return MB_FILE_DOES_NOT_EXIST;
-  }
-
-
   FileOptions opts(options);
   ErrorCode rval;
   ReaderIface::IDTag t = { set_tag_name, set_tag_vals, num_set_tag_vals, 0, 0 };
@@ -468,6 +446,27 @@
                                       int num_sets,
                                       const Tag* id_tag  )
 {
+  int status;
+#if defined(WIN32) || defined(WIN64) || defined(MSC_VER)
+  struct _stat stat_data;
+  status = _stat(file_name, &stat_data);
+#else
+  struct stat stat_data;
+  status = stat(file_name, &stat_data);
+#endif
+  if (status) {
+    mError->set_last_error( "%s: %s", file_name, strerror(errno) );
+    return MB_FILE_DOES_NOT_EXIST;
+  }
+#if defined(WIN32) || defined(WIN64) || defined(MSC_VER)
+  else if (_S_IFDIR(stat_data.st_mode)) {


More information about the moab-dev mailing list