[MOAB-dev] commit/MOAB: danwu: Some minor changes to NCFUNC macros used in ReadNC code.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Aug 23 12:16:36 CDT 2013
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/260187f270f0/
Changeset: 260187f270f0
Branch: master
User: danwu
Date: 2013-08-23 19:16:15
Summary: Some minor changes to NCFUNC macros used in ReadNC code.
Affected #: 3 files
diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 0fca661..b013472 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -316,7 +316,6 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
// Finally, read into that space
int success;
- std::vector<int> requests(vdatas.size() * tstep_nums.size()), statuss(vdatas.size() * tstep_nums.size());
for (unsigned int i = 0; i < vdatas.size(); i++) {
if (dummyVarNames.find(vdatas[i].varName) != dummyVarNames.end() )
continue; // This is a dummy one, we don't have it; we created it for the dummy tag
@@ -327,28 +326,28 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
case NC_BYTE:
case NC_CHAR:
success = NCFUNCAG(_vara_text)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- (char*) data NCREQ);
+ (char*) data);
ERRORS(success, "Failed to read char data.");
break;
case NC_DOUBLE:
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- (double*) data NCREQ);
+ (double*) data);
ERRORS(success, "Failed to read double data.");
break;
case NC_FLOAT: {
success = NCFUNCAG(_vara_float)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- (float*) data NCREQ);
+ (float*) data);
ERRORS(success, "Failed to read float data.");
break;
}
case NC_INT:
success = NCFUNCAG(_vara_int)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- (int*) data NCREQ);
+ (int*) data);
ERRORS(success, "Failed to read int data.");
break;
case NC_SHORT:
success = NCFUNCAG(_vara_short)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- (short*) data NCREQ);
+ (short*) data);
ERRORS(success, "Failed to read short data.");
break;
default:
@@ -362,11 +361,6 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
}
}
-#ifdef NCWAIT
- int success = ncmpi_wait_all(fileId, requests.size(), &requests[0], &statuss[0]);
- ERRORS(success, "Failed on wait_all.");
-#endif
-
for (unsigned int i = 0; i < vdatas.size(); i++) {
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
@@ -501,13 +495,13 @@ 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 = NCFUNCA(get_vars_double)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &cvals[0]);
+ fail = NCFUNCAG(_vars_double)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &cvals[0]);
if (fail)
ERRORS(MB_FAILURE, "Failed to get coordinate values.");
}
else if (NC_FLOAT == (*vmit).second.varDataType) {
std::vector<float> tcvals(tcount);
- fail = NCFUNCA(get_vars_float)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &tcvals[0]);
+ fail = NCFUNCAG(_vars_float)(_fileId, (*vmit).second.varId, &tstart, &tcount, &dum_stride, &tcvals[0]);
if (fail)
ERRORS(MB_FAILURE, "Failed to get coordinate values.");
std::copy(tcvals.begin(), tcvals.end(), cvals.begin());
@@ -1152,7 +1146,6 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
// Finally, read into that space
int success;
- std::vector<int> requests(vdatas.size() * tstep_nums.size()), statuss(vdatas.size() * tstep_nums.size());
for (unsigned int i = 0; i < vdatas.size(); i++) {
std::size_t sz = vdatas[i].sz;
@@ -1167,7 +1160,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
case NC_CHAR: {
std::vector<char> tmpchardata(sz);
success = NCFUNCAG(_vara_text)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- &tmpchardata[0] NCREQ);
+ &tmpchardata[0]);
if (vdatas[i].numLev != 1)
// Switch from k varying slowest to k varying fastest
success = kji_to_jik(ni, nj, nk, data, &tmpchardata[0]);
@@ -1181,7 +1174,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
case NC_DOUBLE: {
std::vector<double> tmpdoubledata(sz);
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- &tmpdoubledata[0] NCREQ);
+ &tmpdoubledata[0]);
if (vdatas[i].numLev != 1)
// Switch from k varying slowest to k varying fastest
success = kji_to_jik(ni, nj, nk, data, &tmpdoubledata[0]);
@@ -1195,7 +1188,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
case NC_FLOAT: {
std::vector<float> tmpfloatdata(sz);
success = NCFUNCAG(_vara_float)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- &tmpfloatdata[0] NCREQ);
+ &tmpfloatdata[0]);
if (vdatas[i].numLev != 1)
// Switch from k varying slowest to k varying fastest
success = kji_to_jik(ni, nj, nk, data, &tmpfloatdata[0]);
@@ -1209,7 +1202,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
case NC_INT: {
std::vector<int> tmpintdata(sz);
success = NCFUNCAG(_vara_int)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- &tmpintdata[0] NCREQ);
+ &tmpintdata[0]);
if (vdatas[i].numLev != 1)
// Switch from k varying slowest to k varying fastest
success = kji_to_jik(ni, nj, nk, data, &tmpintdata[0]);
@@ -1223,7 +1216,7 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
case NC_SHORT: {
std::vector<short> tmpshortdata(sz);
success = NCFUNCAG(_vara_short)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[t][0], &vdatas[i].readCounts[t][0],
- &tmpshortdata[0] NCREQ);
+ &tmpshortdata[0]);
if (vdatas[i].numLev != 1)
// Switch from k varying slowest to k varying fastest
success = kji_to_jik(ni, nj, nk, data, &tmpshortdata[0]);
@@ -1243,11 +1236,6 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
}
}
-#ifdef NCWAIT
- int success = ncmpi_wait_all(fileId, requests.size(), &requests[0], &statuss[0]);
- ERRORS(success, "Failed on wait_all.");
-#endif
-
for (unsigned int i = 0; i < vdatas.size(); i++) {
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
diff --git a/src/io/NCHelperHOMME.cpp b/src/io/NCHelperHOMME.cpp
index aabdbde..deccdfb 100644
--- a/src/io/NCHelperHOMME.cpp
+++ b/src/io/NCHelperHOMME.cpp
@@ -285,7 +285,7 @@ ErrorCode NCHelperHOMME::create_mesh(Range& faces)
ERRORS(success, "Failed to get variable id.");
NCDF_SIZE tmp_starts[2] = {0, 0}, tmp_counts[2] = {4, static_cast<size_t>(num_quads)};
std::vector<int> tmp_conn(4 * num_quads), tmp_conn2(4 * num_quads);
- success = NCFUNCAG(_vara_int)(connectId, cornerVarId, tmp_starts, tmp_counts, &tmp_conn2[0] NCREQ);
+ success = NCFUNCAG(_vara_int)(connectId, cornerVarId, tmp_starts, tmp_counts, &tmp_conn2[0]);
ERRORS(success, "Failed to get temporary connectivity.");
success = NCFUNC(close)(connectId);
ERRORS(success, "Failed on close.");
@@ -700,9 +700,9 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_async(std::vector<ReadNC::V
// Do a partial read, in each subrange
// wait outside this loop
- success = NCFUNCAG2(_vara_double)(_fileId, vdatas[i].varId,
+ success = NCFUNCREQG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpdoubledata[indexInDoubleArray]) NCREQ2);
+ &(tmpdoubledata[indexInDoubleArray]), &requests[idxReq++]);
ERRORS(success, "Failed to read double data in loop");
// We need to increment the index in double array for the
// next subrange
@@ -746,9 +746,9 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_async(std::vector<ReadNC::V
// Do a partial read, in each subrange
// wait outside this loop
- success = NCFUNCAG2(_vara_float)(_fileId, vdatas[i].varId,
+ success = NCFUNCREQG(_vara_float)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpfloatdata[indexInFloatArray]) NCREQ2);
+ &(tmpfloatdata[indexInFloatArray]), &requests[idxReq++]);
ERRORS(success, "Failed to read float data in loop");
// We need to increment the index in float array for the
// next subrange
@@ -814,7 +814,6 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData
// Finally, read into that space
int success;
- std::vector<int> requests(vdatas.size() * tstep_nums.size()), statuss(vdatas.size() * tstep_nums.size());
for (unsigned int i = 0; i < vdatas.size(); i++) {
std::size_t sz = vdatas[i].sz;
@@ -854,7 +853,7 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpdoubledata[indexInDoubleArray]) NCREQ);
+ &(tmpdoubledata[indexInDoubleArray]));
ERRORS(success, "Failed to read float data in loop");
// We need to increment the index in double array for the
// next subrange
@@ -895,7 +894,7 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData
success = NCFUNCAG(_vara_float)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpfloatdata[indexInFloatArray]) NCREQ);
+ &(tmpfloatdata[indexInFloatArray]));
ERRORS(success, "Failed to read float data in loop");
// We need to increment the index in float array for the
// next subrange
@@ -930,11 +929,6 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData
}
}
-#ifdef NCWAIT
- int success = ncmpi_wait_all(fileId, requests.size(), &requests[0], &statuss[0]);
- ERRORS(success, "Failed on wait_all.");
-#endif
-
for (unsigned int i = 0; i < vdatas.size(); i++) {
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index eedb525..9825d86 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -149,7 +149,7 @@ ErrorCode NCHelperMPAS::init_mesh_vals()
NCDF_SIZE tmp_starts[2] = {0, 0};
NCDF_SIZE tmp_counts[2] = {static_cast<size_t>(nEdges), 2};
verticesOnEdge.resize(nEdges * 2);
- success = NCFUNCAG(_vara_int)(_fileId, verticesOnEdgeVarId, tmp_starts, tmp_counts, &verticesOnEdge[0] NCREQ);
+ success = NCFUNCAG(_vara_int)(_fileId, verticesOnEdgeVarId, tmp_starts, tmp_counts, &verticesOnEdge[0]);
ERRORS(success, "Failed to read variable values of verticesOnEdge.");
// Determine the entity location type of a variable
@@ -300,7 +300,7 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
NCDF_SIZE tmp_starts_1[1] = {static_cast<size_t>(start_cell_idx - 1)};
NCDF_SIZE tmp_counts_1[1] = {static_cast<size_t>(nLocalCells)};
std::vector<int> num_edges_on_cell(nLocalCells);
- success = NCFUNCAG(_vara_int)(_fileId, nEdgesOnCellVarId, tmp_starts_1, tmp_counts_1, &num_edges_on_cell[0] NCREQ);
+ success = NCFUNCAG(_vara_int)(_fileId, nEdgesOnCellVarId, tmp_starts_1, tmp_counts_1, &num_edges_on_cell[0]);
ERRORS(success, "Failed to read variable values of nEdgesOnCell.");
// Read vertices on each cell (connectivity)
@@ -310,7 +310,7 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
NCDF_SIZE tmp_starts_2[2] = {static_cast<size_t>(start_cell_idx - 1), 0};
NCDF_SIZE tmp_counts_2[2] = {static_cast<size_t>(nLocalCells), maxCellEdges};
std::vector<int> vertices_on_cell(nLocalCells * maxCellEdges);
- success = NCFUNCAG(_vara_int)(_fileId, verticesOnCellVarId, tmp_starts_2, tmp_counts_2, &vertices_on_cell[0] NCREQ);
+ success = NCFUNCAG(_vara_int)(_fileId, verticesOnCellVarId, tmp_starts_2, tmp_counts_2, &vertices_on_cell[0]);
ERRORS(success, "Failed to read variable values of verticesOnCell.");
// Read edges on each cell
@@ -320,7 +320,7 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
NCDF_SIZE tmp_starts_3[2] = {static_cast<size_t>(start_cell_idx - 1), 0};
NCDF_SIZE tmp_counts_3[2] = {static_cast<size_t>(nLocalCells), maxCellEdges};
std::vector<int> edges_on_cell(nLocalCells * maxCellEdges);
- success = NCFUNCAG(_vara_int)(_fileId, edgesOnCellVarId, tmp_starts_3, tmp_counts_3, &edges_on_cell[0] NCREQ);
+ success = NCFUNCAG(_vara_int)(_fileId, edgesOnCellVarId, tmp_starts_3, tmp_counts_3, &edges_on_cell[0]);
ERRORS(success, "Failed to read variable values of edgesOnCell.");
// Divide cells into groups based on the number of edges
@@ -746,9 +746,9 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_async(std::vector<ReadNC::Va
// Do a partial read, in each subrange
// wait outside this loop
- success = NCFUNCAG2(_vara_double)(_fileId, vdatas[i].varId,
+ success = NCFUNCREQG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpdoubledata[indexInDoubleArray]) NCREQ2);
+ &(tmpdoubledata[indexInDoubleArray]), &requests[idxReq++]);
ERRORS(success, "Failed to read double data in loop");
// We need to increment the index in double array for the
// next subrange
@@ -839,7 +839,6 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>
int success;
Range* pLocalGid = NULL;
- std::vector<int> requests(vdatas.size() * tstep_nums.size()), statuss(vdatas.size() * tstep_nums.size());
for (unsigned int i = 0; i < vdatas.size(); i++) {
switch (vdatas[i].entLoc) {
case ReadNC::ENTLOCVERT:
@@ -889,7 +888,7 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>
success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId,
&(vdatas[i].readStarts[t][0]), &(vdatas[i].readCounts[t][0]),
- &(tmpdoubledata[indexInDoubleArray]) NCREQ);
+ &(tmpdoubledata[indexInDoubleArray]));
ERRORS(success, "Failed to read double data in loop");
// We need to increment the index in double array for the
// next subrange
@@ -946,11 +945,6 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>
}
}
-#ifdef NCWAIT
- int success = ncmpi_wait_all(fileId, requests.size(), &requests[0], &statuss[0]);
- ERRORS(success, "Failed on wait_all.");
-#endif
-
for (unsigned int i = 0; i < vdatas.size(); i++) {
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
dbgOut.tprintf(2, "Converting variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
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