[MOAB-dev] r4964 - in MOAB/trunk: src/io test/io
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Wed Jun 8 07:35:17 CDT 2011
Author: tautges
Date: 2011-06-08 07:35:11 -0500 (Wed, 08 Jun 2011)
New Revision: 4964
Modified:
MOAB/trunk/src/io/ReadNC.cpp
MOAB/trunk/src/io/ReadNC.hpp
MOAB/trunk/test/io/read_nc.cpp
Log:
Implement the nomesh option in the NC reader. Currently, the only check is
comparing the actual number of vertices and hexes against the expected number of
vertices and hexes computed based on the ijk parameterization.
Added test for nomesh option to NC reader test.
Passes make check in serial and parallel.
Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp 2011-06-08 08:11:24 UTC (rev 4963)
+++ MOAB/trunk/src/io/ReadNC.cpp 2011-06-08 12:35:11 UTC (rev 4964)
@@ -124,7 +124,10 @@
// make sure there's a file set to put things in
EntityHandle tmp_set;
- if (!file_set || (file_set && *file_set == 0)) {
+ if (nomesh && !file_set) {
+ ERRORR(MB_FAILURE, "NOMESH option requires non-NULL file set on input.\n");
+ }
+ else if (!file_set || (file_set && *file_set == 0)) {
rval = mbImpl->create_meshset(MESHSET_SET, tmp_set);
ERRORR(rval, "Trouble creating file set.");
}
@@ -136,8 +139,14 @@
// Create structured mesh vertex/hex sequences
Range hexes;
- rval = create_verts_hexes(tmp_set, hexes);
- ERRORR(rval, "Trouble creating vertices.");
+ if (nomesh) {
+ rval = check_verts_hexes(tmp_set);
+ ERRORR(rval, "Mesh characteristics didn't match from last read.\n");
+ }
+ else {
+ rval = create_verts_hexes(tmp_set, hexes);
+ ERRORR(rval, "Trouble creating vertices.");
+ }
// Read variables onto grid
rval = read_variables(tmp_set, var_names, tstep_nums, nomesh);
@@ -244,6 +253,32 @@
return MB_SUCCESS;
}
+ErrorCode ReadNC::check_verts_hexes(EntityHandle file_set)
+{
+ // check parameters on this read against what was on the mesh from last read
+ // get the number of vertices
+ int num_verts;
+ ErrorCode rval = mbImpl->get_number_entities_by_dimension(file_set, 0, num_verts);
+ ERRORR(rval, "Trouble getting number of vertices.");
+
+ // check against parameters
+ int expected_verts = (ilMax - ilMin + 1) * (jlMax - jlMin + 1) * (-1 == klMin ? 1 : klMax - klMin + 1);
+ if (num_verts != expected_verts)
+ ERRORR(MB_FAILURE, "Number of vertices doesn't match.");
+
+ // check the number of elements too
More information about the moab-dev
mailing list