[MOAB-dev] r2253 - in MOAB/trunk: parallel tools/iMesh
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Nov 14 15:38:13 CST 2008
Author: kraftche
Date: 2008-11-14 15:38:13 -0600 (Fri, 14 Nov 2008)
New Revision: 2253
Modified:
MOAB/trunk/parallel/MBParallelComm.cpp
MOAB/trunk/parallel/MBParallelComm.hpp
MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp
Log:
o Fix incorrect buffer size in MBParallelComm::exchange_tasg
o Split pack_tags into two functions, one of which has two sub-functions
o Allow source and destination tags to be different for exchange_tags
o Use new source != destination exchange_tags in iMeshP implementation
Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp 2008-11-14 21:20:33 UTC (rev 2252)
+++ MOAB/trunk/parallel/MBParallelComm.cpp 2008-11-14 21:38:13 UTC (rev 2253)
@@ -79,6 +79,8 @@
#define PACK_VOID(buff, val, num) {memcpy(buff, val, num); buff += num; PC(num, " void");}
+#define PACK_BYTES(buff, val, num) PACK_INT(buff, num) PACK_VOID(buff, val, num)
+
#define PACK_RANGE(buff, rng) {int num_subs = num_subranges(rng); PACK_INTS(buff, &num_subs, 1); PC(num_subs, "-subranged range"); \
for (MBRange::const_pair_iterator cit = rng.const_pair_begin(); cit != rng.const_pair_end(); cit++) { \
MBEntityHandle eh = (*cit).first; PACK_EH(buff, &eh, 1); \
@@ -704,6 +706,8 @@
// tags
if (tags) {
+ result = get_tag_send_list( final_ents, all_tags, tag_ranges );
+ RRA("Failed to get tagged entities.")
result = pack_tags(orig_ents, rit, final_ents, buff_ptr,
buff_size, true, store_remote_handles, to_proc,
all_tags, tag_ranges);
@@ -2036,90 +2040,29 @@
MBErrorCode MBParallelComm::pack_tags(MBRange &entities,
MBRange::const_iterator &start_rit,
- MBRange &whole_range,
+ const MBRange &whole_range,
unsigned char *&buff_ptr,
int &count,
const bool just_count,
const bool store_remote_handles,
const int to_proc,
- std::vector<MBTag> &all_tags,
- std::vector<MBRange> &tag_ranges,
- const bool all_possible_tags)
+ const std::vector<MBTag> &all_tags,
+ const std::vector<MBRange> &tag_ranges)
{
- // tags
// get all the tags
- // for dense tags, compute size assuming all entities have that tag
- // for sparse tags, get number of entities w/ that tag to compute size
- unsigned char *orig_buff_ptr = buff_ptr;
MBErrorCode result;
- std::vector<int> var_len_sizes;
- std::vector<const void*> var_len_values;
+ std::vector<MBTag>::const_iterator tag_it;
+ std::vector<MBRange>::const_iterator rit;
if (just_count) {
-
- if (all_possible_tags) {
- std::vector<MBTag> tmp_tags;
- result = tagServer->get_tags(tmp_tags);
- RRA("Failed to get tags in pack_tags.");
-
- for (std::vector<MBTag>::iterator tag_it = tmp_tags.begin(); tag_it != tmp_tags.end(); tag_it++) {
- std::string tag_name;
- result = mbImpl->tag_get_name(*tag_it, tag_name);
- if (tag_name.c_str()[0] == '_' && tag_name.c_str()[1] == '_')
- continue;
-
- MBRange tmp_range;
- result = tagServer->get_entities(*tag_it, tmp_range);
- RRA("Failed to get entities for tag in pack_tags.");
- tmp_range = tmp_range.intersect(whole_range);
-
- if (tmp_range.empty()) continue;
-
- // ok, we'll be sending this tag
- all_tags.push_back(*tag_it);
- tag_ranges.push_back(tmp_range);
- }
- }
-
- std::vector<MBTag>::iterator tag_it;
- std::vector<MBRange>::iterator rit;
for (tag_it = all_tags.begin(), rit = tag_ranges.begin();
tag_it != all_tags.end(); tag_it++, rit++) {
- const TagInfo *tinfo = tagServer->get_tag_info(*tag_it);
- // default value
- count += sizeof(int);
- if (NULL != tinfo->default_value())
- count += tinfo->default_value_size();
-
- // size, type, data type
- count += 3*sizeof(int);
-
- // name
- count += sizeof(int);
- count += tinfo->get_name().size();
-
- // range of tag
- count += sizeof(int) + rit->size() * sizeof(MBEntityHandle);
-
- if (tinfo->get_size() == MB_VARIABLE_LENGTH) {
- const int num_ent = rit->size();
- // send a tag size for each entity
- count += num_ent * sizeof(int);
- // send tag data for each entity
- var_len_sizes.resize( num_ent );
- var_len_values.resize( num_ent );
- result = tagServer->get_data( *tag_it, *rit, &var_len_values[0],
- &var_len_sizes[0] );
- RRA("Failed to get lenghts of variable-length tag values.");
- count += std::accumulate( var_len_sizes.begin(), var_len_sizes.end(), 0 );
- }
- else {
- // tag data values for range or vector
- count += rit->size() * tinfo->get_size();
- }
+ result = packed_tag_size( *tag_it, *rit, count );
+ if (MB_SUCCESS != result)
+ return result;
}
// number of tags
@@ -2127,81 +2070,208 @@
}
else {
- std::vector<MBRange>::const_iterator tr_it = tag_ranges.begin();
PACK_INT(buff_ptr, all_tags.size());
+ count += sizeof(int);
- for (std::vector<MBTag>::const_iterator tag_it = all_tags.begin(); tag_it != all_tags.end(); tag_it++) {
+ for (tag_it = all_tags.begin(), rit = tag_ranges.begin();
+ tag_it != all_tags.end(); tag_it++, rit++) {
+
+
+ result = pack_tag( *tag_it, *tag_it, *rit, whole_range, buff_ptr,
+ count, store_remote_handles, to_proc );
+ if (MB_SUCCESS != result)
+ return result;
+ }
+ }
+
+ if (debug_packing) std::cerr << std::endl << "Done packing tags." << std::endl;
- const TagInfo *tinfo = tagServer->get_tag_info(*tag_it);
+ return MB_SUCCESS;
+}
+
- // size, type, data type
- PACK_INT(buff_ptr, tinfo->get_size());
- MBTagType this_type;
- result = mbImpl->tag_get_type(*tag_it, this_type);
- PACK_INT(buff_ptr, this_type);
- PACK_INT(buff_ptr, tinfo->get_data_type());
-
- // default value
- if (NULL == tinfo->default_value()) {
- PACK_INT(buff_ptr, 0);
- }
- else {
- PACK_INT(buff_ptr, tinfo->default_value_size());
- PACK_VOID(buff_ptr, tinfo->default_value(), tinfo->default_value_size());
- }
-
- // name
- PACK_INT(buff_ptr, tinfo->get_name().size() );
- PACK_VOID(buff_ptr, tinfo->get_name().c_str(), tinfo->get_name().size());
-
+MBErrorCode MBParallelComm::packed_tag_size( MBTag tag,
+ const MBRange &tagged_entities,
+ int &count )
+{
+ // for dense tags, compute size assuming all entities have that tag
+ // for sparse tags, get number of entities w/ that tag to compute size
+
+ std::vector<int> var_len_sizes;
+ std::vector<const void*> var_len_values;
+
+ const TagInfo *tinfo = tagServer->get_tag_info(tag);
+ // default value
+ count += sizeof(int);
+ if (NULL != tinfo->default_value())
+ count += tinfo->default_value_size();
+
+ // size, type, data type
+ count += 3*sizeof(int);
+
+ // name
+ count += sizeof(int);
+ count += tinfo->get_name().size();
+
+ // range of tag
+ count += sizeof(int) + tagged_entities.size() * sizeof(MBEntityHandle);
+
+ if (tinfo->get_size() == MB_VARIABLE_LENGTH) {
+ const int num_ent = tagged_entities.size();
+ // send a tag size for each entity
+ count += num_ent * sizeof(int);
+ // send tag data for each entity
+ var_len_sizes.resize( num_ent );
+ var_len_values.resize( num_ent );
+ MBErrorCode result = tagServer->get_data( tag,
+ tagged_entities,
+ &var_len_values[0],
+ &var_len_sizes[0] );
+ RRA("Failed to get lenghts of variable-length tag values.");
+ count += std::accumulate( var_len_sizes.begin(), var_len_sizes.end(), 0 );
+ }
+ else {
+ // tag data values for range or vector
+ count += tagged_entities.size() * tinfo->get_size();
+ }
+
+ return MB_SUCCESS;
+}
+
+
+MBErrorCode MBParallelComm::pack_tag( MBTag src_tag,
+ MBTag dst_tag,
+ const MBRange &tagged_entites,
+ const MBRange &whole_range,
+ unsigned char *&buff_ptr,
+ int &count,
+ const bool store_remote_handles,
+ const int to_proc )
+{
+ unsigned char *orig_buff_ptr = buff_ptr;
+ MBErrorCode result;
+ std::vector<int> var_len_sizes;
+ std::vector<const void*> var_len_values;
+
+ const TagInfo* tinfo = tagServer->get_tag_info(src_tag);
+ if (!tinfo)
+ return MB_TAG_NOT_FOUND;
+
+ const TagInfo* dst_tinfo;
+ if (src_tag == dst_tag) {
+ dst_tinfo = tinfo;
+ }
+ else {
+ dst_tinfo = tagServer->get_tag_info(dst_tag);
+ if (!dst_tinfo)
+ return MB_TAG_NOT_FOUND;
+ if (dst_tinfo->get_size() != tinfo->get_size())
+ return MB_TYPE_OUT_OF_RANGE;
+ if (dst_tinfo->get_data_type() != tinfo->get_data_type() &&
+ dst_tinfo->get_data_type() != MB_TYPE_OPAQUE &&
+ tinfo->get_data_type() != MB_TYPE_OPAQUE)
+ return MB_TYPE_OUT_OF_RANGE;
+ }
+
+
+
+ // size, type, data type
+ PACK_INT(buff_ptr, tinfo->get_size());
+ MBTagType this_type;
+ result = mbImpl->tag_get_type(dst_tag, this_type);
+ PACK_INT(buff_ptr, (int)this_type);
+ PACK_INT(buff_ptr, (int)(tinfo->get_data_type()));
+
+ // default value
+ if (NULL == tinfo->default_value()) {
+ PACK_INT(buff_ptr, 0);
+ }
+ else {
+ PACK_BYTES(buff_ptr, tinfo->default_value(), tinfo->default_value_size());
+ }
+
+ // name
+ PACK_BYTES(buff_ptr, dst_tinfo->get_name().c_str(), dst_tinfo->get_name().size());
+
#ifdef DEBUG_PACKING
- std::cerr << "Packing tag " << tinfo->get_name() << std::endl;
+std::cerr << "Packing tag \"" << tinfo->get_name() << "\"";
+if (tinfo != dst_tinfo)
+ std::cerr << " (as tag \"" << dst_tinfo->get_name() << "\")";
+std::cerr << std::endl;
#endif
- // pack entities
- PACK_INT(buff_ptr, (*tr_it).size());
- result = get_remote_handles(store_remote_handles,
- (*tr_it), (MBEntityHandle*)buff_ptr, to_proc,
- whole_range);
+ // pack entities
+ PACK_INT(buff_ptr, tagged_entites.size());
+ result = get_remote_handles(store_remote_handles,
+ tagged_entites, (MBEntityHandle*)buff_ptr, to_proc,
+ whole_range);
#ifdef DEBUG_PACKING
- if (MB_SUCCESS != result) {
- std::cerr << "Trouble getting remote handles for tagged entities:" << std::endl;
- (*tr_it).print(" ");
- }
+ if (MB_SUCCESS != result) {
+ std::cerr << "Trouble getting remote handles for tagged entities:" << std::endl;
+ tagged_entites.print(" ");
+ }
#else
- RRA("Trouble getting remote handles for tagged entities.");
+ RRA("Trouble getting remote handles for tagged entities.");
#endif
- buff_ptr += (*tr_it).size() * sizeof(MBEntityHandle);
+ buff_ptr += tagged_entites.size() * sizeof(MBEntityHandle);
- const size_t num_ent = tr_it->size();
- if (tinfo->get_size() == MB_VARIABLE_LENGTH) {
- var_len_sizes.resize( num_ent, 0 );
- var_len_values.resize( num_ent, 0 );
- result = mbImpl->tag_get_data(*tag_it, *tr_it, &var_len_values[0],
- &var_len_sizes[0] );
- RRA("Failed to get variable-length tag data in pack_tags.");
- PACK_INTS(buff_ptr, &var_len_sizes[0], num_ent);
- for (unsigned int i = 0; i < num_ent; ++i)
- PACK_VOID(buff_ptr, var_len_values[i], var_len_sizes[i]);
- }
- else {
- result = mbImpl->tag_get_data(*tag_it, *tr_it, buff_ptr);
- RRA("Failed to get tag data in pack_tags.");
- buff_ptr += num_ent * tinfo->get_size();
- PC(num_ent*tinfo->get_size(), " void");
- }
- tr_it++;
- }
+ const size_t num_ent = tagged_entites.size();
+ if (tinfo->get_size() == MB_VARIABLE_LENGTH) {
+ var_len_sizes.resize( num_ent, 0 );
+ var_len_values.resize( num_ent, 0 );
+ result = mbImpl->tag_get_data(src_tag, tagged_entites, &var_len_values[0],
+ &var_len_sizes[0] );
+ RRA("Failed to get variable-length tag data in pack_tags.");
+ PACK_INTS(buff_ptr, &var_len_sizes[0], num_ent);
+ for (unsigned int i = 0; i < num_ent; ++i)
+ PACK_VOID(buff_ptr, var_len_values[i], var_len_sizes[i]);
+ }
+ else {
+ result = mbImpl->tag_get_data(src_tag, tagged_entites, buff_ptr);
+ RRA("Failed to get tag data in pack_tags.");
+ buff_ptr += num_ent * tinfo->get_size();
+ PC(num_ent*tinfo->get_size(), " void");
+ }
- count += buff_ptr - orig_buff_ptr;
+ count += buff_ptr - orig_buff_ptr;
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode MBParallelComm::get_tag_send_list( const MBRange& whole_range,
+ std::vector<MBTag>& all_tags,
+ std::vector<MBRange>& tag_ranges )
+{
+ std::vector<MBTag> tmp_tags;
+ MBErrorCode result = tagServer->get_tags(tmp_tags);
+ RRA("Failed to get tags in pack_tags.");
+
+ std::vector<MBTag>::iterator tag_it;
+ for (tag_it = tmp_tags.begin(); tag_it != tmp_tags.end(); tag_it++) {
+ std::string tag_name;
+ result = mbImpl->tag_get_name(*tag_it, tag_name);
+ if (tag_name.c_str()[0] == '_' && tag_name.c_str()[1] == '_')
+ continue;
+
+ MBRange tmp_range;
+ result = tagServer->get_entities(*tag_it, tmp_range);
+ RRA("Failed to get entities for tag in pack_tags.");
+ tmp_range = tmp_range.intersect(whole_range);
+
+ if (tmp_range.empty()) continue;
+
+ // ok, we'll be sending this tag
+ all_tags.push_back( *tag_it );
+ tag_ranges.push_back( MBRange() );
+ tag_ranges.back().swap( tmp_range );
}
- if (debug_packing) std::cerr << std::endl << "Done packing tags." << std::endl;
-
return MB_SUCCESS;
}
+
+
MBErrorCode MBParallelComm::unpack_tags(unsigned char *&buff_ptr,
MBRange &entities,
const bool store_remote_handles,
@@ -3459,13 +3529,14 @@
MBRange::iterator rit = tag_ents.begin();
result = pack_tags(tag_ents, rit, tag_ents,
buff_ptr, buff_size, true, true, *sit,
- tags, tag_ranges, false);
+ tags, tag_ranges);
RRA("Failed to count buffer in pack_send_tag.");
-
+ int real_buff_size = 0;
result = pack_tags(tag_ents, rit, tag_ents,
- buff_ptr, buff_size, false, true, *sit,
- tags, tag_ranges, false);
+ buff_ptr, real_buff_size, false, true, *sit,
+ tags, tag_ranges);
RRA("Failed to pack buffer in pack_send_tag.");
+ assert(buff_size == real_buff_size);
// if the message is large, send a first message to tell how large
if (INITIAL_BUFF_SIZE < buff_size) {
@@ -3538,7 +3609,9 @@
return MB_SUCCESS;
}
-MBErrorCode MBParallelComm::exchange_tags( MBTag tag, const MBRange& entities )
+MBErrorCode MBParallelComm::exchange_tags( MBTag src_tag,
+ MBTag dst_tag,
+ const MBRange& entities )
{
MBErrorCode result;
int success;
@@ -3581,23 +3654,19 @@
for (sit = exch_procs.begin(); sit != exch_procs.end(); sit++) {
int ind = get_buffers(*sit);
- MBRange& tag_ents = proc_ents[*sit];
- std::vector<MBTag> tags(1); tags[0] = tag;
- std::vector<MBRange> tag_ranges(1); tag_ranges[0].swap(tag_ents);
+ // count first
+ // buffer needs to begin with the number of tags (one)
+ int buff_size = sizeof(int);
+ result = packed_tag_size( src_tag, proc_ents[*sit], buff_size );
+ RRA("Failed to count buffer in pack_send_tag.");
- // count first
- int buff_size = 0;
+ int real_buff_size = sizeof(int);
unsigned char *buff_ptr = &ownerSBuffs[ind][0];
- MBRange::iterator rit = tag_ranges[0].begin();
- result = pack_tags(tag_ranges[0], rit, tag_ranges[0],
- buff_ptr, buff_size, true, true, *sit,
- tags, tag_ranges, false);
- RRA("Failed to count buffer in pack_send_tag.");
-
- result = pack_tags(tag_ranges[0], rit, tag_ranges[0],
- buff_ptr, buff_size, false, true, *sit,
- tags, tag_ranges, false);
+ PACK_INT( buff_ptr, 1 ); // number of tags
+ result = pack_tag( src_tag, dst_tag, proc_ents[*sit], proc_ents[*sit],
+ buff_ptr, real_buff_size, true, *sit );
RRA("Failed to pack buffer in pack_send_tag.");
+ assert(real_buff_size == buff_size);
// if the message is large, send a first message to tell how large
if (INITIAL_BUFF_SIZE < buff_size) {
Modified: MOAB/trunk/parallel/MBParallelComm.hpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.hpp 2008-11-14 21:20:33 UTC (rev 2252)
+++ MOAB/trunk/parallel/MBParallelComm.hpp 2008-11-14 21:38:13 UTC (rev 2253)
@@ -177,7 +177,9 @@
*/
MBErrorCode exchange_tags(MBTag tagh);
- MBErrorCode exchange_tags( MBTag tag, const MBRange& entities );
+ MBErrorCode exchange_tags( MBTag src_tag,
+ MBTag dst_tag,
+ const MBRange& entities );
/** \brief Broadcast all entities resident on from_proc to other processors
* This function assumes remote handles are *not* being stored, since (usually)
@@ -499,21 +501,33 @@
const bool store_handles,
const int from_proc);
+
+ /**\brief Get list of tags for which to exchange data
+ *
+ * Get tags and entities for which to exchange tag data. This function
+ * was originally part of 'pack_tags' requested with the
+ * 'all_possible_tags' parameter.
+ *
+ *\param all_entities Input. The set of entities for which data is to
+ * be communicated.
+ *\param all_tags Output. Populated with the handles of tags to be
+ * sent.
+ *\param tag_ranges Output. For each corresponding tag in all_tags, the
+ * subset of 'all_entities' for which a tag value has
+ * been set.
+ */
+ MBErrorCode get_tag_send_list( const MBRange& all_entities,
+ std::vector<MBTag>& all_tags,
+ std::vector<MBRange>& tag_ranges );
+
/**\brief Serialize entity tag data
*
* This function operates in two passes. The first phase,
* specified by 'just_count == true' calculates the necesary
- * buffer size for the serialized data and, optionally populates
- * the vectors of tag handles and entity ranges. The second phase
+ * buffer size for the serialized data. The second phase
* writes the actual binary serialized representation of the
* data to the passed buffer.
*
- *\NOTE all_tags and tag_ranges must be empty if all_possible_tags
- * == true and just_count == true. Otherwise tag_ranges must
- * be at least the size of all_tags, and probably should be the
- * same size as all_tags.
- *\NOTE For most use cases, 'count' should be initialized to zero
- * before calling this function.
*\NOTE First two arguments are not used. (Legacy interface?)
*
*\param entities NOT USED
@@ -546,34 +560,64 @@
*\param to_proc If 'store_handles' is true, the processor rank for
* which to store the corresponding remote entity
* handles.
- *\param all_tags If all_possible_tags == false or just_count == false
- * Input: List of tags to write
- * Otherwise
- * Output: List of all non-internal tags
- *\param tag_ranges If all_possible_tags == false or just_count == false
- * Input: List of entities to serialize tag data, one
+ *\param all_tags List of tags to write
+ *\param tag_ranges List of entities to serialize tag data, one
* for each corresponding tag handle in 'all_tags.
- * Otherwise
- * Output: Subsets of 'whole_range' for which a value
- * has been stored for the corresponding tag.
- *\param all_possible_tags Ignored unless just_count == true. If
- * just_count == true and this argument is true, then
- * treat 'all_tags' and 'tag_ranges' as output rather
- * than input, populating them with non-internal-use
- * tags and the corresponding entities.
*/
MBErrorCode pack_tags(MBRange &entities,
MBRange::const_iterator &start_rit,
- MBRange &whole_range,
+ const MBRange &whole_range,
unsigned char *&buff_ptr,
int &count,
const bool just_count,
const bool store_handles,
const int to_proc,
- std::vector<MBTag> &all_tags,
- std::vector<MBRange> &tag_ranges,
- const bool all_possible_tags = true);
+ const std::vector<MBTag> &all_tags,
+ const std::vector<MBRange> &tag_ranges );
+ /**\brief Calculate buffer size required to packtag data
+ *\param source_tag The tag for which data will be serialized
+ *\param entites The entities for which tag values will be serialized
+ *\param count_out Output: The required buffer size, in bytes.
+ */
+ MBErrorCode packed_tag_size( MBTag source_tag,
+ const MBRange& entities,
+ int& count_out );
+
+ /**\brief Serialize tag data
+ *\param source_tag The tag for which data will be serialized
+ *\param destination_tag Tag in which to store unpacked tag data. Typically
+ * the same as source_tag.
+ *\param entites The entities for which tag values will be serialized
+ *\param whole_range Calculate entity indices as location in this range
+ *\param buff_ptr Input/Output: As input, pointer to the start of the
+ * buffer in which to serialize data. As output, the
+ * position just passed the serialized data.
+ *\param count_out Output: The required buffer size, in bytes.
+ *\param store_handles The data for each tag is preceeded by a list of
+ * MBEntityHandles designating the entity each of
+ * the subsequent tag values corresponds to. This value
+ * may be one of:
+ * 1) If store_handles == false:
+ * An invalid handle composed of {MBMAXTYE,idx}, where
+ * idx is the position of the entity in "whole_range".
+ * 2) If store_hanldes == true and a valid remote
+ * handle exists, the remote handle.
+ * 3) If store_hanldes == true and no valid remote
+ * handle is defined for the entity, the same as 1).
+ *\param to_proc If 'store_handles' is true, the processor rank for
+ * which to store the corresponding remote entity
+ * handles.
+ */
+ MBErrorCode pack_tag( MBTag source_tag,
+ MBTag destination_tag,
+ const MBRange &entites,
+ const MBRange &whole_range,
+ unsigned char *&buff_ptr,
+ int &count,
+ const bool store_remote_handles,
+ const int to_proc );
+
MBErrorCode unpack_tags(unsigned char *&buff_ptr,
MBRange &entities,
const bool store_handles,
Modified: MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp 2008-11-14 21:20:33 UTC (rev 2252)
+++ MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp 2008-11-14 21:38:13 UTC (rev 2253)
@@ -1460,10 +1460,6 @@
int entity_topo,
int *err )
{
- if (source_tag != dest_tag)
- RETURN (iBase_NOT_SUPPORTED);
- iBase_TagHandle tag = source_tag;
-
MBParallelComm* pcomm = PCOMM;
MBDimensionPair types;
if (entity_topo != iMesh_ALL_TOPOLOGIES)
@@ -1476,15 +1472,16 @@
--types.second;
}
- MBTag tag_handle = itaps_cast<MBTag>(tag);
+ MBTag src_handle = itaps_cast<MBTag>(source_tag);
+ MBTag dst_handle = itaps_cast<MBTag>(dest_tag);
MBErrorCode rval;
MBRange entities;
for (MBEntityType t = types.first; t <= types.second; ++t) {
- rval = MBI->get_entities_by_type_and_tag( 0, t, &tag_handle, 0, 1, entities, MBInterface::UNION );
+ rval = MBI->get_entities_by_type_and_tag( 0, t, &src_handle, 0, 1, entities, MBInterface::UNION );
CHKERR(rval);
}
- rval = pcomm->exchange_tags( itaps_cast<MBTag>(tag), entities );
+ rval = pcomm->exchange_tags( src_handle, dst_handle, entities );
CHKERR(rval);
RETURN (iBase_SUCCESS);
}
@@ -1497,16 +1494,15 @@
int entities_size,
int *err )
{
- if (source_tag != dest_tag)
- RETURN (iBase_NOT_SUPPORTED);
- iBase_TagHandle tag = source_tag;
MBRange range;
const MBEntityHandle* ents = itaps_cast<const MBEntityHandle*>(entities);
std::copy( ents, ents+entities_size, mb_range_inserter(range) );
+ MBTag src_handle = itaps_cast<MBTag>(source_tag);
+ MBTag dst_handle = itaps_cast<MBTag>(dest_tag);
MBParallelComm* pcomm = PCOMM;
- MBErrorCode rval = pcomm->exchange_tags( itaps_cast<MBTag>(tag), range );
+ MBErrorCode rval = pcomm->exchange_tags( src_handle, dst_handle, range );
CHKERR(rval);
RETURN (iBase_SUCCESS);
}
More information about the moab-dev
mailing list