Skip to content
Snippets Groups Projects
Commit e823284e authored by Spiros Tsalikis's avatar Spiros Tsalikis
Browse files

vtkCONVERGECFDCGNSReader: Conform to assembly format like vtkCONVERGECFDReader

The changes we need on the ParaView reader are:

rename the "Root" node in the cgns assemble to "assembly"
rename the "Internal" block to "Mesh"
rename the "Patches" block to "Surfaces"
parent 31840138
No related branches found
No related tags found
No related merge requests found
......@@ -307,6 +307,10 @@ int vtkCONVERGECFDCGNSReader::RequestData(vtkInformation* vtkNotUsed(request),
// Retrieve collection assembly so parcels can be added
vtkDataAssembly* hierarchy = cgnsOutput->GetDataAssembly();
// change root node name to "assembly"
hierarchy->SetRootNodeName("assembly");
hierarchy->SetAttribute(vtkDataAssembly::GetRootNode(), "label", "assembly");
// Use CGIO routine to find the zones
int cgioId = 0;
if (cgio_open_file(this->FileName.c_str(), CGIO_MODE_READ, CG_FILE_NONE, &cgioId) != CG_OK)
......@@ -396,6 +400,31 @@ int vtkCONVERGECFDCGNSReader::RequestData(vtkInformation* vtkNotUsed(request),
continue;
}
const auto zoneChildren = hierarchy->GetChildNodes(zoneAssemblyId);
for (const auto zoneChild : zoneChildren)
{
const auto childName = hierarchy->GetNodeName(zoneChild);
// 1) change the name of the "Internal" node to "Mesh"
if (strcmp(childName, "Internal") == 0)
{
hierarchy->SetNodeName(zoneChild, "Mesh");
hierarchy->SetAttribute(zoneChild, "label", "Mesh");
// also change the vtkCompositeDataSet::NAME() metadata
unsigned int partitionedDataSetId = hierarchy->GetDataSetIndices(zoneChild).front();
if (cgnsOutput->HasMetaData(partitionedDataSetId) &&
cgnsOutput->GetMetaData(partitionedDataSetId)->Has(vtkCompositeDataSet::NAME()))
{
cgnsOutput->GetMetaData(partitionedDataSetId)->Set(vtkCompositeDataSet::NAME(), "Mesh");
}
}
// 2) change the name of the "Patches" node to "Surfaces"
else if (strcmp(childName, "Patches") == 0)
{
hierarchy->SetNodeName(zoneChild, "Surfaces");
hierarchy->SetAttribute(zoneChild, "label", "Surfaces");
}
}
// Search for UserDefinedData_t child nodes named "PARCEL_DATA" in current zone
std::vector<double> zoneChildIds;
CGNSRead::getNodeChildrenId(cgioId, baseChildId, zoneChildIds);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment