Commit a7276c5c authored by Burlen Loring's avatar Burlen Loring

Merge branch 'fix_oscillator_ucdmesh_bug' into 'master'

oscillator array length bug

See merge request !93
parents f3ddd21e f49a9fa1
......@@ -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