[MOAB-dev] commit/MOAB: danwu: Updated NC reader/writer with some minor changes to existing error handling code.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jun 27 14:06:44 CDT 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/b77f786ac429/
Changeset: b77f786ac429
Branch: master
User: danwu
Date: 2014-06-27 21:06:26
Summary: Updated NC reader/writer with some minor changes to existing error handling code.
Affected #: 12 files
diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 8a1b91e..92cad43 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -215,7 +215,7 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
// <PARTITION_METHOD>
Tag part_tag = scdi->part_method_tag();
if (!part_tag)
- ERRORR(MB_FAILURE, "Trouble getting partition method tag.");
+ ERRORR(MB_FAILURE, "Trouble getting PARTITION_METHOD tag.");
rval = mbImpl->tag_set_data(part_tag, &_fileSet, 1, &partMethod);
ERRORR(rval, "Trouble setting data for PARTITION_METHOD tag.");
if (MB_SUCCESS == rval)
@@ -229,7 +229,7 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
std::string gattVal;
std::vector<int> gattLen;
rval = create_attrib_string(globalAtts, gattVal, gattLen);
- ERRORR(rval, "Trouble creating attribute strings.");
+ ERRORR(rval, "Trouble creating global attribute string.");
const void* gattptr = gattVal.c_str();
int globalAttSz = gattVal.size();
rval = mbImpl->tag_set_by_ptr(globalAttTag, &_fileSet, 1, &gattptr, &globalAttSz);
@@ -424,7 +424,7 @@ ErrorCode NCHelper::read_variables_setup(std::vector<std::string>& var_names, st
vdatas.push_back(vd);
}
else {
- ERRORR(MB_FAILURE, "Couldn't find variable.");
+ ERRORR(MB_FAILURE, "Couldn't find specified variable.");
}
}
}
@@ -470,7 +470,7 @@ ErrorCode NCHelper::read_variables_to_set(std::vector<ReadNC::VarData>& vdatas,
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_variables_to_set_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables to set.");
+ ERRORR(rval, "Trouble allocating space to read set variables.");
// Finally, read into that space
int success;
@@ -505,12 +505,9 @@ ErrorCode NCHelper::read_variables_to_set(std::vector<ReadNC::VarData>& vdatas,
ERRORS(success, "Failed to read double data.");
break;
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
-
dbgOut.tprintf(2, "Setting data for variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
rval = mbImpl->tag_set_by_ptr(vdatas[i].varTags[t], &_fileSet, 1, &data, &vdatas[i].sz);
ERRORR(rval, "Failed to set data for variable.");
@@ -562,7 +559,7 @@ ErrorCode NCHelper::read_coordinate(const char* var_name, int lmin, int lmax, st
NCDF_SIZE tstart = lmin;
NCDF_SIZE tcount = lmax - lmin + 1;
NCDF_DIFF dum_stride = 1;
- int fail;
+ int success;
// Check size
if ((std::size_t)tcount != cvals.size())
@@ -570,19 +567,17 @@ ErrorCode NCHelper::read_coordinate(const char* var_name, int lmin, int lmax, st
// Check to make sure it's a float or double
if (NC_DOUBLE == (*vmit).second.varDataType) {
- fail = NCFUNCAG(_vars_double)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &cvals[0]);
- if (fail)
- ERRORS(MB_FAILURE, "Failed to get coordinate values.");
+ success = NCFUNCAG(_vars_double)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &cvals[0]);
+ ERRORS(success, "Failed to get coordinate values.");
}
else if (NC_FLOAT == (*vmit).second.varDataType) {
std::vector<float> tcvals(tcount);
- fail = NCFUNCAG(_vars_float)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &tcvals[0]);
- if (fail)
- ERRORS(MB_FAILURE, "Failed to get coordinate values.");
+ success = NCFUNCAG(_vars_float)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &tcvals[0]);
+ ERRORS(success, "Failed to get coordinate values.");
std::copy(tcvals.begin(), tcvals.end(), cvals.begin());
}
else {
- ERRORR(MB_FAILURE, "Wrong data type for coordinate variable.");
+ ERRORR(MB_FAILURE, "Unexpected coordinate variable data type.");
}
return MB_SUCCESS;
@@ -619,8 +614,7 @@ ErrorCode NCHelper::get_tag_to_set(ReadNC::VarData& var_data, int tstep_num, Tag
rval = mbImpl->tag_get_handle(tag_name.str().c_str(), 0, MB_TYPE_DOUBLE, tagh, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
break;
default:
- std::cerr << "Unrecognized data type for tag " << tag_name << std::endl;
- rval = MB_FAILURE;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
if (MB_SUCCESS == rval)
@@ -657,8 +651,7 @@ ErrorCode NCHelper::get_tag_to_nonset(ReadNC::VarData& var_data, int tstep_num,
rval = mbImpl->tag_get_handle(tag_name.str().c_str(), num_lev, MB_TYPE_DOUBLE, tagh, MB_TAG_DENSE | MB_TAG_CREAT);
break;
default:
- std::cerr << "Unrecognized data type for tag " << tag_name.str() << std::endl;
- rval = MB_FAILURE;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
if (MB_SUCCESS == rval)
@@ -715,7 +708,7 @@ ErrorCode NCHelper::create_attrib_string(const std::map<std::string, ReadNC::Att
ssAtt << "double;";
break;
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected attribute data type.");
}
char* tmpc = (char *) attData;
for (unsigned int counter = 0; counter != sz; ++counter)
@@ -846,8 +839,7 @@ ErrorCode NCHelper::read_variables_to_set_allocate(std::vector<ReadNC::VarData>&
vdatas[i].varDatas[t] = new double[vdatas[i].sz];
break;
default:
- std::cerr << "Unrecognized data type for set variable tag values" << std::endl;
- rval = MB_FAILURE;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
// Loop continues only for set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
@@ -949,7 +941,7 @@ ErrorCode ScdNCHelper::create_mesh(Range& faces)
int djl = lDims[4] - lDims[1] + 1;
assert(dil == (int)ilVals.size() && djl == (int)jlVals.size() &&
(-1 == lDims[2] || lDims[5] - lDims[2] + 1 == (int)levVals.size()));
-//#define INDEX(i, j, k) ()
+
for (kl = lDims[2]; kl <= lDims[5]; kl++) {
k = kl - lDims[2];
for (jl = lDims[1]; jl <= lDims[4]; jl++) {
@@ -963,7 +955,6 @@ ErrorCode ScdNCHelper::create_mesh(Range& faces)
}
}
}
-//#undef INDEX
#ifndef NDEBUG
int num_verts = (lDims[3] - lDims[0] + 1) * (lDims[4] - lDims[1] + 1) * (-1 == lDims[2] ? 1 : lDims[5] - lDims[2] + 1);
@@ -1033,21 +1024,21 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset_allocate(std::vector<ReadNC:
Range* range = NULL;
- // Get vertices in set
+ // Get vertices
Range verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
- ERRORR(rval, "Trouble getting vertices in set.");
+ ERRORR(rval, "Trouble getting vertices in current file set.");
assert("Should only have a single vertex subrange, since they were read in one shot" &&
verts.psize() == 1);
Range edges;
rval = mbImpl->get_entities_by_dimension(_fileSet, 1, edges);
- ERRORR(rval, "Trouble getting edges in set.");
+ ERRORR(rval, "Trouble getting edges in current file set.");
- // Get faces in set
+ // Get faces
Range faces;
rval = mbImpl->get_entities_by_dimension(_fileSet, 2, faces);
- ERRORR(rval, "Trouble getting faces in set.");
+ ERRORR(rval, "Trouble getting faces in current file set.");
assert("Should only have a single face subrange, since they were read in one shot" &&
faces.psize() == 1);
@@ -1057,7 +1048,7 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset_allocate(std::vector<ReadNC:
if (isParallel) {
ParallelComm*& myPcomm = _readNC->myPcomm;
rval = myPcomm->filter_pstatus(faces, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &faces_owned);
- ERRORR(rval, "Trouble getting owned faces in set.");
+ ERRORR(rval, "Trouble getting owned faces in current file set.");
}
else
faces_owned = faces; // Not running in parallel, but still with MPI
@@ -1093,10 +1084,9 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset_allocate(std::vector<ReadNC:
range = &verts;
break;
case ReadNC::ENTLOCNSEDGE:
- ERRORR(MB_FAILURE, "Reading edge data not implemented yet.");
- break;
case ReadNC::ENTLOCEWEDGE:
- ERRORR(MB_FAILURE, "Reading edge data not implemented yet.");
+ case ReadNC::ENTLOCEDGE:
+ ERRORR(MB_NOT_IMPLEMENTED, "Reading edge data not implemented yet.");
break;
case ReadNC::ENTLOCFACE:
// Faces
@@ -1110,12 +1100,8 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset_allocate(std::vector<ReadNC:
range = &faces;
#endif
break;
- case ReadNC::ENTLOCSET:
- // Set
- break;
default:
- ERRORR(MB_FAILURE, "Unrecognized entity location type.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
@@ -1154,7 +1140,7 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset(std::vector<ReadNC::VarData>
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_scd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -1221,11 +1207,8 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset(std::vector<ReadNC::VarData>
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
diff --git a/src/io/NCHelper.hpp b/src/io/NCHelper.hpp
index 44d93b7..36f40f1 100644
--- a/src/io/NCHelper.hpp
+++ b/src/io/NCHelper.hpp
@@ -206,7 +206,7 @@ private:
protected:
//! This version takes as input the moab range, from which we actually need just the
//! size of each sequence, for a proper transpose of the data
- template <typename T> ErrorCode kji_to_jik_stride(size_t , size_t nj, size_t nk, void* dest, T* source, Range& localGid)
+ template <typename T> void kji_to_jik_stride(size_t , size_t nj, size_t nk, void* dest, T* source, Range& localGid)
{
std::size_t idxInSource = 0; // Position of the start of the stride
// For each subrange, we will transpose a matrix of size
@@ -222,7 +222,6 @@ protected:
tmp_data[idxInSource + j*nik + i*nk + k] = source[idxInSource + k*nij + j*size_range + i];
idxInSource += (size_range*nj*nk);
}
- return MB_SUCCESS;
}
//! Dimensions of global grid in file
diff --git a/src/io/NCHelperEuler.cpp b/src/io/NCHelperEuler.cpp
index 1f1e7a3..b2aa378 100644
--- a/src/io/NCHelperEuler.cpp
+++ b/src/io/NCHelperEuler.cpp
@@ -383,7 +383,7 @@ ErrorCode NCHelperEuler::init_mesh_vals()
case NC_DOUBLE:
break;
default:
- ERRORR(MB_FAILURE, "Unexpected data type for coordinate variable 'lon'");
+ ERRORR(MB_FAILURE, "Unexpected variable data type for 'lon'");
}
for (unsigned int i = 0; i != ijdimNames.size(); i++) {
diff --git a/src/io/NCHelperFV.cpp b/src/io/NCHelperFV.cpp
index a26ebe6..5f847e2 100644
--- a/src/io/NCHelperFV.cpp
+++ b/src/io/NCHelperFV.cpp
@@ -384,7 +384,7 @@ ErrorCode NCHelperFV::init_mesh_vals()
case NC_DOUBLE:
break;
default:
- ERRORR(MB_FAILURE, "Unexpected data type for coordinate variable 'lon'");
+ ERRORR(MB_FAILURE, "Unexpected variable data type for 'lon'");
}
for (unsigned int i = 0; i != ijdimNames.size(); i++) {
diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index d0bd7e3..f790736 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -179,19 +179,17 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
ErrorCode rval;
if (localGidVerts.empty()) {
- // Get all vertices from tmp_set (it is the input set in no_mesh scenario)
+ // Get all vertices from current file set (it is the input set in no_mesh scenario)
Range local_verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, local_verts);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local vertices in current file set.");
if (!local_verts.empty()) {
std::vector<int> gids(local_verts.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_verts, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of vertices.");
// Restore localGidVerts
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidVerts));
@@ -200,19 +198,17 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
}
if (localGidEdges.empty()) {
- // Get all edges from _fileSet (it is the input set in no_mesh scenario)
+ // Get all edges from current file set (it is the input set in no_mesh scenario)
Range local_edges;
rval = mbImpl->get_entities_by_dimension(_fileSet, 1, local_edges);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local edges in current file set.");
if (!local_edges.empty()) {
std::vector<int> gids(local_edges.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_edges, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of edges.");
// Restore localGidEdges
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidEdges));
@@ -221,19 +217,17 @@ ErrorCode NCHelperGCRM::check_existing_mesh()
}
if (localGidCells.empty()) {
- // Get all cells from tmp_set (it is the input set in no_mesh scenario)
+ // Get all cells from current file set (it is the input set in no_mesh scenario)
Range local_cells;
rval = mbImpl->get_entities_by_dimension(_fileSet, 2, local_cells);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local cells in current file set.");
if (!local_cells.empty()) {
std::vector<int> gids(local_cells.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_cells, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of cells.");
// Restore localGidCells
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidCells));
@@ -333,7 +327,7 @@ ErrorCode NCHelperGCRM::create_mesh(Range& faces)
success = NCFUNCAG(_vara_int)(_fileId, verticesOnCellVarId, read_starts, read_counts,
&(vertices_on_local_cells[indexInArray]));
#endif
- ERRORS(success, "Failed to read cell_corners data in a loop");
+ ERRORS(success, "Failed to read cell_corners data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * EDGES_PER_CELL;
@@ -414,22 +408,22 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
Range* range = NULL;
- // Get vertices in set
+ // Get vertices
Range verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
- ERRORR(rval, "Trouble getting vertices in set.");
+ ERRORR(rval, "Trouble getting vertices in current file set.");
assert("Should only have a single vertex subrange, since they were read in one shot" &&
verts.psize() == 1);
- // Get edges in set
+ // Get edges
Range edges;
rval = mbImpl->get_entities_by_dimension(_fileSet, 1, edges);
- ERRORR(rval, "Trouble getting edges in set.");
+ ERRORR(rval, "Trouble getting edges in current file set.");
- // Get faces in set
+ // Get faces
Range faces;
rval = mbImpl->get_entities_by_dimension(_fileSet, 2, faces);
- ERRORR(rval, "Trouble getting faces in set.");
+ ERRORR(rval, "Trouble getting faces in current file set.");
// Note, for GCRM faces.psize() can be more than 1
#ifdef USE_MPI
@@ -437,7 +431,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
if (isParallel) {
ParallelComm*& myPcomm = _readNC->myPcomm;
rval = myPcomm->filter_pstatus(faces, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &facesOwned);
- ERRORR(rval, "Trouble getting owned faces in set.");
+ ERRORR(rval, "Trouble getting owned faces in current file set.");
}
else
facesOwned = faces; // not running in parallel, but still with MPI
@@ -492,8 +486,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
range = &edges;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for GCRM non-set variable.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
// Finally: layers or other optional levels, it is possible that there is no
@@ -542,7 +535,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -564,8 +557,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
pLocalGid = &localGidEdges;
break;
default:
- ERRORR(MB_FAILURE, "Unrecognized entity location type.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
std::size_t sz = vdatas[i].sz;
@@ -581,16 +573,6 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -616,7 +598,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
success = NCFUNCREQG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]), &requests[idxReq++]);
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
@@ -633,11 +615,8 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
@@ -658,7 +637,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -680,8 +659,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
pLocalGid = &localGidEdges;
break;
default:
- ERRORR(MB_FAILURE, "Unrecognized entity location type.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
std::size_t sz = vdatas[i].sz;
@@ -691,16 +669,6 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -724,7 +692,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]));
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
@@ -738,11 +706,8 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
@@ -844,10 +809,10 @@ ErrorCode NCHelperGCRM::create_local_vertices(const std::vector<int>& vertices_o
(createGatherSet ? nLocalVertices + nVertices : nLocalVertices));
ERRORR(rval, "Failed to create local vertices.");
- // Add local vertices to the file set
+ // Add local vertices to current file set
Range local_verts_range(start_vertex, start_vertex + nLocalVertices - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_verts_range);
- ERRORR(rval, "Failed to add local vertices to the file set.");
+ ERRORR(rval, "Failed to add local vertices to current file set.");
// Get ptr to GID memory for local vertices
int count = 0;
@@ -918,7 +883,7 @@ ErrorCode NCHelperGCRM::create_local_vertices(const std::vector<int>& vertices_o
success = NCFUNCAG(_vara_double)(_fileId, xVertexVarId, &read_start, &read_count,
&(xptr[indexInArray]));
#endif
- ERRORS(success, "Failed to read grid_corner_lon data in a loop");
+ ERRORS(success, "Failed to read grid_corner_lon data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -955,7 +920,7 @@ ErrorCode NCHelperGCRM::create_local_vertices(const std::vector<int>& vertices_o
success = NCFUNCAG(_vara_double)(_fileId, yVertexVarId, &read_start, &read_count,
&(yptr[indexInArray]));
#endif
- ERRORS(success, "Failed to read grid_corner_lat data in a loop");
+ ERRORS(success, "Failed to read grid_corner_lat data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -1022,7 +987,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
success = NCFUNCAG(_vara_int)(_fileId, edgesOnCellVarId, read_starts, read_counts,
&(edges_on_local_cells[indexInArray]));
#endif
- ERRORS(success, "Failed to read cell_edges data in a loop");
+ ERRORS(success, "Failed to read cell_edges data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * EDGES_PER_CELL;
@@ -1052,12 +1017,12 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nLocalEdges, 2, MBEDGE, 0, start_edge, conn_arr_edges,
// Might have to create gather mesh later
(createGatherSet ? nLocalEdges + nEdges : nLocalEdges));
- ERRORR(rval, "Failed to create edges.");
+ ERRORR(rval, "Failed to create local edges.");
- // Add local edges to the file set
+ // Add local edges to current file set
Range local_edges_range(start_edge, start_edge + nLocalEdges - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_edges_range);
- ERRORR(rval, "Failed to add local edges to the file set.");
+ ERRORR(rval, "Failed to add local edges to current file set.");
// Get ptr to GID memory for edges
int count = 0;
@@ -1098,7 +1063,7 @@ ErrorCode NCHelperGCRM::create_local_edges(EntityHandle start_vertex)
success = NCFUNCAG(_vara_int)(_fileId, verticesOnEdgeVarId, read_starts, read_counts,
&(vertices_on_local_edges[indexInArray]));
#endif
- ERRORS(success, "Failed to read edge_corners data in a loop");
+ ERRORS(success, "Failed to read edge_corners data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * 2;
@@ -1136,13 +1101,13 @@ ErrorCode NCHelperGCRM::create_padded_local_cells(const std::vector<int>& vertic
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nLocalCells, EDGES_PER_CELL, MBPOLYGON, 0, start_element, conn_arr_local_cells,
// Might have to create gather mesh later
(createGatherSet ? nLocalCells + nCells : nLocalCells));
- ERRORR(rval, "Failed to create cells.");
+ ERRORR(rval, "Failed to create local cells.");
faces.insert(start_element, start_element + nLocalCells - 1);
- // Add local cells to the file set
+ // Add local cells to current file set
Range local_cells_range(start_element, start_element + nLocalCells - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_cells_range);
- ERRORR(rval, "Failed to add local cells to the file set.");
+ ERRORR(rval, "Failed to add local cells to current file set.");
// Get ptr to GID memory for local cells
int count = 0;
@@ -1179,7 +1144,7 @@ ErrorCode NCHelperGCRM::create_gather_set_vertices(EntityHandle gather_set, Enti
std::vector<double*> arrays;
// Don't need to specify allocation number here, because we know enough vertices were created before
ErrorCode rval = _readNC->readMeshIface->get_node_coords(3, nVertices, 0, gather_set_start_vertex, arrays);
- ERRORR(rval, "Failed to create vertices.");
+ ERRORR(rval, "Failed to create gather set vertices.");
// Add vertices to the gather set
Range gather_set_verts_range(gather_set_start_vertex, gather_set_start_vertex + nVertices - 1);
@@ -1269,7 +1234,7 @@ ErrorCode NCHelperGCRM::create_gather_set_edges(EntityHandle gather_set, EntityH
EntityHandle* conn_arr_gather_set_edges = NULL;
// Don't need to specify allocation number here, because we know enough edges were created before
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nEdges, 2, MBEDGE, 0, start_edge, conn_arr_gather_set_edges);
- ERRORR(rval, "Failed to create edges.");
+ ERRORR(rval, "Failed to create gather set edges.");
// Add edges to the gather set
Range gather_set_edges_range(start_edge, start_edge + nEdges - 1);
@@ -1319,7 +1284,7 @@ ErrorCode NCHelperGCRM::create_padded_gather_set_cells(EntityHandle gather_set,
EntityHandle* conn_arr_gather_set_cells = NULL;
// Don't need to specify allocation number here, because we know enough cells were created before
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nCells, EDGES_PER_CELL, MBPOLYGON, 0, start_element, conn_arr_gather_set_cells);
- ERRORR(rval, "Failed to create cells.");
+ ERRORR(rval, "Failed to create gather set cells.");
// Add cells to the gather set
Range gather_set_cells_range(start_element, start_element + nCells - 1);
diff --git a/src/io/NCHelperHOMME.cpp b/src/io/NCHelperHOMME.cpp
index 73f09c8..cef0771 100644
--- a/src/io/NCHelperHOMME.cpp
+++ b/src/io/NCHelperHOMME.cpp
@@ -179,7 +179,7 @@ ErrorCode NCHelperHOMME::init_mesh_vals()
ERRORR(rval, "Trouble reading 't' variable.");
}
else {
- // If expected time variable is not available, set dummy time coordinate values to tVals
+ // If expected time variable does not exist, set dummy values to tVals
for (int t = 0; t < nTimeSteps; t++)
tVals.push_back((double)t);
}
@@ -219,26 +219,22 @@ ErrorCode NCHelperHOMME::check_existing_mesh()
bool& noMesh = _readNC->noMesh;
if (noMesh && localGidVerts.empty()) {
- // We need to populate localGidVerts range with the gids of vertices from the tmp_set
+ // We need to populate localGidVerts range with the gids of vertices from current file set
// localGidVerts is important in reading the variable data into the nodes
- // also, for our purposes, localGidVerts is truly the GLOBAL_ID tag data, not other
+ // Also, for our purposes, localGidVerts is truly the GLOBAL_ID tag data, not other
// file_id tags that could get passed around in other scenarios for parallel reading
- // for nodal_partition, this local gid is easier, should be initialized with only
- // the owned nodes
- // We need to get all vertices from tmp_set (it is the input set in no_mesh scenario)
+ // Get all vertices from current file set (it is the input set in no_mesh scenario)
Range local_verts;
ErrorCode rval = mbImpl->get_entities_by_dimension(_fileSet, 0, local_verts);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local vertices in current file set.");
if (!local_verts.empty()) {
std::vector<int> gids(local_verts.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_verts, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of vertices.");
// Restore localGidVerts
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidVerts));
@@ -396,7 +392,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
MBQUAD, 0, start_quad, conn_arr,
// Might have to create gather mesh later
(create_gathers ? num_coarse_quads + num_quads : num_coarse_quads));
- ERRORR(rval, "Failed to create quads.");
+ ERRORR(rval, "Failed to create local quads.");
tmp_range.insert(start_quad, start_quad + num_coarse_quads - 1);
std::copy(&tmp_conn[start_idx], &tmp_conn[start_idx + 4 * num_fine_quads], conn_arr);
std::copy(conn_arr, conn_arr + 4 * num_fine_quads, range_inserter(localGidVerts));
@@ -418,7 +414,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
rval = _readNC->readMeshIface->get_node_coords(3, nLocalVertices, 0, start_vertex, arrays,
// Might have to create gather mesh later
(create_gathers ? nLocalVertices + nVertices : nLocalVertices));
- ERRORR(rval, "Couldn't create vertices in HOMME mesh.");
+ ERRORR(rval, "Failed to create local vertices.");
// Set vertex coordinates
Range::iterator rit;
@@ -450,7 +446,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
void* data;
int count;
rval = mbImpl->tag_iterate(mGlobalIdTag, vert_range.begin(), vert_range.end(), count, data);
- ERRORR(rval, "Failed to get tag iterator.");
+ ERRORR(rval, "Failed to iterate global id tag on local vertices.");
assert(count == nLocalVertices);
int* gid_data = (int*) data;
std::copy(localGidVerts.begin(), localGidVerts.end(), gid_data);
@@ -458,7 +454,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
// Duplicate global id data, which will be used to resolve sharing
if (mpFileIdTag) {
rval = mbImpl->tag_iterate(*mpFileIdTag, vert_range.begin(), vert_range.end(), count, data);
- ERRORR(rval, "Failed to get tag iterator on file id tag.");
+ ERRORR(rval, "Failed to iterate file id tag on local vertices.");
assert(count == nLocalVertices);
gid_data = (int*) data;
std::copy(localGidVerts.begin(), localGidVerts.end(), gid_data);
@@ -482,29 +478,29 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
}
}
- // Add new vertices and elements to the set
+ // Add new vertices and quads to current file set
faces.merge(tmp_range);
tmp_range.insert(start_vertex, start_vertex + nLocalVertices - 1);
rval = mbImpl->add_entities(_fileSet, tmp_range);
- ERRORR(rval, "Couldn't add new vertices and quads to file set.");
+ ERRORR(rval, "Failed to add new vertices and quads to current file set.");
// Mark the set with the spectral order
Tag sporder;
rval = mbImpl->tag_get_handle("SPECTRAL_ORDER", 1, MB_TYPE_INTEGER, sporder, MB_TAG_CREAT | MB_TAG_SPARSE);
- ERRORR(rval, "Couldn't create spectral order tag.");
+ ERRORR(rval, "Failed to get SPECTRAL_ORDER tag.");
rval = mbImpl->tag_set_data(sporder, &_fileSet, 1, &_spectralOrder);
- ERRORR(rval, "Couldn't set value for spectral order tag.");
+ ERRORR(rval, "Failed to set data for SPECTRAL_ORDER tag.");
if (create_gathers) {
EntityHandle gather_set;
rval = _readNC->readMeshIface->create_gather_set(gather_set);
- ERRORR(rval, "Trouble creating gather set.");
+ ERRORR(rval, "Failed to create gather set.");
// Create vertices
arrays.clear();
// Don't need to specify allocation number here, because we know enough verts were created before
rval = _readNC->readMeshIface->get_node_coords(3, nVertices, 0, start_vertex, arrays);
- ERRORR(rval, "Couldn't create vertices in HOMME mesh for gather set.");
+ ERRORR(rval, "Failed to create gather set vertices.");
xptr = arrays[0];
yptr = arrays[1];
@@ -520,38 +516,38 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
}
// Get ptr to gid memory for vertices
- Range gather_verts(start_vertex, start_vertex + nVertices - 1);
- rval = mbImpl->tag_iterate(mGlobalIdTag, gather_verts.begin(), gather_verts.end(), count, data);
- ERRORR(rval, "Failed to get tag iterator.");
+ Range gather_set_verts_range(start_vertex, start_vertex + nVertices - 1);
+ rval = mbImpl->tag_iterate(mGlobalIdTag, gather_set_verts_range.begin(), gather_set_verts_range.end(), count, data);
+ ERRORR(rval, "Failed to iterate global id tag on gather set vertices.");
assert(count == nVertices);
gid_data = (int*) data;
for (int j = 1; j <= nVertices; j++)
gid_data[j - 1] = j;
// Set the file id tag too, it should be bigger something not interfering with global id
if (mpFileIdTag) {
- rval = mbImpl->tag_iterate(*mpFileIdTag, gather_verts.begin(), gather_verts.end(), count, data);
- ERRORR(rval, "Failed to get tag iterator in file id tag.");
+ rval = mbImpl->tag_iterate(*mpFileIdTag, gather_set_verts_range.begin(), gather_set_verts_range.end(), count, data);
+ ERRORR(rval, "Failed to iterate file id tag on gather set vertices.");
assert(count == nVertices);
gid_data = (int*) data;
for (int j = 1; j <= nVertices; j++)
gid_data[j - 1] = nVertices + j; // bigger than global id tag
}
- rval = mbImpl->add_entities(gather_set, gather_verts);
- ERRORR(rval, "Couldn't add vertices to gather set.");
+ rval = mbImpl->add_entities(gather_set, gather_set_verts_range);
+ ERRORR(rval, "Failed to add vertices to the gather set.");
// Create quads
- Range gather_quads;
+ Range gather_set_quads_range;
// Don't need to specify allocation number here, because we know enough quads were created before
rval = _readNC->readMeshIface->get_element_connect(num_quads, 4,
MBQUAD, 0, start_quad, conn_arr);
- ERRORR(rval, "Failed to create quads.");
- gather_quads.insert(start_quad, start_quad + num_quads - 1);
+ ERRORR(rval, "Failed to create gather set quads.");
+ gather_set_quads_range.insert(start_quad, start_quad + num_quads - 1);
std::copy(&tmp_conn[0], &tmp_conn[4 * num_quads], conn_arr);
for (i = 0; i != 4 * num_quads; i++)
conn_arr[i] += start_vertex - 1; // Connectivity array is shifted by where the gather verts start
- rval = mbImpl->add_entities(gather_set, gather_quads);
- ERRORR(rval, "Couldn't add quads to gather set.");
+ rval = mbImpl->add_entities(gather_set, gather_set_quads_range);
+ ERRORR(rval, "Failed to add quads to the gather set.");
}
return MB_SUCCESS;
@@ -567,10 +563,10 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_allocate(std::vector<ReadN
Range* range = NULL;
- // Get vertices in set
+ // Get vertices
Range verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
- ERRORR(rval, "Trouble getting vertices in set.");
+ ERRORR(rval, "Trouble getting vertices in current file set.");
assert("Should only have a single vertex subrange, since they were read in one shot" &&
verts.psize() == 1);
@@ -604,8 +600,7 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_allocate(std::vector<ReadN
range = &verts;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for HOMME non-set variable.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
// Get variable size
@@ -645,7 +640,7 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_async(std::vector<ReadNC::
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -673,16 +668,6 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_async(std::vector<ReadNC::
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -708,7 +693,7 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_async(std::vector<ReadNC::
success = NCFUNCREQG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]), &requests[idxReq++]);
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
@@ -718,22 +703,19 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset_async(std::vector<ReadNC::
success = ncmpi_wait_all(_fileId, requests.size(), &requests[0], &statuss[0]);
ERRORS(success, "Failed on wait_all.");
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, ncol) to (ncol, lev)
- success = kji_to_jik_stride(ni, nj, nk, data, &tmpdoubledata[0], localGidVerts);
+ kji_to_jik_stride(ni, nj, nk, data, &tmpdoubledata[0], localGidVerts);
else {
for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
((double*) data)[idx] = tmpdoubledata[idx];
}
- ERRORS(success, "Failed to read double data.");
+
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
@@ -753,7 +735,7 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset(std::vector<ReadNC::VarDat
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -774,16 +756,6 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset(std::vector<ReadNC::VarDat
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -807,29 +779,26 @@ ErrorCode NCHelperHOMME::read_ucd_variables_to_nonset(std::vector<ReadNC::VarDat
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]));
- ERRORS(success, "Failed to read float data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
}
assert(ic == localGidVerts.psize());
- if (vdatas[i].numLev != 1)
+ if (vdatas[i].numLev > 1)
// Transpose (lev, ncol) to (ncol, lev)
- success = kji_to_jik_stride(ni, nj, nk, data, &tmpdoubledata[0], localGidVerts);
+ kji_to_jik_stride(ni, nj, nk, data, &tmpdoubledata[0], localGidVerts);
else {
for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
((double*) data)[idx] = tmpdoubledata[idx];
}
- ERRORS(success, "Failed to read double data.");
+
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 0e51a89..398184d 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -221,19 +221,17 @@ ErrorCode NCHelperMPAS::check_existing_mesh()
}
if (localGidVerts.empty()) {
- // Get all vertices from tmp_set (it is the input set in no_mesh scenario)
+ // Get all vertices from current file set (it is the input set in no_mesh scenario)
Range local_verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, local_verts);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local vertices in current file set.");
if (!local_verts.empty()) {
std::vector<int> gids(local_verts.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_verts, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of vertices.");
// Restore localGidVerts
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidVerts));
@@ -242,19 +240,17 @@ ErrorCode NCHelperMPAS::check_existing_mesh()
}
if (localGidEdges.empty()) {
- // Get all edges from _fileSet (it is the input set in no_mesh scenario)
+ // Get all edges from current file set (it is the input set in no_mesh scenario)
Range local_edges;
rval = mbImpl->get_entities_by_dimension(_fileSet, 1, local_edges);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local edges in current file set.");
if (!local_edges.empty()) {
std::vector<int> gids(local_edges.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_edges, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of edges.");
// Restore localGidEdges
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidEdges));
@@ -263,19 +259,17 @@ ErrorCode NCHelperMPAS::check_existing_mesh()
}
if (localGidCells.empty()) {
- // Get all cells from tmp_set (it is the input set in no_mesh scenario)
+ // Get all cells from current file set (it is the input set in no_mesh scenario)
Range local_cells;
rval = mbImpl->get_entities_by_dimension(_fileSet, 2, local_cells);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local cells in current file set.");
if (!local_cells.empty()) {
std::vector<int> gids(local_cells.size());
// !IMPORTANT : this has to be the GLOBAL_ID tag
rval = mbImpl->tag_get_data(mGlobalIdTag, local_cells, &gids[0]);
- if (MB_FAILURE == rval)
- return rval;
+ ERRORR(rval, "Trouble getting local gid values of cells.");
// Restore localGidCells
std::copy(gids.rbegin(), gids.rend(), range_inserter(localGidCells));
@@ -377,7 +371,7 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
success = NCFUNCAG(_vara_int)(_fileId, nEdgesOnCellVarId, &read_start, &read_count,
&(num_edges_on_local_cells[indexInArray]));
#endif
- ERRORS(success, "Failed to read nEdgesOnCell data in a loop");
+ ERRORS(success, "Failed to read nEdgesOnCell data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -434,7 +428,7 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
success = NCFUNCAG(_vara_int)(_fileId, verticesOnCellVarId, read_starts, read_counts,
&(vertices_on_local_cells[indexInArray]));
#endif
- ERRORS(success, "Failed to read verticesOnCell data in a loop");
+ ERRORS(success, "Failed to read verticesOnCell data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * maxEdgesPerCell;
@@ -526,22 +520,22 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
Range* range = NULL;
- // Get vertices in set
+ // Get vertices
Range verts;
rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
- ERRORR(rval, "Trouble getting vertices in set.");
+ ERRORR(rval, "Trouble getting vertices in current file set.");
assert("Should only have a single vertex subrange, since they were read in one shot" &&
verts.psize() == 1);
- // Get edges in set
+ // Get edges
Range edges;
rval = mbImpl->get_entities_by_dimension(_fileSet, 1, edges);
- ERRORR(rval, "Trouble getting edges in set.");
+ ERRORR(rval, "Trouble getting edges in current file set.");
- // Get faces in set
+ // Get faces
Range faces;
rval = mbImpl->get_entities_by_dimension(_fileSet, 2, faces);
- ERRORR(rval, "Trouble getting faces in set.");
+ ERRORR(rval, "Trouble getting faces in current file set.");
// Note, for MPAS faces.psize() can be more than 1
#ifdef USE_MPI
@@ -549,7 +543,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
if (isParallel) {
ParallelComm*& myPcomm = _readNC->myPcomm;
rval = myPcomm->filter_pstatus(faces, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &facesOwned);
- ERRORR(rval, "Trouble getting owned faces in set.");
+ ERRORR(rval, "Trouble getting owned faces in current file set.");
}
else
facesOwned = faces; // not running in parallel, but still with MPI
@@ -604,8 +598,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_allocate(std::vector<ReadNC
range = &edges;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for MPAS non-set variable.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
// Finally: nVertLevels or other optional levels, it is possible that there is no
@@ -661,7 +654,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -683,8 +676,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
pLocalGid = &localGidEdges;
break;
default:
- ERRORR(MB_FAILURE, "Unrecognized entity location type.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
std::size_t sz = vdatas[i].sz;
@@ -700,16 +692,6 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -735,7 +717,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
success = NCFUNCREQG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]), &requests[idxReq++]);
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
@@ -775,11 +757,8 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
@@ -801,7 +780,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
DebugOutput& dbgOut = _readNC->dbgOut;
ErrorCode rval = read_ucd_variables_to_nonset_allocate(vdatas, tstep_nums);
- ERRORR(rval, "Trouble allocating read variables.");
+ ERRORR(rval, "Trouble allocating space to read non-set variables.");
// Finally, read into that space
int success;
@@ -823,8 +802,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
pLocalGid = &localGidEdges;
break;
default:
- ERRORR(MB_FAILURE, "Unrecognized entity location type.");
- break;
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
std::size_t sz = vdatas[i].sz;
@@ -834,16 +812,6 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
vdatas[i].readStarts[0] = tstep_nums[t];
switch (vdatas[i].varDataType) {
- case NC_BYTE:
- case NC_CHAR: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
- case NC_SHORT:
- case NC_INT: {
- ERRORR(MB_FAILURE, "not implemented");
- break;
- }
case NC_FLOAT:
case NC_DOUBLE: {
// Read float as double
@@ -867,7 +835,7 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[0]), &(vdatas[i].readCounts[0]),
&(tmpdoubledata[indexInDoubleArray]));
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * 1 * vdatas[i].numLev;
@@ -904,11 +872,8 @@ ErrorCode NCHelperMPAS::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
break;
}
default:
- success = 1;
+ ERRORR(MB_FAILURE, "Unexpected variable data type.");
}
-
- if (success)
- ERRORR(MB_FAILURE, "Trouble reading variable.");
}
}
@@ -1003,10 +968,10 @@ ErrorCode NCHelperMPAS::create_local_vertices(const std::vector<int>& vertices_o
(createGatherSet ? nLocalVertices + nVertices : nLocalVertices));
ERRORR(rval, "Failed to create local vertices.");
- // Add local vertices to the file set
+ // Add local vertices to current file set
Range local_verts_range(start_vertex, start_vertex + nLocalVertices - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_verts_range);
- ERRORR(rval, "Failed to add local vertices to the file set.");
+ ERRORR(rval, "Failed to add local vertices to current file set.");
// Get ptr to GID memory for local vertices
int count = 0;
@@ -1055,7 +1020,7 @@ ErrorCode NCHelperMPAS::create_local_vertices(const std::vector<int>& vertices_o
success = NCFUNCAG(_vara_double)(_fileId, xVertexVarId, &read_start, &read_count,
&(xptr[indexInArray]));
#endif
- ERRORS(success, "Failed to read xVertex data in a loop");
+ ERRORS(success, "Failed to read xVertex data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -1092,7 +1057,7 @@ ErrorCode NCHelperMPAS::create_local_vertices(const std::vector<int>& vertices_o
success = NCFUNCAG(_vara_double)(_fileId, yVertexVarId, &read_start, &read_count,
&(yptr[indexInArray]));
#endif
- ERRORS(success, "Failed to read yVertex data in a loop");
+ ERRORS(success, "Failed to read yVertex data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -1129,7 +1094,7 @@ ErrorCode NCHelperMPAS::create_local_vertices(const std::vector<int>& vertices_o
success = NCFUNCAG(_vara_double)(_fileId, zVertexVarId, &read_start, &read_count,
&(zptr[indexInArray]));
#endif
- ERRORS(success, "Failed to read zVertex data in a loop");
+ ERRORS(success, "Failed to read zVertex data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1);
@@ -1181,7 +1146,7 @@ ErrorCode NCHelperMPAS::create_local_edges(EntityHandle start_vertex, const std:
success = NCFUNCAG(_vara_int)(_fileId, edgesOnCellVarId, read_starts, read_counts,
&(edges_on_local_cells[indexInArray]));
#endif
- ERRORS(success, "Failed to read edgesOnCell data in a loop");
+ ERRORS(success, "Failed to read edgesOnCell data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * maxEdgesPerCell;
@@ -1219,10 +1184,10 @@ ErrorCode NCHelperMPAS::create_local_edges(EntityHandle start_vertex, const std:
(createGatherSet ? nLocalEdges + nEdges : nLocalEdges));
ERRORR(rval, "Failed to create edges.");
- // Add local edges to the file set
+ // Add local edges to current file set
Range local_edges_range(start_edge, start_edge + nLocalEdges - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_edges_range);
- ERRORR(rval, "Failed to add local edges to the file set.");
+ ERRORR(rval, "Failed to add local edges to current file set.");
// Get ptr to GID memory for edges
int count = 0;
@@ -1263,7 +1228,7 @@ ErrorCode NCHelperMPAS::create_local_edges(EntityHandle start_vertex, const std:
success = NCFUNCAG(_vara_int)(_fileId, verticesOnEdgeVarId, read_starts, read_counts,
&(vertices_on_local_edges[indexInArray]));
#endif
- ERRORS(success, "Failed to read verticesOnEdge data in a loop");
+ ERRORS(success, "Failed to read verticesOnEdge data in a loop.");
// Increment the index for next subrange
indexInArray += (endh - starth + 1) * 2;
@@ -1319,13 +1284,13 @@ ErrorCode NCHelperMPAS::create_local_cells(const std::vector<int>& vertices_on_l
EntityHandle start_element;
ErrorCode rval = _readNC->readMeshIface->get_element_connect(num_group_cells, num_edges_per_cell, MBPOLYGON, 0, start_element,
conn_arr_local_cells_with_n_edges[num_edges_per_cell], num_group_cells);
- ERRORR(rval, "Failed to create cells");
+ ERRORR(rval, "Failed to create local cells");
faces.insert(start_element, start_element + num_group_cells - 1);
- // Add local cells to the file set
+ // Add local cells to current file set
Range local_cells_range(start_element, start_element + num_group_cells - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_cells_range);
- ERRORR(rval, "Failed to add local cells to the file set.");
+ ERRORR(rval, "Failed to add local cells to current file set.");
// Get ptr to gid memory for local cells
int count = 0;
@@ -1375,13 +1340,13 @@ ErrorCode NCHelperMPAS::create_padded_local_cells(const std::vector<int>& vertic
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nLocalCells, maxEdgesPerCell, MBPOLYGON, 0, start_element, conn_arr_local_cells,
// Might have to create gather mesh later
(createGatherSet ? nLocalCells + nCells : nLocalCells));
- ERRORR(rval, "Failed to create cells.");
+ ERRORR(rval, "Failed to create local cells.");
faces.insert(start_element, start_element + nLocalCells - 1);
- // Add local cells to the file set
+ // Add local cells to current file set
Range local_cells_range(start_element, start_element + nLocalCells - 1);
rval = _readNC->mbImpl->add_entities(_fileSet, local_cells_range);
- ERRORR(rval, "Failed to add local cells to the file set.");
+ ERRORR(rval, "Failed to add local cells to current file set.");
// Get ptr to GID memory for local cells
int count = 0;
@@ -1417,7 +1382,7 @@ ErrorCode NCHelperMPAS::create_gather_set_vertices(EntityHandle gather_set, Enti
std::vector<double*> arrays;
// Don't need to specify allocation number here, because we know enough vertices were created before
ErrorCode rval = _readNC->readMeshIface->get_node_coords(3, nVertices, 0, gather_set_start_vertex, arrays);
- ERRORR(rval, "Failed to create vertices.");
+ ERRORR(rval, "Failed to create gather set vertices.");
// Add vertices to the gather set
Range gather_set_verts_range(gather_set_start_vertex, gather_set_start_vertex + nVertices - 1);
@@ -1512,7 +1477,7 @@ ErrorCode NCHelperMPAS::create_gather_set_edges(EntityHandle gather_set, EntityH
EntityHandle* conn_arr_gather_set_edges = NULL;
// Don't need to specify allocation number here, because we know enough edges were created before
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nEdges, 2, MBEDGE, 0, start_edge, conn_arr_gather_set_edges);
- ERRORR(rval, "Failed to create edges.");
+ ERRORR(rval, "Failed to create gather set edges.");
// Add edges to the gather set
Range gather_set_edges_range(start_edge, start_edge + nEdges - 1);
@@ -1613,7 +1578,7 @@ ErrorCode NCHelperMPAS::create_gather_set_cells(EntityHandle gather_set, EntityH
EntityHandle start_element;
ErrorCode rval = _readNC->readMeshIface->get_element_connect(num_group_cells, num_edges_per_cell, MBPOLYGON, 0, start_element,
conn_arr_gather_set_cells_with_n_edges[num_edges_per_cell], num_group_cells);
- ERRORR(rval, "Failed to create cells.");
+ ERRORR(rval, "Failed to create gather set cells.");
// Add cells to the gather set
Range gather_set_cells_range(start_element, start_element + num_group_cells - 1);
@@ -1668,7 +1633,7 @@ ErrorCode NCHelperMPAS::create_padded_gather_set_cells(EntityHandle gather_set,
EntityHandle* conn_arr_gather_set_cells = NULL;
// Don't need to specify allocation number here, because we know enough cells were created before
ErrorCode rval = _readNC->readMeshIface->get_element_connect(nCells, maxEdgesPerCell, MBPOLYGON, 0, start_element, conn_arr_gather_set_cells);
- ERRORR(rval, "Failed to create cells.");
+ ERRORR(rval, "Failed to create gather set cells.");
// Add cells to the gather set
Range gather_set_cells_range(start_element, start_element + nCells - 1);
diff --git a/src/io/NCWriteGCRM.cpp b/src/io/NCWriteGCRM.cpp
index b80d90a..16e4872 100644
--- a/src/io/NCWriteGCRM.cpp
+++ b/src/io/NCWriteGCRM.cpp
@@ -75,7 +75,7 @@ ErrorCode NCWriteGCRM::collect_mesh_info()
unsigned int num_local_verts = localVertsOwned.size();
#endif
rval = myPcomm->filter_pstatus(localVertsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned vertices in set.");
+ ERRORR(rval, "Trouble getting owned vertices in current file set.");
// Assume that PARALLEL_RESOLVE_SHARED_ENTS option is set
// Verify that not all local vertices are owned by the last processor
@@ -84,11 +84,11 @@ ErrorCode NCWriteGCRM::collect_mesh_info()
if (!localEdgesOwned.empty()) {
rval = myPcomm->filter_pstatus(localEdgesOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned edges in set.");
+ ERRORR(rval, "Trouble getting owned edges in current file set.");
}
rval = myPcomm->filter_pstatus(localCellsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned cells in set.");
+ ERRORR(rval, "Trouble getting owned cells in current file set.");
}
}
#endif
@@ -217,7 +217,7 @@ ErrorCode NCWriteGCRM::collect_variable_data(std::vector<std::string>& var_names
currentVarData.writeCounts[dim_idx] = localGidEdgesOwned.size();
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for GCRM non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
dim_idx++;
@@ -283,7 +283,7 @@ ErrorCode NCWriteGCRM::write_nonset_variables(std::vector<WriteNC::VarData>& vda
pLocalGidEntsOwned = &localGidCellsOwned;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for GCRM non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
unsigned int num_timesteps;
@@ -356,7 +356,7 @@ ErrorCode NCWriteGCRM::write_nonset_variables(std::vector<WriteNC::VarData>& vda
&(variableData.writeStarts[0]), &(variableData.writeCounts[0]),
&(tag_data[indexInDoubleArray]));
#endif
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * num_lev;
diff --git a/src/io/NCWriteHOMME.cpp b/src/io/NCWriteHOMME.cpp
index 3dd61c1..2a4291b 100644
--- a/src/io/NCWriteHOMME.cpp
+++ b/src/io/NCWriteHOMME.cpp
@@ -63,7 +63,7 @@ ErrorCode NCWriteHOMME::collect_mesh_info()
unsigned int num_local_verts = localVertsOwned.size();
#endif
rval = myPcomm->filter_pstatus(localVertsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned vertices in set.");
+ ERRORR(rval, "Trouble getting owned vertices in current set.");
// Assume that PARALLEL_RESOLVE_SHARED_ENTS option is set
// Verify that not all local vertices are owned by the last processor
@@ -158,7 +158,7 @@ ErrorCode NCWriteHOMME::collect_variable_data(std::vector<std::string>& var_name
currentVarData.writeCounts[dim_idx] = localGidVertsOwned.size();
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for HOMME non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
dim_idx++;
@@ -188,7 +188,7 @@ ErrorCode NCWriteHOMME::write_nonset_variables(std::vector<WriteNC::VarData>& vd
// Vertices
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for HOMME non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
unsigned int num_timesteps;
@@ -272,7 +272,7 @@ ErrorCode NCWriteHOMME::write_nonset_variables(std::vector<WriteNC::VarData>& vd
&(variableData.writeStarts[0]), &(variableData.writeCounts[0]),
&(tmpdoubledata[indexInDoubleArray]));
#endif
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * num_lev;
diff --git a/src/io/NCWriteHelper.cpp b/src/io/NCWriteHelper.cpp
index ee6e7aa..3111a72 100644
--- a/src/io/NCWriteHelper.cpp
+++ b/src/io/NCWriteHelper.cpp
@@ -632,7 +632,7 @@ ErrorCode ScdNCWriteHelper::collect_mesh_info()
int procs = myPcomm->proc_config().proc_size();
if (procs > 1) {
rval = myPcomm->filter_pstatus(localCellsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned faces in set.");
+ ERRORR(rval, "Trouble getting owned faces in current file set.");
}
}
#endif
@@ -715,7 +715,7 @@ ErrorCode ScdNCWriteHelper::collect_variable_data(std::vector<std::string>& var_
currentVarData.writeCounts[dim_idx + 1] = lCDims[3] - lCDims[0] + 1;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for structured mesh non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
dim_idx += 2;
@@ -747,7 +747,7 @@ ErrorCode ScdNCWriteHelper::write_nonset_variables(std::vector<WriteNC::VarData>
// Faces
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for structured mesh non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
unsigned int num_timesteps;
diff --git a/src/io/NCWriteMPAS.cpp b/src/io/NCWriteMPAS.cpp
index 512c1d5..45f0cec 100644
--- a/src/io/NCWriteMPAS.cpp
+++ b/src/io/NCWriteMPAS.cpp
@@ -75,7 +75,7 @@ ErrorCode NCWriteMPAS::collect_mesh_info()
unsigned int num_local_verts = localVertsOwned.size();
#endif
rval = myPcomm->filter_pstatus(localVertsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned vertices in set.");
+ ERRORR(rval, "Trouble getting owned vertices in current file set.");
// Assume that PARALLEL_RESOLVE_SHARED_ENTS option is set
// Verify that not all local vertices are owned by the last processor
@@ -84,11 +84,11 @@ ErrorCode NCWriteMPAS::collect_mesh_info()
if (!localEdgesOwned.empty()) {
rval = myPcomm->filter_pstatus(localEdgesOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned edges in set.");
+ ERRORR(rval, "Trouble getting owned edges in current file set.");
}
rval = myPcomm->filter_pstatus(localCellsOwned, PSTATUS_NOT_OWNED, PSTATUS_NOT);
- ERRORR(rval, "Trouble getting owned cells in set.");
+ ERRORR(rval, "Trouble getting owned cells in current file set.");
}
}
#endif
@@ -229,7 +229,7 @@ ErrorCode NCWriteMPAS::collect_variable_data(std::vector<std::string>& var_names
currentVarData.writeCounts[dim_idx] = localGidEdgesOwned.size();
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for MPAS non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
dim_idx++;
@@ -295,7 +295,7 @@ ErrorCode NCWriteMPAS::write_nonset_variables(std::vector<WriteNC::VarData>& vda
pLocalGidEntsOwned = &localGidCellsOwned;
break;
default:
- ERRORR(MB_FAILURE, "Unexpected entity location type for MPAS non-set variable.");
+ ERRORR(MB_FAILURE, "Unexpected entity location type.");
}
unsigned int num_timesteps;
@@ -368,7 +368,7 @@ ErrorCode NCWriteMPAS::write_nonset_variables(std::vector<WriteNC::VarData>& vda
&(variableData.writeStarts[0]), &(variableData.writeCounts[0]),
&(tag_data[indexInDoubleArray]));
#endif
- ERRORS(success, "Failed to read double data in loop");
+ ERRORS(success, "Failed to read double data in a loop.");
// We need to increment the index in double array for the
// next subrange
indexInDoubleArray += (endh - starth + 1) * num_lev;
diff --git a/src/io/ReadNC.cpp b/src/io/ReadNC.cpp
index 4543b64..64d67ab 100644
--- a/src/io/ReadNC.cpp
+++ b/src/io/ReadNC.cpp
@@ -84,7 +84,7 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
// Make sure there's a file set to put things in
EntityHandle tmp_set;
if (noMesh && !file_set) {
- ERRORR(MB_FAILURE, "NOMESH option requires non-NULL file set on input.\n");
+ ERRORR(MB_FAILURE, "NOMESH option requires non-NULL file set on input.");
}
else if (!file_set || (file_set && *file_set == 0)) {
rval = mbImpl->create_meshset(MESHSET_SET, tmp_set);
@@ -115,7 +115,7 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
// Check existing mesh from last read
if (noMesh && !noVars) {
rval = myHelper->check_existing_mesh();
- ERRORR(rval, "Trouble checking mesh from last read.\n");
+ ERRORR(rval, "Trouble checking mesh from last read.");
}
// Create some conventional tags, e.g. __NUM_DIMS
@@ -194,7 +194,7 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
Range verts;
rval = mbImpl->get_connectivity(faces, verts);
- ERRORR(rval, "Couldn't get verts of faces");
+ ERRORR(rval, "Couldn't get verts of faces.");
rval = mbImpl->add_entities(partn_set, verts);
ERRORR(rval, "Couldn't add new verts to partition set.");
@@ -296,7 +296,7 @@ ErrorCode ReadNC::parse_options(const FileOptions& opts, std::vector<std::string
}
#ifdef USE_MPI
- isParallel = (opts.match_option("PARALLEL","READ_PART") != MB_ENTITY_NOT_FOUND);
+ isParallel = (opts.match_option("PARALLEL", "READ_PART") != MB_ENTITY_NOT_FOUND);
if (!isParallel)
// Return success here, since rval still has _NOT_FOUND from not finding option
@@ -306,7 +306,7 @@ ErrorCode ReadNC::parse_options(const FileOptions& opts, std::vector<std::string
int pcomm_no = 0;
rval = opts.get_int_option("PARALLEL_COMM", pcomm_no);
- if (rval == MB_TYPE_OUT_OF_RANGE) {
+ if (MB_TYPE_OUT_OF_RANGE == rval) {
readMeshIface->report_error("Invalid value for PARALLEL_COMM option");
return rval;
}
@@ -319,11 +319,11 @@ ErrorCode ReadNC::parse_options(const FileOptions& opts, std::vector<std::string
int dum;
rval = opts.match_option("PARTITION_METHOD", ScdParData::PartitionMethodNames, dum);
- if (rval == MB_FAILURE) {
- readMeshIface->report_error("Unknown partition method specified.");
- partMethod = ScdParData::ALLJORKORI;
+ if (MB_FAILURE == rval) {
+ readMeshIface->report_error("Unknown partition method specified");
+ return rval;
}
- else if (rval == MB_ENTITY_NOT_FOUND)
+ else if (MB_ENTITY_NOT_FOUND == rval)
partMethod = ScdParData::ALLJORKORI;
else
partMethod = dum;
@@ -344,17 +344,17 @@ ErrorCode ReadNC::read_header()
// Read attributes into globalAtts
ErrorCode result = get_attributes(NC_GLOBAL, numgatts, globalAtts);
- ERRORR(result, "Getting attributes.");
+ ERRORR(result, "Trouble getting attributes.");
dbgOut.tprintf(1, "Read %u attributes\n", (unsigned int) globalAtts.size());
// Read in dimensions into dimNames and dimLens
result = get_dimensions(fileId, dimNames, dimLens);
- ERRORR(result, "Getting dimensions.");
+ ERRORR(result, "Trouble getting dimensions.");
dbgOut.tprintf(1, "Read %u dimensions\n", (unsigned int) dimNames.size());
// Read in variables into varInfo
result = get_variables();
- ERRORR(result, "Getting variables.");
+ ERRORR(result, "Trouble getting variables.");
dbgOut.tprintf(1, "Read %u variables\n", (unsigned int) varInfo.size());
return MB_SUCCESS;
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list