[MOAB-dev] r4266 - MOAB/trunk/itaps/imesh
jvporter at wisc.edu
jvporter at wisc.edu
Mon Nov 15 13:48:46 CST 2010
Author: jvporter
Date: 2010-11-15 13:48:45 -0600 (Mon, 15 Nov 2010)
New Revision: 4266
Modified:
MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
Log:
Use new iMesh options format for iMesh_newMesh/iMesh_load/iMesh_save
Modified: MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp 2010-11-15 18:32:39 UTC (rev 4265)
+++ MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp 2010-11-15 19:48:45 UTC (rev 4266)
@@ -15,6 +15,7 @@
#include <iostream>
#include <cassert>
+#include <cctype>
#include <cstring>
#include <stdarg.h>
#include <stdio.h>
@@ -171,6 +172,37 @@
return reinterpret_cast<iMesh_EntityIterator>(iter);
}
+static int compare_no_case(const char *str1, const char *str2, size_t n) {
+ for (size_t i = 1; i != n && *str1 && toupper(*str1) == toupper(*str2);
+ ++i, ++str1, ++str2);
+ return toupper(*str2) - toupper(*str1);
+}
+
+// Filter out non-MOAB options and remove the "moab:" prefix
+static std::string filter_options(const char *begin, const char *end)
+{
+ const char *opt_begin = begin;
+ const char *opt_end = begin;
+
+ std::string filtered;
+ bool first = true;
+
+ while (opt_end != end) {
+ opt_end = std::find(opt_begin, end, ' ');
+
+ if (opt_end-opt_begin >= 5 && compare_no_case(opt_begin, "moab:", 5) == 0) {
+ if (!first)
+ filtered.push_back(';');
+ first = false;
+ filtered.append(opt_begin+5, opt_end);
+ }
+
+ opt_begin = opt_end+1;
+ }
+ return filtered;
+}
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -222,9 +254,8 @@
More information about the moab-dev
mailing list