Skip to content
Permalink
Browse files

RUN: Fix errors in Abaqus Exporter and SPParks Dump Reader

AbaqusHexahedronWriter did not provide enough arguments to an error message
SPParksDumpReader did not properly create AttributeMatrix and DataArray with the proper
number of tuples. This effected filters downstream that depend on that information.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information...
imikejackson committed Jul 31, 2019
1 parent 8c63966 commit 1168641215fad46af0cb46f1f966983ca18e6133
@@ -149,7 +149,7 @@ void AbaqusHexahedronWriter::dataCheck()
{
QString ss = QObject::tr("The number of Tuples for the DataArray %1 is %2 and for the associated Image Geometry is %3. The number of tuples must match")
.arg(m_FeatureIdsPtr.lock()->getName())
.arg(m_FeatureIdsPtr.lock()->getNumberOfTuples());
.arg(m_FeatureIdsPtr.lock()->getNumberOfTuples()).arg(volTuples);
setErrorCondition(-10200, ss);
}
}
@@ -160,18 +160,6 @@ void SPParksDumpReader::dataCheck()
return;
}

std::vector<size_t> tDims(3, 0);
m->createNonPrereqAttributeMatrix(this, getCellAttributeMatrixName(), tDims, AttributeMatrix::Type::Cell, AttributeMatrixID21);
if(getErrorCode() < 0)
{
return;
}

// Creating a Feature Ids array here in preflight so that it appears in the current data structure
// This is a temporary array that will be overwritten by the correct array at the end of reading the file
std::vector<size_t> cDims(1, 1);
DataArrayPath fIdsPath(getVolumeDataContainerName().getDataContainerName(), getCellAttributeMatrixName(), getFeatureIdsArrayName());
getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, fIdsPath, 0, cDims, "", DataArrayID31);
QFileInfo fi(getInputFile());
if(getInputFile().isEmpty())
{
@@ -201,6 +189,7 @@ void SPParksDumpReader::dataCheck()
{
int32_t error = readHeader();
m_InStream.close();

if(error < 0)
{
QString ss = QObject::tr("Error occurred trying to parse the dimensions from the input file");
@@ -241,12 +230,16 @@ void SPParksDumpReader::execute()
m_InStream.setFileName(getInputFile());
m_InStream.open(QFile::ReadOnly);

err = readHeader();
if(err < 0)
{
m_InStream.close();
return;
}
// We need to skip the header since it is already read
QByteArray buf = m_InStream.readLine(); // ITEM: TIMESTEP
buf = m_InStream.readLine(); // 210 21000.6
buf = m_InStream.readLine(); // ITEM: NUMBER OF ATOMS
buf = m_InStream.readLine(); // 106480
buf = m_InStream.readLine(); // ITEM: BOX BOUNDS
buf = m_InStream.readLine(); // 0.5 44.5
buf = m_InStream.readLine(); // 0.5 44.5
buf = m_InStream.readLine(); // 0.5 55.5

err = readFile();
m_InStream.close();
if(err < 0)
@@ -280,7 +273,7 @@ int32_t SPParksDumpReader::readHeader()
oneBase = 1;
}

bool ok = false; // Use this to verify that the comversions from string to numbers actually works.
bool ok = false; // Use this to verify that the conversions from string to numbers actually works.
int64_t nx = 0;
int64_t ny = 0;
int64_t nz = 0;
@@ -383,6 +376,16 @@ int32_t SPParksDumpReader::readHeader()
FloatVec3Type origin = getOrigin();
m_CachedGeometry->setOrigin(origin);

// Creating a Feature Ids array here in preflight so that it appears in the current data structure
// This is a temporary array that will be overwritten by the correct array at the end of reading the file

DataArrayPath fIdsPath(getVolumeDataContainerName(), getCellAttributeMatrixName(), getFeatureIdsArrayName());
QVector<size_t> tDims = {static_cast<size_t>(nx), static_cast<size_t>(ny), static_cast<size_t>(nz)};
m->createNonPrereqAttributeMatrix(this, fIdsPath, tDims, AttributeMatrix::Type::Cell);

QVector<size_t> cDims = {1};
getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, fIdsPath, 0, cDims);

return 0;
}

0 comments on commit 1168641

Please sign in to comment.
You can’t perform that action at this time.