[MOAB-dev] r3714 - in MOAB/trunk: test/parallel tools/mbzoltan
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Thu Mar 25 17:16:30 CDT 2010
Author: tautges
Date: 2010-03-25 17:16:30 -0500 (Thu, 25 Mar 2010)
New Revision: 3714
Modified:
MOAB/trunk/test/parallel/mbparallelcomm_test.cpp
MOAB/trunk/tools/mbzoltan/main.cpp
Log:
Added code to reduce and print number of shared vertices.
Use non-deprecated constructor, and check for file read error.
Modified: MOAB/trunk/test/parallel/mbparallelcomm_test.cpp
===================================================================
--- MOAB/trunk/test/parallel/mbparallelcomm_test.cpp 2010-03-25 21:53:00 UTC (rev 3713)
+++ MOAB/trunk/test/parallel/mbparallelcomm_test.cpp 2010-03-25 22:16:30 UTC (rev 3714)
@@ -427,7 +427,7 @@
ErrorCode result = MB_SUCCESS, tmp_result;
// now figure out which vertices are shared
- Range part_ents;
+ Range part_ents, part_verts;
for (unsigned int p = 0; p < pcs.size(); p++) {
// get entities owned by this partition
for (Range::iterator rit = pcs[p]->partition_sets().begin();
@@ -452,6 +452,20 @@
}
}
+ // get non-owned vertices
+ result = pcs[0]->get_pstatus_entities(0, PSTATUS_NOT_OWNED, part_verts);
+ if (MB_SUCCESS != tmp_result) {
+ std::cerr << "Couldn't get non-owned entities." << std::endl;
+ return result;
+ }
+ int tot_verts;
+ result = mbImpl->get_number_entities_by_dimension(0, 0, tot_verts);
+ if (MB_SUCCESS != tmp_result) {
+ std::cerr << "Couldn't get number of vertices." << std::endl;
+ return result;
+ }
+ tot_verts -= part_verts.size();
+
// report # iface entities
result = mbImpl->get_adjacencies(iface_ents[4], 0, false, iface_ents[5],
Interface::UNION);
@@ -474,15 +488,19 @@
<< " 3d entities." << std::endl;
// get total # regions over all procs
- int num_local = part_ents.size(), num_total;
+ int num_local[2], num_total[2];
+ num_local[0] = tot_verts;
+ num_local[1] = part_ents.size();
- int failure = MPI_Reduce(&num_local, &num_total, 1,
+ int failure = MPI_Reduce(&num_local, &num_total, 2,
MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
if (failure) result = MB_FAILURE;
- if (0 == rank)
- std::cout << "Total # owned regions = " << num_total << std::endl;
-
+ if (0 == rank) {
+ std::cout << "Total # owned vertices = " << num_total[0] << std::endl;
+ std::cout << "Total # owned regions = " << num_total[1] << std::endl;
+ }
+
return result;
}
Modified: MOAB/trunk/tools/mbzoltan/main.cpp
===================================================================
--- MOAB/trunk/tools/mbzoltan/main.cpp 2010-03-25 21:53:00 UTC (rev 3713)
+++ MOAB/trunk/tools/mbzoltan/main.cpp 2010-03-25 22:16:30 UTC (rev 3714)
@@ -16,7 +16,15 @@
#include <iostream>
#include <string>
-#define RR if (MB_SUCCESS != result) return result
+#define RR \
+ {if (MB_SUCCESS != result) { \
+ std::string last_error; \
+ mbImpl->get_last_error(last_error); \
+ std::cerr << "MOAB returned with error: " << std::endl; \
+ std::cerr << last_error << std::endl; \
+ return 1; \
+ } \
+ }
int main(int argc, char *argv[])
{
@@ -49,10 +57,11 @@
err = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// create MOAB instance based on that
- moab::Interface *mbImpl = new moab::Core(rank, nprocs);
+ moab::Interface *mbImpl = new moab::Core();
if (NULL == mbImpl) return 1;
moab::ErrorCode result = mbImpl->load_mesh(argv[2]); RR;
+
MBZoltan *mbz = new MBZoltan(mbImpl, false, argc, argv);
More information about the moab-dev
mailing list