[MOAB-dev] r5321 - in MOAB/trunk: examples src/io
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Sun Jan 15 14:39:53 CST 2012
Author: tautges
Date: 2012-01-15 14:39:53 -0600 (Sun, 15 Jan 2012)
New Revision: 5321
Modified:
MOAB/trunk/examples/SetsNTags.cpp
MOAB/trunk/src/io/ReadHDF5.cpp
Log:
src/io/ReadHDF5.cpp: fixing a compiler warning, and fixing a really obscure bug intersecting a file_id list
with a RangeMap.
examples/SetsNTags.cpp: added code to list all sets, and code to run in parallel.
Passes make check.
Modified: MOAB/trunk/examples/SetsNTags.cpp
===================================================================
--- MOAB/trunk/examples/SetsNTags.cpp 2012-01-13 23:23:22 UTC (rev 5320)
+++ MOAB/trunk/examples/SetsNTags.cpp 2012-01-15 20:39:53 UTC (rev 5321)
@@ -4,22 +4,28 @@
#include <iostream>
int main(int argc, char **argv) {
- if (1 == argc) {
- std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
- return 0;
- }
-
// get the material set tag handle
moab::Tag mtag;
moab::ErrorCode rval;
- const char *tag_nms[] = {"MATERIAL_SET", "DIRICHLET_SET",
- "NEUMANN_SET"};
+ const char *tag_nms[] = {"MATERIAL_SET", "DIRICHLET_SET", "NEUMANN_SET"};
moab::Range sets, set_ents;
// instantiate & load a file
moab::Interface *mb = new moab::Core();
- rval = mb->load_file(argv[1]);
+ const char *par_opt = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARTITION_DISTRIBUTE;PARALLEL_RESOLVE_SHARED_ENTS;SETS=SETS";
+ bool parallel = false;
+ if (argc > 2 && !strcmp(argv[1], "-p")) parallel = true;
+ else if (argc == 1) {
+ std::cout << "Usage: " << argv[0] << "[-p] <filename>" << std::endl;
+ return 0;
+ }
+
+ if (parallel)
+ rval = mb->load_file(argv[argc-1], 0, par_opt);
+ else
+ rval = mb->load_file(argv[argc-1]);
+
// loop over set types
for (int i = 0; i < 3; i++) {
rval = mb->tag_get_handle(tag_nms[i], 1, moab::MB_TYPE_INTEGER, mtag);
@@ -42,8 +48,18 @@
rval = mb->get_entities_by_handle(this_set, set_ents, true);
std::cout << tag_nms[i] << " " << set_id << " has "
- << set_ents.size() << " entities." << std::endl;
+ << set_ents.size() << " entities:" << std::endl;
+ set_ents.print(" ");
set_ents.clear();
}
}
More information about the moab-dev
mailing list