Commit f49a9fa1 authored by Burlen Loring's avatar Burlen Loring

oscillator array length bug

use the cached block extent rather than VTK data object API
to query number of cells. Number of cells will always be 0
when structureOnly data adaptor paramter is set true.
parent f3ddd21e
......@@ -288,22 +288,24 @@ int DataAdaptor::AddArray(vtkDataObject* mesh, const std::string &meshName,
continue;
vtkCellData *cd = nullptr;
vtkIdType ncells = 0;
if(meshName == "mesh")
{
vtkSmartPointer<vtkImageData>& blockMesh = internals.BlockMesh[cc];
cd = (blockMesh? blockMesh->GetCellData() : nullptr);
ncells = (blockMesh? blockMesh->GetNumberOfCells() : 0);
}
else if(meshName == "ucdmesh")
{
vtkSmartPointer<vtkUnstructuredGrid>& uMesh = internals.UnstructuredMesh[cc];
cd = (uMesh? uMesh->GetCellData() : nullptr);
ncells = (uMesh? uMesh->GetNumberOfCells() : 0);
}
if (cd && !cd->GetArray(arrayName.c_str()))
{
const diy::DiscreteBounds &ce = internals.CellExtents[cc];
vtkIdType ncells = (ce.max[0] - ce.min[0] + 1)*
(ce.max[1] - ce.min[1] + 1)*(ce.max[2] - ce.min[2] + 1);
vtkFloatArray *fa = vtkFloatArray::New();
fa->SetName(arrayName.c_str());
fa->SetArray(internals.Data[cc], ncells, 1);
......
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