[MOAB-dev] r4588 - MOAB/trunk/itaps/imesh

jvporter at wisc.edu jvporter at wisc.edu
Mon Mar 14 16:54:53 CDT 2011


Author: jvporter
Date: 2011-03-14 16:54:53 -0500 (Mon, 14 Mar 2011)
New Revision: 4588

Modified:
   MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
Log:
Make iMesh_(get|set)AdjTable mostly obey the spec (this is a hacky solution,
but the spec is in flux anyway).


Modified: MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2011-03-14 21:54:09 UTC (rev 4587)
+++ MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2011-03-14 21:54:53 UTC (rev 4588)
@@ -256,6 +256,17 @@
       tags[w++] = tags[r];
 }
 
+// modify the adjacency table to match the ITAPS spec's expectations
+static void munge_adj_table(int *adjTable, int geom_dim)
+{
+  if (geom_dim == 2) {
+    for (size_t i = 0; i < 16; ++i) {
+      if (i % 4 == 3 || i >= 12)
+        adjTable[i] = iBase_UNAVAILABLE;
+    }
+  }
+}
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -443,8 +454,12 @@
                           /*inout*/ int* adjacency_table_allocated, 
                           /*out*/ int* adjacency_table_size, int *err)
   {
+    int geom_dim;
+    iMesh_getGeometricDimension(instance, &geom_dim, err);
+
     ALLOC_CHECK_ARRAY_NOFAIL(adjacency_table, 16);
     memcpy(*adjacency_table, MBIMESHI->AdjTable, 16*sizeof(int));
+    munge_adj_table(*adjacency_table, geom_dim);
     RETURN(iBase_SUCCESS);
   }
 
@@ -457,7 +472,11 @@
       RETURN(iBase_INVALID_ARGUMENT);
     }
 
+    int geom_dim;
+    iMesh_getGeometricDimension(instance, &geom_dim, err);
+
     memcpy(MBIMESHI->AdjTable, adj_table, 16*sizeof(int));
+    munge_adj_table(adj_table, geom_dim);
     RETURN(iBase_SUCCESS);
   }
 






More information about the moab-dev mailing list