Commit c8a15ce5 authored by Burlen Loring's avatar Burlen Loring

fix a couple of issues in VTKPosthocIO

* check that array iterator is valid before using it.
  when there are no arrays in a mesh it will not be valid
* fix logic error in SetMode
parent c816cb55
......@@ -109,8 +109,7 @@ int VTKPosthocIO::SetOutputDir(const std::string &outputDir)
//-----------------------------------------------------------------------------
int VTKPosthocIO::SetMode(int mode)
{
if (!(mode == VTKPosthocIO::MODE_VISIT) ||
(mode == VTKPosthocIO::MODE_PARAVIEW))
if ((mode != VTKPosthocIO::MODE_VISIT) && (mode != VTKPosthocIO::MODE_PARAVIEW))
{
SENSEI_ERROR("Invalid mode " << mode)
return -1;
......@@ -281,16 +280,19 @@ bool VTKPosthocIO::Execute(DataAdaptor* dataAdaptor)
ArrayRequirementsIterator ait =
this->Requirements.GetArrayRequirementsIterator(meshName);
for (; ait; ++ait)
if (ait)
{
if (dataAdaptor->AddArray(dobj, mit.MeshName(),
ait.Association(), ait.Array()))
for (; ait; ++ait)
{
SENSEI_ERROR("Failed to add "
<< VTKUtils::GetAttributesName(ait.Association())
<< " data array \"" << ait.Array() << "\" to mesh \""
<< meshName << "\"")
return false;
if (dataAdaptor->AddArray(dobj, mit.MeshName(),
ait.Association(), ait.Array()))
{
SENSEI_ERROR("Failed to add "
<< VTKUtils::GetAttributesName(ait.Association())
<< " data array \"" << ait.Array() << "\" to mesh \""
<< meshName << "\"")
return false;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment