[MOAB-dev] Creation of parallel tags

Jed Brown jed at 59A2.org
Fri Feb 27 16:31:54 CST 2009


I had a look through iMeshP_unit_tests.cpp and got it compiling again.
There seems to be enough usage there for me to just use iMeshP.
Attached are some patches I have floating, including the latest which
updates iMeshP_unit_tests.cpp for iMesh-0.8.

Jed
-------------- next part --------------
From e671f9869bbba52633ff52646c11473246bc0e8f Mon Sep 17 00:00:00 2001
From: Jed Brown <jed at 59A2.org>
Date: Wed, 5 Nov 2008 19:58:19 +0100
Subject: [PATCH 1/4] C-style comments in C headers

---
 mhdf/include/mhdf.h    |    2 +-
 mhdf/src/file-handle.h |    2 +-
 mhdf/src/util.h        |    2 +-
 tools/iMesh/iMesh.h    |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mhdf/include/mhdf.h b/mhdf/include/mhdf.h
index 88ec18a..a91c0c1 100644
--- a/mhdf/include/mhdf.h
+++ b/mhdf/include/mhdf.h
@@ -2250,7 +2250,7 @@ mhdf_readSparseTagIndicesWithOpt( hid_t tag_handle,
 
 
 #ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
 #endif
 
 #endif
diff --git a/mhdf/src/file-handle.h b/mhdf/src/file-handle.h
index 8f928d3..3f15f2b 100644
--- a/mhdf/src/file-handle.h
+++ b/mhdf/src/file-handle.h
@@ -39,7 +39,7 @@ FileHandle* mhdf_alloc_FileHandle( hid_t hdf_handle, mhdf_Status* status );
 int mhdf_check_valid_file( FileHandle* handle, mhdf_Status* status );
 
 #ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
 #endif
 
 #endif
diff --git a/mhdf/src/util.h b/mhdf/src/util.h
index b069fa0..93361c3 100644
--- a/mhdf/src/util.h
+++ b/mhdf/src/util.h
@@ -155,7 +155,7 @@ int mhdf_write_max_id( FileHandle* file_ptr, mhdf_Status* status );
 
 
 #ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
 #endif
 
 #endif
diff --git a/tools/iMesh/iMesh.h b/tools/iMesh/iMesh.h
index 894dff4..d2bd996 100644
--- a/tools/iMesh/iMesh.h
+++ b/tools/iMesh/iMesh.h
@@ -2019,7 +2019,7 @@ extern "C" {
                    /*out*/ int *err);
 
 #ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
 #endif
 
 #endif /* ifndef IMESH_CBIND_H__ */
-- 
1.6.1.3

-------------- next part --------------
From 65a40895f930fb9a3d95becf795e3631d689c84c Mon Sep 17 00:00:00 2001
From: Jed Brown <jed at 59A2.org>
Date: Mon, 22 Sep 2008 19:38:44 +0200
Subject: [PATCH 2/4] Fix possible indexing one beyond the end of the array.

Default storage order is INTERLEAVED.
---
 tools/iMesh/iMesh_MOAB.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
 mode change 100755 => 100644 tools/iMesh/testc_cbind.c

diff --git a/tools/iMesh/iMesh_MOAB.cpp b/tools/iMesh/iMesh_MOAB.cpp
index 293a10a..05e6a3f 100644
--- a/tools/iMesh/iMesh_MOAB.cpp
+++ b/tools/iMesh/iMesh_MOAB.cpp
@@ -194,8 +194,6 @@ iMesh_EntityIterator create_itaps_iterator( MBRange& range, int array_size )
   return reinterpret_cast<iMesh_EntityIterator>(iter);
 }
 
-
-
 #define iMesh_processError(a, b) {sprintf(iMesh_LAST_ERROR.description, "%s", b); iMesh_LAST_ERROR.error_type = a; *err = a;}
 
 #ifdef __cplusplus
@@ -223,7 +221,7 @@ extern "C" {
   void iMesh_getDescription(iMesh_Instance instance, 
                             char *descr, int *err, int descr_len)
   {
-    unsigned int len = MIN(strlen(iMesh_LAST_ERROR.description), ((unsigned int) descr_len));
+    unsigned int len = MIN(strlen(iMesh_LAST_ERROR.description), ((unsigned int) descr_len-1));
     strncpy(descr, iMesh_LAST_ERROR.description, len);
     descr[len] = '\0';
     RETURN(iBase_SUCCESS);
@@ -385,7 +383,7 @@ extern "C" {
   void iMesh_getDfltStorage(iMesh_Instance instance,
                             int *order, int *err)
   {
-    *order = iBase_BLOCKED;
+    *order = iBase_INTERLEAVED;
     RETURN(iBase_SUCCESS);
   }
   
@@ -3336,3 +3334,4 @@ void cfptr2_(void *instance)
 {
   std::cout << "Instance ptr = " << (size_t) instance << std::endl;
 }
+
diff --git a/tools/iMesh/testc_cbind.c b/tools/iMesh/testc_cbind.c
old mode 100755
new mode 100644
-- 
1.6.1.3

-------------- next part --------------
From 16d8b3691798a138720ae94e29bc2023657fa18d Mon Sep 17 00:00:00 2001
From: Jed Brown <jed at 59A2.org>
Date: Fri, 13 Feb 2009 15:40:15 +0100
Subject: [PATCH 3/4] Call MPI_Init if using MPI.

---
 tools/convert.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/convert.cpp b/tools/convert.cpp
index aac1c6d..3ba82ed 100644
--- a/tools/convert.cpp
+++ b/tools/convert.cpp
@@ -158,6 +158,11 @@ int main(int argc, char* argv[])
   bool print_times = false;
   bool generate[] = { false, false, false };
   bool pval;
+
+#ifdef USE_MPI
+  MPI_Init(&argc,&argv);
+#endif
+
   for (i = 1; i < argc; i++)
   {
     if (!argv[i][0])
-- 
1.6.1.3

-------------- next part --------------
From 8b164955b9647baf0c9cc92694e91b0e94095c8c Mon Sep 17 00:00:00 2001
From: Jed Brown <jed at 59A2.org>
Date: Fri, 27 Feb 2009 23:15:33 +0100
Subject: [PATCH 4/4] Type-correctness in iMeshP_unit_tests.cpp

---
 tools/iMesh/iMeshP_unit_tests.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/iMesh/iMeshP_unit_tests.cpp b/tools/iMesh/iMeshP_unit_tests.cpp
index 81be079..178d8c1 100644
--- a/tools/iMesh/iMeshP_unit_tests.cpp
+++ b/tools/iMesh/iMeshP_unit_tests.cpp
@@ -305,7 +305,7 @@ static int get_entities( iMesh_Instance imesh,
                          iMesh_EntityTopology topo,
                          std::vector<iBase_EntityHandle>& entities )
 {
-  iBase_EntitySetHandle* array = 0;
+  iBase_EntityHandle* array = 0;
   int junk = 0, size = 0, err;
   iMesh_getEntities( imesh, set, type, topo, &array, &junk, &size, &err );
   if (!err) {
@@ -625,7 +625,7 @@ int create_mesh( const char* filename, int num_parts )
                                    elements[2*(i/2)  ][2*(i%2)+1],
                                    elements[2*(i/2)+1][2*(i%2)+1] };
     iBase_EntitySetHandle set = part;
-    iMesh_addEntArrToSet( imesh, quads, 4, &set, &ierr ); CHKERR;
+    iMesh_addEntArrToSet( imesh, quads, 4, set, &ierr ); CHKERR;
     assert(set == part);
   }
   
@@ -810,7 +810,7 @@ static int test_get_by_type_topo_all( iMesh_Instance imesh,
   iBase_EntitySetHandle set;
   iMesh_createEntSet( imesh, 1, &set, &ierr );
   CHKERR;
-  iMesh_addEntArrToSet( imesh, &half_quads[0], half_quads.size(), &set, &ierr );
+  iMesh_addEntArrToSet( imesh, &half_quads[0], half_quads.size(), set, &ierr );
   CHKERR;
   
     // test getNumOf*All with defined set
@@ -895,7 +895,7 @@ static int test_get_by_type_topo_local( iMesh_Instance imesh,
   iBase_EntitySetHandle set;
   iMesh_createEntSet( imesh, 1, &set, &ierr );
   CHKERR;
-  iMesh_addEntArrToSet( imesh, &half_quads[0], half_quads.size(), &set, &ierr );
+  iMesh_addEntArrToSet( imesh, &half_quads[0], half_quads.size(), set, &ierr );
   CHKERR;
   
     // check if there exists any quads not in the part that we 
@@ -907,7 +907,7 @@ static int test_get_by_type_topo_local( iMesh_Instance imesh,
   std::set_difference( all_quads.begin(), all_quads.end(),
                        part_quads.begin(), part_quads.end(),
                        std::back_inserter( other_quads ) );
-  iMesh_addEntArrToSet( imesh, &other_quads[0], other_quads.size(), &set, &ierr );
+  iMesh_addEntArrToSet( imesh, &other_quads[0], other_quads.size(), set, &ierr );
   CHKERR;
   
     // compare local counts (using non-root set)
@@ -2567,7 +2567,7 @@ int test_push_tag_data_common( iMesh_Instance imesh,
   iMesh_createTag( imesh, dst_name, 1, iBase_INTEGER, &dst_tag, &ierr, strlen(dst_name) );
   CHKERR;
   
-  iBase_EntityHandle root;
+  iBase_EntitySetHandle root;
   iMesh_getRootSet( imesh, &root, &ierr ); CHKERR;
   
   std::vector<iBase_EntityHandle> verts;
-- 
1.6.1.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20090227/543220e2/attachment.pgp>


More information about the moab-dev mailing list