Merge topic 'zfp-output-fields'

478f765db Attach compressed ZFP data as WholeDatSet field

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2910
This commit is contained in:
Kenneth Moreland 2022-11-10 17:41:46 +00:00 committed by Kitware Robot
commit 44a976f905
5 changed files with 31 additions and 7 deletions

@ -0,0 +1,8 @@
# Attach compressed ZFP data as WholeDatSet field
Previously, point fields compressed by ZFP were attached as point fields
on the output. However, using them as a point field would cause
problems. So, instead attache them as `WholeDataSet` fields.
Also fixed a problem where the 1D decompressor created an output of the
wrong size.

@ -30,8 +30,12 @@ VTKM_CONT vtkm::cont::DataSet ZFPCompressor1D::DoExecute(const vtkm::cont::DataS
compressed = compressor.Compress(concrete, rate, field.GetNumberOfValues());
});
// TODO: is it really PointField or WHOLE_MESH, should we do it the same way as Histogram?
return this->CreateResultFieldPoint(input, "compressed", compressed);
// Note: the compressed array is set as a WholeDataSet field. It is really associated with
// the points, but the size does not match and problems will occur if the user attempts to
// use it as a point data set. The decompressor will place the data back as a point field.
// (This might cause issues if cell fields are ever supported.)
return this->CreateResultField(
input, "compressed", vtkm::cont::Field::Association::WholeDataSet, compressed);
}
} // namespace zfp
} // namespace filter

@ -35,8 +35,12 @@ VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute(const vtkm::cont::DataS
compressed = compressor.Compress(concrete, rate, pointDimensions);
});
// TODO: is it really PointField or WHOLE_MESH, should we do it the same way as Histogram?
return this->CreateResultFieldPoint(input, "compressed", compressed);
// Note: the compressed array is set as a WholeDataSet field. It is really associated with
// the points, but the size does not match and problems will occur if the user attempts to
// use it as a point data set. The decompressor will place the data back as a point field.
// (This might cause issues if cell fields are ever supported.)
return this->CreateResultField(
input, "compressed", vtkm::cont::Field::Association::WholeDataSet, compressed);
}
} // namespace zfp
} // namespace filter

@ -35,8 +35,12 @@ VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute(const vtkm::cont::DataS
compressed = compressor.Compress(concrete, rate, pointDimensions);
});
// TODO: is it really PointField or WHOLE_MESH, should we do it the same way as Histogram?
return this->CreateResultFieldPoint(input, "compressed", compressed);
// Note: the compressed array is set as a WholeDataSet field. It is really associated with
// the points, but the size does not match and problems will occur if the user attempts to
// use it as a point data set. The decompressor will place the data back as a point field.
// (This might cause issues if cell fields are ever supported.)
return this->CreateResultField(
input, "compressed", vtkm::cont::Field::Association::WholeDataSet, compressed);
}
} // namespace zfp
} // namespace filter

@ -26,9 +26,13 @@ VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(const vtkm::cont::Dat
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
vtkm::cont::ArrayCopyShallowIfPossible(this->GetFieldFromDataSet(input).GetData(), compressed);
vtkm::cont::CellSetStructured<1> cellSet;
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id pointDimensions = cellSet.GetPointDimensions();
vtkm::cont::ArrayHandle<vtkm::Float64> decompressed;
vtkm::worklet::ZFP1DDecompressor decompressor;
decompressor.Decompress(compressed, decompressed, this->rate, compressed.GetNumberOfValues());
decompressor.Decompress(compressed, decompressed, this->rate, pointDimensions);
return this->CreateResultFieldPoint(input, "decompressed", decompressed);
}