[MOAB-dev] r4592 - in MOAB/trunk/src: io parallel
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Tue Mar 15 14:20:07 CDT 2011
Author: tautges
Date: 2011-03-15 14:20:07 -0500 (Tue, 15 Mar 2011)
New Revision: 4592
Modified:
MOAB/trunk/src/io/ReadNC.cpp
MOAB/trunk/src/io/ReadNC.hpp
MOAB/trunk/src/parallel/ReadParallel.cpp
Log:
In parallel read, only try to get entities in partition set
if partition tag is non-empty.
In ReadNC, only read in parallel if a valid partition name is input,
and put hexes in the range used to insert these into partition set.
Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp 2011-03-15 17:16:47 UTC (rev 4591)
+++ MOAB/trunk/src/io/ReadNC.cpp 2011-03-15 19:20:07 UTC (rev 4592)
@@ -107,7 +107,8 @@
}
bool nomesh = false;
- rval = parse_options(opts, var_names, tstep_nums, tstep_vals, nomesh);
+ std::string partition_tag_name;
+ rval = parse_options(opts, var_names, tstep_nums, tstep_vals, nomesh, partition_tag_name);
ERRORR(rval, "Trouble parsing option string.");
// Open the file
@@ -155,15 +156,26 @@
ERRORS(success, "Trouble closing file.");
// create partition set, and populate with elements
-#ifdef USE_MPI
- EntityHandle partn_set;
- rval = mbImpl->create_meshset(MESHSET_SET, partn_set);
- ERRORR(rval, "Trouble creating partition set.");
- myPcomm->partition_sets().insert(partn_set);
- rval = mbImpl->add_entities(partn_set, hexes);
- ERRORR(rval, "Couldn't add new hexes to partition set.");
-#endif
+ if (isParallel) {
+ EntityHandle partn_set;
+ rval = mbImpl->create_meshset(MESHSET_SET, partn_set);
+ ERRORR(rval, "Trouble creating partition set.");
+ myPcomm->partition_sets().insert(partn_set);
+ rval = mbImpl->add_entities(partn_set, hexes);
+ ERRORR(rval, "Couldn't add new hexes to partition set.");
+ Tag part_tag;
+ rval = mbImpl->tag_get_handle( partition_tag_name.c_str(), part_tag );
+ if (MB_SUCCESS != rval) {
+ // fall back to the partition tag
+ part_tag = myPcomm->partition_tag();
+ }
+
+ int dum_rank = myPcomm->proc_config().proc_rank();
+ rval = mbImpl->tag_set_data(part_tag, &partn_set, 1, &dum_rank);
+ if (MB_SUCCESS != rval) return rval;
+ }
+
return MB_SUCCESS;
}
@@ -171,7 +183,8 @@
std::vector<std::string> &var_names,
More information about the moab-dev
mailing list