[MOAB-dev] r5513 - MOAB/trunk/src/parallel

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue May 8 20:29:16 CDT 2012


Author: tautges
Date: 2012-05-08 20:29:15 -0500 (Tue, 08 May 2012)
New Revision: 5513

Modified:
   MOAB/trunk/src/parallel/ParallelComm.cpp
Log:
Check constraints on source tag input to tag_reduce (needs to have default
value, needs to be of data type int, dbl, or bit), before skipping other
checks if 2nd (destination) tag handle is not specified.  Fixes (sort of,
by giving error for both cases) problem reported by Lorenzo Botti last week.

Passes parallel make check.



Modified: MOAB/trunk/src/parallel/ParallelComm.cpp
===================================================================
--- MOAB/trunk/src/parallel/ParallelComm.cpp	2012-04-29 23:34:51 UTC (rev 5512)
+++ MOAB/trunk/src/parallel/ParallelComm.cpp	2012-05-09 01:29:15 UTC (rev 5513)
@@ -7047,33 +7047,37 @@
     DataType tags_type, tagd_type;
     std::vector<unsigned char> vals;
     for (vits = src_tags.begin(), vitd = dst_tags.begin(); vits != src_tags.end(); vits++, vitd++) {
+        // checks on tag characteristics
+      result = mbImpl->tag_get_data_type(*vits, tags_type);
+      RRA("Coudln't get src tag data type.");
+      if (tags_type != MB_TYPE_INTEGER && tags_type != MB_TYPE_DOUBLE &&
+          tags_type != MB_TYPE_BIT) {
+        result = MB_FAILURE;
+        RRA("Src/dst tags must have integer, double, or bit data type.");
+      }
+
+      result = mbImpl->tag_get_bytes(*vits, tags_size);
+      RRA("Coudln't get src tag bytes.");
+      vals.resize(tags_size);
+      result = mbImpl->tag_get_default_value(*vits, &vals[0]);
+      RRA("Src tag must have default value.");
+
+        // ok, those passed; now check whether dest tags, if specified, agree with src tags
       if (*vits == *vitd) continue;
       
-      result = mbImpl->tag_get_bytes(*vits, tags_size);
-      RRA("Coudln't get src tag bytes.");
       result = mbImpl->tag_get_bytes(*vitd, tagd_size);
       RRA("Coudln't get dst tag bytes.");
       if (tags_size != tagd_size) {
         result = MB_FAILURE;
         RRA("Sizes between src and dst tags don't match.");
       }
-      result = mbImpl->tag_get_data_type(*vits, tags_type);
-      RRA("Coudln't get src tag data type.");
       result = mbImpl->tag_get_data_type(*vitd, tagd_type);
       RRA("Coudln't get dst tag data type.");
       if (tags_type != tagd_type) {
         result = MB_FAILURE;
         RRA("Src and dst tags must be of same data type.");
       }
-      else if (tags_type != MB_TYPE_INTEGER && tags_type != MB_TYPE_DOUBLE &&
-               tags_type != MB_TYPE_BIT) {
-        result = MB_FAILURE;
-        RRA("Src and dst tags must have integer, double, or bit data type.");
-      }
 
-      vals.resize(tags_size);
-      result = mbImpl->tag_get_default_value(*vits, &vals[0]);
-      RRA("Src tag must have default value.");


More information about the moab-dev mailing list