Commit 97cc8760 authored by Joachim Pouderoux's avatar Joachim Pouderoux Committed by Kitware Robot

Merge topic 'FixXdmfWritersCrashWithAbstractArrays'

2cb872b2 Fix non numerical array writing crash and fix support for Quad9
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: default avatarDavid E DeMarle <dave.demarle@kitware.com>
Merge-request: !646
parents d12a9fa9 2cb872b2
......@@ -1163,7 +1163,7 @@ int vtkXdmfWriter::WriteArrays(vtkFieldData* fd, xdmf2::XdmfGrid *grid, int asso
attributeNames.reserve(nbOfArrays);
for (int i = 0; i < nbOfArrays; i++)
{
vtkDataArray *scalars = fd->GetArray(i);
vtkAbstractArray *scalars = fd->GetAbstractArray(i);
attributeNames.push_back(std::pair<int, std::string>(i, scalars->GetName()));
}
std::sort(attributeNames.begin(), attributeNames.end());
......
......@@ -663,6 +663,12 @@ void vtkXdmf3DataSet::VTKToXdmfAttributes(
for (int cc=0; cc < numArrays; cc++)
{
vtkDataArray *vArray = fieldData->GetArray(cc);
if (!vArray)
{
// We're skipping non-numerical arrays for now because
// we do not support their serialization in the heavy data file.
continue;
}
std::string attrName = vArray->GetName();
if (attrName.length() == 0)
{
......
......@@ -60,7 +60,7 @@ XdmfTopologyType::Polyline(const unsigned int nodesPerElement)
return type->second;
}
shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(nodesPerElement, 0, faces, nodesPerElement - 1,
p(new XdmfTopologyType(nodesPerElement, 0, faces, nodesPerElement - 1,
"Polyline", Linear, 0x2));
previousTypes[nodesPerElement] = p;
return p;
......@@ -356,7 +356,7 @@ XdmfTopologyType::Hexahedron_Spectral_125()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(125, 6, faces, 12,
p(new XdmfTopologyType(125, 6, faces, 12,
"Hexahedron_Spectral_125", Quartic, 0x42));
return p;
}
......@@ -367,7 +367,7 @@ XdmfTopologyType::Hexahedron_Spectral_216()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(216, 6, faces, 12,
p(new XdmfTopologyType(216, 6, faces, 12,
"Hexahedron_Spectral_216", Quintic, 0x43));
return p;
}
......@@ -379,7 +379,7 @@ XdmfTopologyType::Hexahedron_Spectral_343()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(343, 6, faces, 12,
p(new XdmfTopologyType(343, 6, faces, 12,
"Hexahedron_Spectral_343", Sextic, 0x44));
return p;
}
......@@ -391,7 +391,7 @@ XdmfTopologyType::Hexahedron_Spectral_512()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(512, 6, faces, 12,
p(new XdmfTopologyType(512, 6, faces, 12,
"Hexahedron_Spectral_512", Septic, 0x45));
return p;
}
......@@ -403,7 +403,7 @@ XdmfTopologyType::Hexahedron_Spectral_729()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(729, 6, faces, 12,
p(new XdmfTopologyType(729, 6, faces, 12,
"Hexahedron_Spectral_729", Octic, 0x46));
return p;
}
......@@ -415,7 +415,7 @@ XdmfTopologyType::Hexahedron_Spectral_1000()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(1000, 6, faces, 12,
p(new XdmfTopologyType(1000, 6, faces, 12,
"Hexahedron_Spectral_1000", Nonic, 0x47));
return p;
}
......@@ -426,7 +426,7 @@ XdmfTopologyType::Hexahedron_Spectral_1331()
std::vector<shared_ptr<const XdmfTopologyType> > faces;
faces.push_back(XdmfTopologyType::NoTopologyType());
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(1331, 6, faces, 12,
p(new XdmfTopologyType(1331, 6, faces, 12,
"Hexahedron_Spectral_1331", Decic, 0x48));
return p;
}
......@@ -590,7 +590,7 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
type = itemProperties.find("TopologyType");
}
if(type == itemProperties.end()) {
XdmfError::message(XdmfError::FATAL,
XdmfError::message(XdmfError::FATAL,
"Neither 'Type' nor 'TopologyType' found in "
"itemProperties in XdmfTopologyType::New");
}
......@@ -613,7 +613,7 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
if(nodesPerElement != itemProperties.end()) {
return Polyline(atoi(nodesPerElement->second.c_str()));
}
XdmfError::message(XdmfError::FATAL,
XdmfError::message(XdmfError::FATAL,
"'NodesPerElement' not in itemProperties and type "
"'POLYLINE' selected in XdmfTopologyType::New");
}
......@@ -621,7 +621,7 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
if(nodesPerElement != itemProperties.end()) {
return Polygon(atoi(nodesPerElement->second.c_str()));
}
XdmfError::message(XdmfError::FATAL,
XdmfError::message(XdmfError::FATAL,
"'NodesPerElement' not in itemProperties and type "
"'POLYGON' selected in XdmfTopologyType::New");
}
......@@ -652,6 +652,9 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
else if(typeVal.compare("QUADRILATERAL_8") == 0) {
return Quadrilateral_8();
}
else if(typeVal.compare("QUADRILATERAL_9") == 0) {
return Quadrilateral_9();
}
else if(typeVal.compare("TETRAHEDRON_10") == 0) {
return Tetrahedron_10();
}
......@@ -721,10 +724,10 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
else if(typeVal.compare("MIXED") == 0) {
return Mixed();
}
XdmfError::message(XdmfError::FATAL,
XdmfError::message(XdmfError::FATAL,
"Invalid Type selected in XdmfTopologyType::New");
// unreachable
return shared_ptr<const XdmfTopologyType>();
}
......
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