[MOAB-dev] commit/MOAB: danwu: For non-coordinate variable "double xtime(Time)" of MPAS, treat it as a set variable with time steps.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue May 6 17:36:20 CDT 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/f68c1ee96418/
Changeset: f68c1ee96418
Branch: master
User: danwu
Date: 2014-05-07 00:35:43
Summary: For non-coordinate variable "double xtime(Time)" of MPAS, treat it as a set variable with time steps.
Affected #: 1 file
diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 5848623..cdc78c0 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -327,6 +327,8 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
std::vector<ReadNC::VarData>& vdatas, std::vector<ReadNC::VarData>& vsetdatas)
{
std::map<std::string, ReadNC::VarData>& varInfo = _readNC->varInfo;
+ std::vector<std::string>& dimNames = _readNC->dimNames;
+
std::map<std::string, ReadNC::VarData>::iterator mit;
// If empty read them all (except ignored variables)
@@ -341,7 +343,6 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
continue;
// Dimension variables were read before creating conventional tags
- std::vector<std::string>& dimNames = _readNC->dimNames;
if (std::find(dimNames.begin(), dimNames.end(), vd.varName) != dimNames.end())
continue;
@@ -388,16 +389,14 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
for (unsigned int i = 0; i < vsetdatas.size(); i++) {
if ((std::find(vsetdatas[i].varDims.begin(), vsetdatas[i].varDims.end(), tDim) != vsetdatas[i].varDims.end())
- && (vsetdatas[i].varDims.size() > 1)) {
- // Set variables with timesteps: time is the first dimension, followed
- // by other dimensions, e.g. xtime(Time, StrLen)
+ && (vsetdatas[i].varName != dimNames[tDim])) {
+ // Set variables with timesteps: e.g. xtime(Time) or xtime(Time, StrLen)
vsetdatas[i].varTags.resize(tstep_nums.size(), 0);
vsetdatas[i].varDatas.resize(tstep_nums.size());
vsetdatas[i].has_tsteps = true;
}
else {
- // Set variables without timesteps: no time dimension, or time is the only
- // dimension, e.g. lev(lev), xtime(Time)
+ // Set variables without timesteps: no time dimension, or time itself
vsetdatas[i].varTags.resize(1, 0);
vsetdatas[i].varDatas.resize(1);
vsetdatas[i].has_tsteps = false;
@@ -423,7 +422,7 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
for (unsigned int t = 0; t < tstep_nums.size(); t++) {
void* data = vdatas[i].varDatas[t];
- // Set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (vdatas[i].has_tsteps) {
// Set readStart for each timestep along time dimension
vdatas[i].readStarts[0] = tstep_nums[t];
@@ -490,7 +489,7 @@ ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, s
}
vdatas[i].varDatas[t] = NULL;
- // Loop continues only for set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Loop continues only for set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (!vdatas[i].has_tsteps)
break;
}
@@ -881,7 +880,7 @@ ErrorCode NCHelper::read_variable_to_set_allocate(std::vector<ReadNC::VarData>&
rval = MB_FAILURE;
}
- // Loop continues only for set variables with timesteps, e.g. xtime(Time, StrLen)
+ // Loop continues only for set variables with timesteps, e.g. xtime(Time) or xtime(Time, StrLen)
if (!vdatas[i].has_tsteps)
break;
}
@@ -1323,8 +1322,7 @@ ErrorCode ScdNCHelper::create_quad_coordinate_tag() {
ERRORR(rval, "Trouble getting owned QUAD entity.");
numOwnedEnts = ents_owned.size();
}
- else
- {
+ else {
numOwnedEnts = ents.size();
ents_owned = ents;
}
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