[cig-commits] r12952 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Wed Sep 24 04:10:41 PDT 2008
Author: luis
Date: 2008-09-24 04:10:41 -0700 (Wed, 24 Sep 2008)
New Revision: 12952
Added:
cs/cigma/trunk/src/Filesystem.cpp
cs/cigma/trunk/src/Filesystem.h
Log:
Filesystem-related functions
Mainly this is a compatibility header for using the cross-platform
boost::filesystem functions. Also, here we define the allowable
file extensions.
Added: cs/cigma/trunk/src/Filesystem.cpp
===================================================================
--- cs/cigma/trunk/src/Filesystem.cpp (rev 0)
+++ cs/cigma/trunk/src/Filesystem.cpp 2008-09-24 11:10:41 UTC (rev 12952)
@@ -0,0 +1,30 @@
+#include "Filesystem.h"
+
+using namespace std;
+
+// ----------------------------------------------------------------------------
+
+bool is_hdf5_extension(const char *ext)
+{
+ assert(ext != 0);
+ string fileExt = ext;
+ return (fileExt == ".h5") || (fileExt == ".hdf5");
+}
+
+bool is_vtk_extension(const char *ext)
+{
+ assert(ext != 0);
+ string fileExt = ext;
+ return (fileExt == ".vtk") // legacy format
+ || (fileExt == ".vtu") || (fileExt == ".vts") || (fileExt == ".vtr") // XML formats
+ || (fileExt == ".pvtu") || (fileExt == ".pvts") || (fileExt == ".pvtr"); // Parallel XML formats
+}
+
+bool is_text_extension(const char *ext)
+{
+ assert(ext != 0);
+ string fileExt = ext;
+ return (fileExt == ".txt") || (fileExt == ".dat") || (fileExt == ".out");
+}
+
+// ----------------------------------------------------------------------------
Added: cs/cigma/trunk/src/Filesystem.h
===================================================================
--- cs/cigma/trunk/src/Filesystem.h (rev 0)
+++ cs/cigma/trunk/src/Filesystem.h 2008-09-24 11:10:41 UTC (rev 12952)
@@ -0,0 +1,28 @@
+#ifndef __CIGMA_FILESYSTEM_H__
+#define __CIGMA_FILESYSTEM_H__
+
+/*
+ * Compatibility header file, so we can have access to the
+ * boost::filesystem namespace for Boost versions 1.33, 1.34,
+ * and above.
+ */
+
+#include <boost/version.hpp>
+#if BOOST_VERSION >= 103400
+# include <boost/filesystem.hpp>
+#else
+# include <boost/filesystem/convenience.hpp>
+#endif
+
+
+/*
+ * Miscellaneous path utilities.
+ *
+ */
+
+bool is_hdf5_extension(const char *ext);
+bool is_vtk_extension(const char *ext);
+bool is_text_extension(const char *ext);
+
+
+#endif
More information about the cig-commits
mailing list