[MOAB-dev] r1923 - in MOAB/trunk: . parallel tools/mbcoupler
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Wed Jun 25 02:01:33 CDT 2008
Author: tautges
Date: 2008-06-25 02:01:32 -0500 (Wed, 25 Jun 2008)
New Revision: 1923
Modified:
MOAB/trunk/ReadGmsh.cpp
MOAB/trunk/ReadHDF5.cpp
MOAB/trunk/ReadSTL.cpp
MOAB/trunk/ReadVtk.cpp
MOAB/trunk/Tqdcfr.cpp
MOAB/trunk/WriteNCDF.cpp
MOAB/trunk/parallel/MBParallelComm.cpp
MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
Log:
Modifying lots of readers to call MBReadUtilIface->update_adjacencies
after creating a batch of elements and updating their connectivity.
This ensures that, if AEntityFactory has already created
vertex-element adjacencies, that those adjacencies will get created
for the new elements/vertices. Without this, some vertices have
upward adjacencies and some do not.
Also updating mbcoupler_test to use new method for accessing
partitions/interfaces and calling parallel reader for multiple files.
Passes make check, except for parallel Tqdcfr test, which fails because of a check I inserted recently on number of partition sets vs. number of procs.
Modified: MOAB/trunk/ReadGmsh.cpp
===================================================================
--- MOAB/trunk/ReadGmsh.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/ReadGmsh.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -404,6 +404,10 @@
memcpy( conn_array, &connectivity[0], connectivity.size() * sizeof(MBEntityHandle) );
}
+ // notify MOAB of the new elements
+ result = readMeshIface->update_adjacencies(handle, num_elem, node_per_elem, conn_array);
+ if (MB_SUCCESS != result) return result;
+
// Store element IDs
result = mdbImpl->tag_set_data( globalId, elements, &elem_ids[0] );
if (MB_SUCCESS != result)
Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/ReadHDF5.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -441,7 +441,14 @@
rval = convert_id_to_handle( array, (size_t)(nodes_per_elem*count) );
else
rval = convert_id_to_handle( nodeSet, array, (size_t)(nodes_per_elem*count) );
-
+
+ if (MB_SUCCESS != rval) return rval;
+
+ // notify MOAB of the new elements
+ MBErrorCode result = readUtil->update_adjacencies(handle, count,
+ nodes_per_elem, array);
+ if (MB_SUCCESS != result) return result;
+
return rval;
}
Modified: MOAB/trunk/ReadSTL.cpp
===================================================================
--- MOAB/trunk/ReadSTL.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/ReadSTL.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -207,6 +207,7 @@
// Use vertex_map to reconver triangle connectivity from
// vertex coordinates.
+ MBEntityHandle *conn_sav = connectivity;
for (std::vector<Triangle>::iterator i = triangles.begin(); i != triangles.end(); ++i)
{
*connectivity = vertex_map[i->points[0]]; ++connectivity;
@@ -214,6 +215,11 @@
*connectivity = vertex_map[i->points[2]]; ++connectivity;
}
+ // notify MOAB of the new elements
+ result = readMeshIface->update_adjacencies(handle, triangles.size(),
+ 3, conn_sav);
+ if (MB_SUCCESS != result) return result;
+
return MB_SUCCESS;
}
Modified: MOAB/trunk/ReadVtk.cpp
===================================================================
--- MOAB/trunk/ReadVtk.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/ReadVtk.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -671,6 +671,8 @@
if (MB_SUCCESS != result)
return result;
+ MBEntityHandle *conn_sav = conn_array;
+
// Store element connectivity
for ( ; id < end_id; ++id)
{
@@ -714,6 +716,11 @@
conn_array += num_vtx;
}
+
+ // notify MOAB of the new elements
+ result = readMeshIface->update_adjacencies(start_handle, num_elem,
+ num_vtx, conn_sav);
+ if (MB_SUCCESS != result) return result;
}
return MB_SUCCESS;
@@ -761,6 +768,8 @@
if (MB_SUCCESS != result)
return MB_FAILURE;
+ MBEntityHandle *conn_sav = conn_array;
+
// Offsets of element vertices in grid relative to corner closest to origin
long k = dims[0]*dims[1];
const long corners[8] = { 0, 1, 1+dims[0], dims[0], k, k+1, k+1+dims[0], k+dims[0] };
@@ -775,6 +784,11 @@
*conn_array = index + corners[j] + first_vtx;
}
+ // notify MOAB of the new elements
+ result = readMeshIface->update_adjacencies(start_handle, num_elems,
+ vert_per_elem, conn_sav);
+ if (MB_SUCCESS != result) return result;
+
return MB_SUCCESS;
}
Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/Tqdcfr.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -1212,6 +1212,10 @@
result = mdbImpl->add_entities(entity->setHandle, dum_range);
if (MB_SUCCESS != result) return result;
+ // notify MOAB of the new elements
+ result = readUtilIface->update_adjacencies(start_handle, num_elem,
+ nodes_per_elem, conn);
+ if (MB_SUCCESS != result) return result;
}
// set the dimension on the geom tag
Modified: MOAB/trunk/WriteNCDF.cpp
===================================================================
--- MOAB/trunk/WriteNCDF.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/WriteNCDF.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -1261,7 +1261,8 @@
&(*begin_iter),
1, &exodus_id);
if (MB_FAILURE == result) {
- mWriteIface->report_error("Problem getting exodus id for sideset element %lu", ID_FROM_HANDLE(*begin_iter));
+ mWriteIface->report_error("Problem getting exodus id for sideset element %lu",
+ (long unsigned int) ID_FROM_HANDLE(*begin_iter));
return result;
}
Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/parallel/MBParallelComm.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -1870,12 +1870,13 @@
MBEntityHandle set_handle;
result = mbImpl->create_meshset(options_vec[i], set_handle);
RRA("Failed to create set in unpack.");
+
+ // make sure new sets handles are monotonically increasing
+ assert(set_handle > *new_sets.rbegin());
+
new_sets.insert(set_handle);
}
- // make sure new sets handles are contiguous
- assert(*new_sets.rbegin() - *new_sets.begin() + 1 == new_sets.size());
-
entities.merge(new_sets);
for (rit = new_sets.begin(), i = 0; rit != new_sets.end(); rit++, i++) {
Modified: MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp 2008-06-25 05:20:15 UTC (rev 1922)
+++ MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp 2008-06-25 07:01:32 UTC (rev 1923)
@@ -57,21 +57,35 @@
// read in mesh(es)
- ReadParallel rp(mbImpl);
- MBEntityHandle file_set = 0;
- result = rp.load_file(&filenames[0], filenames.size(), file_set,
- FileOptions(opts.c_str()), NULL, 0);
- if (MB_SUCCESS == result) {
- std::cout << "Success." << std::endl;
- err = MPI_Finalize();
- return 0;
+ std::vector<MBParallelComm *> pcs(filenames.size());
+ std::vector<ReadParallel *> rps(filenames.size());
+ std::vector<MBEntityHandle> filesets(filenames.size());
+
+ for (unsigned int i = 0; i < filenames.size(); i++) {
+ pcs[i] = new MBParallelComm(mbImpl);
+ rps[i] = new ReadParallel(mbImpl, pcs[i]);
+
+ result = rps[i]->load_file(filenames[i], filesets[i],
+ FileOptions(opts.c_str()), NULL, 0);
+ if (MB_SUCCESS != result) {
+ std::string tmp_str;
+ std::cout << "Failure; message:" << std::endl;
+ std::cout << mbImpl->get_last_error(tmp_str) << std::endl;
+ return 1;
+ }
}
- else {
- std::string tmp_str;
- std::cout << "Failure; message:" << std::endl;
- std::cout << mbImpl->get_last_error(tmp_str) << std::endl;
- return 1;
+
+ std::cout << "Success." << std::endl;
+ err = MPI_Finalize();
+
+ for (unsigned int i = 0; i < filenames.size(); i++) {
+ delete rps[i];
+ delete pcs[i];
}
+
+ delete mbImpl;
+
+ return 0;
}
MBErrorCode get_file_options(int argc, char **argv,
More information about the moab-dev
mailing list