[MOAB-dev] r1511 - MOAB/trunk
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Wed Jan 9 15:21:12 CST 2008
Author: tautges
Date: 2008-01-09 15:21:12 -0600 (Wed, 09 Jan 2008)
New Revision: 1511
Modified:
MOAB/trunk/Tqdcfr.cpp
MOAB/trunk/mbparallelcomm_test.cpp
Log:
Adding option to mbparallelcomm_test to select type of read method (run w/o args to get new syntax).
Removing some compiler warnings in Tqdcfr.
Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp 2008-01-09 21:10:15 UTC (rev 1510)
+++ MOAB/trunk/Tqdcfr.cpp 2008-01-09 21:21:12 UTC (rev 1511)
@@ -972,7 +972,7 @@
MBRange vrange;
result = mdbImpl->get_entities_by_type(0, MBVERTEX, vrange); RR;
#define MAX(a,b) (a > b ? a : b)
- int map_size = MAX((node_offset+entity->nodeCt), ((int)*vrange.rbegin()+1));
+ int map_size = MAX((node_offset+entity->nodeCt), (*vrange.rbegin()+1));
cubMOABVertexMap = new std::vector<MBEntityHandle>(map_size);
std::fill(cubMOABVertexMap->begin(), cubMOABVertexMap->end(), 0);
@@ -1116,21 +1116,21 @@
// post-process connectivity into handles
MBEntityHandle new_handle, dum_handle;
int dum_err;
- for (i = 0; i < total_conn; i++) {
+ for (unsigned int j = 0; j < total_conn; j++) {
if (NULL == cubMOABVertexMap)
- new_handle = CREATE_HANDLE(MBVERTEX, currNodeIdOffset+tmp_conn[i], dum_err);
+ new_handle = CREATE_HANDLE(MBVERTEX, currNodeIdOffset+tmp_conn[j], dum_err);
else {
if (debug) {
if (0 == i) std::cout << "Conn";
- std::cout << ", " << tmp_conn[i];
+ std::cout << ", " << tmp_conn[j];
}
- assert(0 != (*cubMOABVertexMap)[tmp_conn[i]]);
- new_handle = (*cubMOABVertexMap)[tmp_conn[i]];
+ assert(0 != (*cubMOABVertexMap)[tmp_conn[j]]);
+ new_handle = (*cubMOABVertexMap)[tmp_conn[j]];
}
assert(MB_SUCCESS ==
mdbImpl->handle_from_id(MBVERTEX, mdbImpl->id_from_handle(new_handle),
dum_handle));
- conn[i] = new_handle;
+ conn[j] = new_handle;
}
if (sizeof(MBEntityHandle) != sizeof(int))
@@ -1207,10 +1207,10 @@
// need to loop over i, b/c int_buf is bigger than num_ents
for (id_it = int_buf.begin(), i = 0; i < num_ents; id_it++, i++) {
- if (((int)*id_it) < min_id || -1 == min_id) min_id = *id_it;
- if (*id_it > max_id || -1 == max_id) max_id = *id_it;
+ if (((int)(*id_it)) < min_id || -1 == min_id) min_id = *id_it;
+ if (((int) *id_it) > max_id || -1 == max_id) max_id = *id_it;
}
- if (max_id - min_id + 1 == num_ents) contig = min_id;
+ if (max_id - min_id + 1 == (int) num_ents) contig = min_id;
// else it's not contiguous at all
contig = 0;
@@ -2438,18 +2438,35 @@
else
file = argv[1];
- MBCore my_impl;
- Tqdcfr my_tqd(&my_impl);
+ MBCore *my_impl = new MBCore();
+ Tqdcfr *my_tqd = new Tqdcfr(my_impl);
MBEntityHandle file_set;
FileOptions opts(NULL);
- MBErrorCode result = my_tqd.load_file(file, file_set, opts, 0, 0);
+ MBErrorCode result = my_tqd->load_file(file, file_set, opts, 0, 0);
if (MB_SUCCESS == result)
std::cout << "Success." << std::endl;
else
std::cout << "load_file returned error." << std::endl;
+ delete my_tqd;
+ delete my_impl;
+
+ // now check for multiple procs
+ my_impl = new MBCore(1, 2);
+ my_tqd = new Tqdcfr(my_impl);
+
+ result = my_tqd->load_file(file, file_set, opts, 0, 0);
+
+ if (MB_SUCCESS == result)
+ std::cout << "Success." << std::endl;
+ else
+ std::cout << "load_file returned error." << std::endl;
+
+ delete my_tqd;
+ delete my_impl;
+
return result;
}
#endif
Modified: MOAB/trunk/mbparallelcomm_test.cpp
===================================================================
--- MOAB/trunk/mbparallelcomm_test.cpp 2008-01-09 21:10:15 UTC (rev 1510)
+++ MOAB/trunk/mbparallelcomm_test.cpp 2008-01-09 21:21:12 UTC (rev 1511)
@@ -35,7 +35,8 @@
int IJK, int &nshared);
MBErrorCode read_file(MBInterface *mbImpl, const char *filename,
- const char *tag_name, int tag_val, int distrib);
+ const char *tag_name, int tag_val, int distrib,
+ int parallel_option);
int main(int argc, char **argv)
{
@@ -62,7 +63,9 @@
if (0 == rank)
std::cerr
<< "Usage: " << argv[0]
- << " <opt> <input> [...] where:" << std::endl
+ << " [readpar_option] <opt> <input> [...] where:" << std::endl
+ << " readpar_option = 0 (BCAST_DELETE) (default), -1 (READ_DELETE), " << std::endl
+ << " -2 (READ_PARALLEL), -3 (BCAST)" << std::endl
<< "opt input" << std::endl
<< "=== =====" << std::endl
<< " 1 <linear_ints> <shared_verts> " << std::endl
@@ -76,12 +79,20 @@
int npos = 1, tag_val, distrib;
const char *tag_name, *filename;
+ int parallel_option = 0;
while (npos < argc) {
MBErrorCode tmp_result;
int nshared = -1;
int this_opt = strtol(argv[npos++], NULL, 0);
switch (this_opt) {
+ case 0:
+ case -1:
+ case -2:
+ case -3:
+ parallel_option = this_opt;
+ break;
+
case 1:
N = atoi(argv[npos++]);
M = atoi(argv[npos++]);
@@ -114,7 +125,7 @@
if (npos < argc) distrib = strtol(argv[npos++], NULL, 0);
else distrib = 1;
tmp_result = read_file(mbImpl, filename, tag_name, tag_val,
- distrib);
+ distrib, parallel_option);
if (MB_SUCCESS != tmp_result) {
result = tmp_result;
std::cerr << "Couldn't read mesh; error message:" << std::endl;
@@ -191,10 +202,25 @@
MBErrorCode read_file(MBInterface *mbImpl, const char *filename,
const char *tag_name, int tag_val,
- int distrib)
+ int distrib, int parallel_option)
{
std::ostringstream options;
- options << "PARALLEL=BCAST_DELETE;PARTITION=" << tag_name;
+ switch (parallel_option) {
+ case 0:
+ options << "PARALLEL=BCAST_DELETE;PARTITION=" << tag_name;
+ break;
+ case -1:
+ options << "PARALLEL=READ_DELETE;PARTITION=" << tag_name;
+ break;
+ case -2:
+ options << "PARALLEL=READ_PARALLEL;PARTITION=" << tag_name;
+ break;
+ case -3:
+ options << "PARALLEL=BCAST;PARTITION=" << tag_name;
+ break;
+ default:
+ return MB_FAILURE;
+ }
if (-1 != tag_val)
options << ";PARTITION_VAL=" << tag_val;
More information about the moab-dev
mailing list