mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 21:33:55 +00:00
migrate zfp filters
This commit is contained in:
parent
f9495beaf5
commit
33c8754555
@ -48,6 +48,12 @@ set(deprecated_headers
|
||||
VectorMagnitude.h
|
||||
WarpScalar.h
|
||||
WarpVector.h
|
||||
ZFPCompressor1D.h
|
||||
ZFPCompressor2D.h
|
||||
ZFPCompressor3D.h
|
||||
ZFPDecompressor1D.h
|
||||
ZFPDecompressor2D.h
|
||||
ZFPDecompressor3D.h
|
||||
)
|
||||
|
||||
vtkm_declare_headers(${deprecated_headers})
|
||||
@ -105,12 +111,6 @@ set(extra_headers
|
||||
Triangulate.h
|
||||
Tube.h
|
||||
VertexClustering.h
|
||||
ZFPCompressor1D.h
|
||||
ZFPCompressor2D.h
|
||||
ZFPCompressor3D.h
|
||||
ZFPDecompressor1D.h
|
||||
ZFPDecompressor2D.h
|
||||
ZFPDecompressor3D.h
|
||||
)
|
||||
|
||||
set(extra_header_template_sources
|
||||
@ -135,12 +135,6 @@ set(extra_header_template_sources
|
||||
Triangulate.hxx
|
||||
Tube.hxx
|
||||
VertexClustering.hxx
|
||||
ZFPCompressor1D.hxx
|
||||
ZFPCompressor2D.hxx
|
||||
ZFPCompressor3D.hxx
|
||||
ZFPDecompressor1D.hxx
|
||||
ZFPDecompressor2D.hxx
|
||||
ZFPDecompressor3D.hxx
|
||||
)
|
||||
|
||||
set(extra_sources_device
|
||||
@ -213,6 +207,7 @@ add_subdirectory(field_conversion)
|
||||
add_subdirectory(field_transform)
|
||||
add_subdirectory(mesh_info)
|
||||
add_subdirectory(vector_analysis)
|
||||
add_subdirectory(zfp)
|
||||
|
||||
#-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
|
||||
if (VTKm_ENABLE_TESTING)
|
||||
|
@ -7,55 +7,33 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPCompressor1D_h
|
||||
#define vtk_m_filter_ZFPCompressor1D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFP1DCompressor.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor1D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPCompressor1D : public vtkm::filter::FilterField<ZFPCompressor1D>
|
||||
VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm/filter/zfp/ZFPCompressor1D.h instead of vtkm/filter/ZFPCompressor1D.h.")
|
||||
inline void ZFPCompressor1D_deprecated() {}
|
||||
|
||||
inline void ZFPCompressor1D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
ZFPCompressor1D_deprecated();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ZFPCompressor1D();
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFP1DCompressor compressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPCompressor1D.") ZFPCompressor1D
|
||||
: public vtkm::filter::zfp::ZFPCompressor1D
|
||||
{
|
||||
using zfp::ZFPCompressor1D::ZFPCompressor1D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPCompressor1D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPCompressor1D_h
|
||||
#endif //vtk_m_filter_ZFPCompressor1D_h
|
||||
|
@ -1,60 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPCompressor1D_hxx
|
||||
#define vtk_m_filter_ZFPCompressor1D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
bool IsCellSetStructured(const vtkm::cont::UnknownCellSet& cellset)
|
||||
{
|
||||
if (cellset.template IsType<vtkm::cont::CellSetStructured<1>>())
|
||||
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPCompressor1D::ZFPCompressor1D()
|
||||
: vtkm::filter::FilterField<ZFPCompressor1D>()
|
||||
, rate(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor1D::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
auto compressed = compressor.Compress(field, rate, field.GetNumberOfValues());
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("compressed", compressed));
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -7,55 +7,33 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPCompressor2D_h
|
||||
#define vtk_m_filter_ZFPCompressor2D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFP2DCompressor.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor2D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPCompressor2D : public vtkm::filter::FilterField<ZFPCompressor2D>
|
||||
VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm/filter/zfp/ZFPCompressor2D.h instead of vtkm/filter/ZFPCompressor2D.h.")
|
||||
inline void ZFPCompressor2D_deprecated() {}
|
||||
|
||||
inline void ZFPCompressor2D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
ZFPCompressor2D_deprecated();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ZFPCompressor2D();
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFP2DCompressor compressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPCompressor2D.") ZFPCompressor2D
|
||||
: public vtkm::filter::zfp::ZFPCompressor2D
|
||||
{
|
||||
using zfp::ZFPCompressor2D::ZFPCompressor2D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPCompressor2D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPCompressor2D_h
|
||||
#endif //vtk_m_filter_ZFPCompressor2D_h
|
||||
|
@ -1,67 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPCompressor2D_hxx
|
||||
#define vtk_m_filter_ZFPCompressor2D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template <typename CellSetList>
|
||||
bool IsCellSet2DStructured(const vtkm::cont::UnknownCellSet& cellset)
|
||||
{
|
||||
if (cellset.template IsType<vtkm::cont::CellSetStructured<2>>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPCompressor2D::ZFPCompressor2D()
|
||||
: vtkm::filter::FilterField<ZFPCompressor2D>()
|
||||
, rate(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<2> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
|
||||
auto compressed = compressor.Compress(field, rate, pointDimensions);
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.SetCellSet(cellSet);
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("compressed", compressed));
|
||||
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -7,54 +7,33 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPCompressor3D_h
|
||||
#define vtk_m_filter_ZFPCompressor3D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFPCompressor.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor3D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPCompressor3D : public vtkm::filter::FilterField<ZFPCompressor3D>
|
||||
VTKM_DEPRECATED(1.8,
|
||||
"Use vtkm/filter/zfp/ZFPCompressor3D.h instead of vtkm/filter/ZFPCompressor3D.h.")
|
||||
inline void ZFPCompressor3D_deprecated() {}
|
||||
|
||||
inline void ZFPCompressor3D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
VTKM_CONT
|
||||
ZFPCompressor3D();
|
||||
ZFPCompressor3D_deprecated();
|
||||
}
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFPCompressor compressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPCompressor3D.") ZFPCompressor3D
|
||||
: public vtkm::filter::zfp::ZFPCompressor3D
|
||||
{
|
||||
using zfp::ZFPCompressor3D::ZFPCompressor3D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPCompressor3D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPCompressor3D_h
|
||||
#endif //vtk_m_filter_ZFPCompressor3D_h
|
||||
|
@ -1,67 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPCompressor3D_hxx
|
||||
#define vtk_m_filter_ZFPCompressor3D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template <typename CellSetList>
|
||||
bool IsCellSet3DStructured(const vtkm::cont::UnknownCellSet& cellset)
|
||||
{
|
||||
if (cellset.template IsType<vtkm::cont::CellSetStructured<3>>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPCompressor3D::ZFPCompressor3D()
|
||||
: vtkm::filter::FilterField<ZFPCompressor3D>()
|
||||
, rate(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<3> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
|
||||
auto compressed = compressor.Compress(field, rate, pointDimensions);
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.SetCellSet(cellSet);
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("compressed", compressed));
|
||||
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -7,62 +7,34 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPDecompressor1D_h
|
||||
#define vtk_m_filter_ZFPDecompressor1D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFP1DDecompress.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor1D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPDecompressor1D : public vtkm::filter::FilterField<ZFPDecompressor1D>
|
||||
VTKM_DEPRECATED(
|
||||
1.8,
|
||||
"Use vtkm/filter/zfp/ZFPDecompressor1D.h instead of vtkm/filter/ZFPDecompressor1D.h.")
|
||||
inline void ZFPDecompressor1D_deprecated() {}
|
||||
|
||||
inline void ZFPDecompressor1D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
|
||||
ZFPDecompressor1D_deprecated();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ZFPDecompressor1D();
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFP1DDecompressor decompressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPDecompressor1D.") ZFPDecompressor1D
|
||||
: public vtkm::filter::zfp::ZFPDecompressor1D
|
||||
{
|
||||
using zfp::ZFPDecompressor1D::ZFPDecompressor1D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPDecompressor1D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPDecompressor1D_h
|
||||
#endif //vtk_m_filter_ZFPDecompressor1D_h
|
||||
|
@ -1,57 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPDecompressor1D_hxx
|
||||
#define vtk_m_filter_ZFPDecompressor1D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPDecompressor1D::ZFPDecompressor1D()
|
||||
: vtkm::filter::FilterField<ZFPDecompressor1D>()
|
||||
{
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
VTKM_ASSERT(true);
|
||||
vtkm::cont::DataSet ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;
|
||||
decompressor.Decompress(field, decompress, rate, field.GetNumberOfValues());
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("decompressed", decompress));
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -7,62 +7,34 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPDecompressor2D_h
|
||||
#define vtk_m_filter_ZFPDecompressor2D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFP2DCompressor.h>
|
||||
#include <vtkm/worklet/ZFP2DDecompress.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor2D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPDecompressor2D : public vtkm::filter::FilterField<ZFPDecompressor2D>
|
||||
VTKM_DEPRECATED(
|
||||
1.8,
|
||||
"Use vtkm/filter/zfp/ZFPDecompressor2D.h instead of vtkm/filter/ZFPDecompressor2D.h.")
|
||||
inline void ZFPDecompressor2D_deprecated() {}
|
||||
|
||||
inline void ZFPDecompressor2D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
|
||||
ZFPDecompressor2D_deprecated();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ZFPDecompressor2D();
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFP2DDecompressor decompressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPDecompressor2D.") ZFPDecompressor2D
|
||||
: public vtkm::filter::zfp::ZFPDecompressor2D
|
||||
{
|
||||
using zfp::ZFPDecompressor2D::ZFPDecompressor2D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPDecompressor2D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPDecompressor2D_h
|
||||
#endif //vtk_m_filter_ZFPDecompressor2D_h
|
||||
|
@ -1,62 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPDecompressor2D_hxx
|
||||
#define vtk_m_filter_ZFPDecompressor2D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPDecompressor2D::ZFPDecompressor2D()
|
||||
: vtkm::filter::FilterField<ZFPDecompressor2D>()
|
||||
{
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
VTKM_ASSERT(true);
|
||||
|
||||
vtkm::cont::DataSet ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<2> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;
|
||||
decompressor.Decompress(field, decompress, rate, pointDimensions);
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("decompressed", decompress));
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -7,62 +7,34 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_ZFPDecompressor3D_h
|
||||
#define vtk_m_filter_ZFPDecompressor3D_h
|
||||
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/worklet/ZFPCompressor.h>
|
||||
#include <vtkm/worklet/ZFPDecompress.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor3D.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class ZFPDecompressor3D : public vtkm::filter::FilterField<ZFPDecompressor3D>
|
||||
VTKM_DEPRECATED(
|
||||
1.8,
|
||||
"Use vtkm/filter/zfp/ZFPDecompressor3D.h instead of vtkm/filter/ZFPDecompressor3D.h.")
|
||||
inline void ZFPDecompressor3D_deprecated() {}
|
||||
|
||||
inline void ZFPDecompressor3D_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
|
||||
ZFPDecompressor3D_deprecated();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
ZFPDecompressor3D();
|
||||
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet&,
|
||||
const vtkm::cont::Field&,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Float64 rate;
|
||||
vtkm::worklet::ZFPDecompressor decompressor;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::zfp::ZFPDecompressor3D.") ZFPDecompressor3D
|
||||
: public vtkm::filter::zfp::ZFPDecompressor3D
|
||||
{
|
||||
using zfp::ZFPDecompressor3D::ZFPDecompressor3D;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/ZFPDecompressor3D.hxx>
|
||||
|
||||
#endif // vtk_m_filter_ZFPDecompressor3D_h
|
||||
#endif //vtk_m_filter_ZFPDecompressor3D_h
|
||||
|
@ -1,61 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_ZFPDecompressor3D_hxx
|
||||
#define vtk_m_filter_ZFPDecompressor3D_hxx
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT ZFPDecompressor3D::ZFPDecompressor3D()
|
||||
: vtkm::filter::FilterField<ZFPDecompressor3D>()
|
||||
{
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename T, typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
VTKM_ASSERT(true);
|
||||
vtkm::cont::DataSet ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename StorageType, typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute(
|
||||
const vtkm::cont::DataSet& input,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<3> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;
|
||||
decompressor.Decompress(field, decompress, rate, pointDimensions);
|
||||
|
||||
vtkm::cont::DataSet dataset;
|
||||
dataset.AddField(vtkm::cont::make_FieldPoint("decompressed", decompress));
|
||||
return dataset;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -35,7 +35,6 @@ set(unit_tests
|
||||
UnitTestTriangulateFilter.cxx
|
||||
UnitTestTubeFilter.cxx
|
||||
UnitTestVertexClusteringFilter.cxx
|
||||
UnitTestZFP.cxx
|
||||
)
|
||||
|
||||
#Taking too long to compile with HIPCC
|
||||
|
42
vtkm/filter/zfp/CMakeLists.txt
Normal file
42
vtkm/filter/zfp/CMakeLists.txt
Normal file
@ -0,0 +1,42 @@
|
||||
##============================================================================
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
set(zfp_headers
|
||||
ZFPCompressor1D.h
|
||||
ZFPCompressor2D.h
|
||||
ZFPCompressor3D.h
|
||||
ZFPDecompressor1D.h
|
||||
ZFPDecompressor2D.h
|
||||
ZFPDecompressor3D.h
|
||||
)
|
||||
|
||||
set(zfp_sources_device
|
||||
ZFPCompressor1D.cxx
|
||||
ZFPCompressor2D.cxx
|
||||
ZFPCompressor3D.cxx
|
||||
ZFPDecompressor1D.cxx
|
||||
ZFPDecompressor2D.cxx
|
||||
ZFPDecompressor3D.cxx
|
||||
)
|
||||
|
||||
vtkm_library(
|
||||
NAME vtkm_filter_zfp
|
||||
HEADERS ${zfp_headers}
|
||||
DEVICE_SOURCES ${zfp_sources_device}
|
||||
USE_VTKM_JOB_POOL
|
||||
)
|
||||
|
||||
target_link_libraries(vtkm_filter_zfp PUBLIC vtkm_worklet vtkm_filter_core)
|
||||
target_link_libraries(vtkm_filter PUBLIC INTERFACE vtkm_filter_zfp)
|
||||
|
||||
add_subdirectory(worklet)
|
||||
#-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
|
||||
if (VTKm_ENABLE_TESTING)
|
||||
add_subdirectory(testing)
|
||||
endif ()
|
38
vtkm/filter/zfp/ZFPCompressor1D.cxx
Normal file
38
vtkm/filter/zfp/ZFPCompressor1D.cxx
Normal file
@ -0,0 +1,38 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/zfp/ZFPCompressor1D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFP1DCompressor.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPCompressor1D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
const auto& field = this->GetFieldFromDataSet(input);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
vtkm::worklet::ZFP1DCompressor compressor;
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
field.GetData().CastAndCallForTypesWithFloatFallback<SupportedTypes, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
[&](const auto& concrete) {
|
||||
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);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPCompressor1D.h
Normal file
44
vtkm/filter/zfp/ZFPCompressor1D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPCompressor1D_h
|
||||
#define vtk_m_filter_zfp_ZFPCompressor1D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPCompressor1D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input);
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPCompressor1D_h
|
43
vtkm/filter/zfp/ZFPCompressor2D.cxx
Normal file
43
vtkm/filter/zfp/ZFPCompressor2D.cxx
Normal file
@ -0,0 +1,43 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/zfp/ZFPCompressor2D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFP2DCompressor.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<2> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
|
||||
vtkm::worklet::ZFP2DCompressor compressor;
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
this->GetFieldFromDataSet(input)
|
||||
.GetData()
|
||||
.CastAndCallForTypesWithFloatFallback<SupportedTypes, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
[&](const auto& concrete) {
|
||||
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);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPCompressor2D.h
Normal file
44
vtkm/filter/zfp/ZFPCompressor2D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPCompressor2D_h
|
||||
#define vtk_m_filter_zfp_ZFPCompressor2D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPCompressor2D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPCompressor2D_h
|
43
vtkm/filter/zfp/ZFPCompressor3D.cxx
Normal file
43
vtkm/filter/zfp/ZFPCompressor3D.cxx
Normal file
@ -0,0 +1,43 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/filter/zfp/ZFPCompressor3D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFPCompressor.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<3> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
|
||||
vtkm::worklet::ZFPCompressor compressor;
|
||||
using SupportedTypes = vtkm::List<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
|
||||
this->GetFieldFromDataSet(input)
|
||||
.GetData()
|
||||
.CastAndCallForTypesWithFloatFallback<SupportedTypes, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
[&](const auto& concrete) {
|
||||
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);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPCompressor3D.h
Normal file
44
vtkm/filter/zfp/ZFPCompressor3D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPCompressor3D_h
|
||||
#define vtk_m_filter_zfp_ZFPCompressor3D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPCompressor3D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPCompressor3D_h
|
37
vtkm/filter/zfp/ZFPDecompressor1D.cxx
Normal file
37
vtkm/filter/zfp/ZFPDecompressor1D.cxx
Normal file
@ -0,0 +1,37 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor1D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFP1DDecompress.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
// FIXME: it looks like the compressor can compress Ints and Floats but only decompressed
|
||||
// to Float64?
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
vtkm::cont::ArrayCopyShallowIfPossible(this->GetFieldFromDataSet(input).GetData(), compressed);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompressed;
|
||||
vtkm::worklet::ZFP1DDecompressor decompressor;
|
||||
decompressor.Decompress(compressed, decompressed, this->rate, compressed.GetNumberOfValues());
|
||||
|
||||
return this->CreateResultFieldPoint(input, "decompressed", decompressed);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPDecompressor1D.h
Normal file
44
vtkm/filter/zfp/ZFPDecompressor1D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPDecompressor1D_h
|
||||
#define vtk_m_filter_zfp_ZFPDecompressor1D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPDecompressor1D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPDecompressor1D_h
|
41
vtkm/filter/zfp/ZFPDecompressor2D.cxx
Normal file
41
vtkm/filter/zfp/ZFPDecompressor2D.cxx
Normal file
@ -0,0 +1,41 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor2D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFP2DDecompress.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
// FIXME: it looks like the compressor can compress Ints and Floats but only decompressed
|
||||
// to Float64?
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
vtkm::cont::ArrayCopyShallowIfPossible(this->GetFieldFromDataSet(input).GetData(), compressed);
|
||||
|
||||
vtkm::cont::CellSetStructured<2> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompressed;
|
||||
vtkm::worklet::ZFP2DDecompressor decompressor;
|
||||
decompressor.Decompress(compressed, decompressed, this->rate, pointDimensions);
|
||||
|
||||
return this->CreateResultFieldPoint(input, "decompressed", decompressed);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPDecompressor2D.h
Normal file
44
vtkm/filter/zfp/ZFPDecompressor2D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPDecompressor2D_h
|
||||
#define vtk_m_filter_zfp_ZFPDecompressor2D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPDecompressor2D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPDecompressor2D_h
|
41
vtkm/filter/zfp/ZFPDecompressor3D.cxx
Normal file
41
vtkm/filter/zfp/ZFPDecompressor3D.cxx
Normal file
@ -0,0 +1,41 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor3D.h>
|
||||
#include <vtkm/filter/zfp/worklet/ZFPDecompress.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
// FIXME: it looks like the compressor can compress Ints and Floats but only decompressed
|
||||
// to Float64?
|
||||
vtkm::cont::ArrayHandle<vtkm::Int64> compressed;
|
||||
vtkm::cont::ArrayCopyShallowIfPossible(this->GetFieldFromDataSet(input).GetData(), compressed);
|
||||
|
||||
vtkm::cont::CellSetStructured<3> cellSet;
|
||||
input.GetCellSet().AsCellSet(cellSet);
|
||||
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> decompressed;
|
||||
vtkm::worklet::ZFPDecompressor decompressor;
|
||||
decompressor.Decompress(compressed, decompressed, this->rate, pointDimensions);
|
||||
|
||||
return this->CreateResultFieldPoint(input, "decompressed", decompressed);
|
||||
}
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
44
vtkm/filter/zfp/ZFPDecompressor3D.h
Normal file
44
vtkm/filter/zfp/ZFPDecompressor3D.h
Normal file
@ -0,0 +1,44 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_zfp_ZFPDecompressor3D_h
|
||||
#define vtk_m_filter_zfp_ZFPDecompressor3D_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/zfp/vtkm_filter_zfp_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace zfp
|
||||
{
|
||||
/// \brief Compress a scalar field using ZFP
|
||||
|
||||
/// Takes as input a 1D array and generates on
|
||||
/// output of compressed data.
|
||||
/// @warning
|
||||
/// This filter is currently only supports 1D volumes.
|
||||
class VTKM_FILTER_ZFP_EXPORT ZFPDecompressor3D : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
void SetRate(vtkm::Float64 _rate) { rate = _rate; }
|
||||
vtkm::Float64 GetRate() { return rate; }
|
||||
|
||||
private:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Float64 rate = 0;
|
||||
};
|
||||
} // namespace zfp
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
||||
|
||||
#endif // vtk_m_filter_zfp_ZFPDecompressor3D_h
|
23
vtkm/filter/zfp/testing/CMakeLists.txt
Normal file
23
vtkm/filter/zfp/testing/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
##============================================================================
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
|
||||
set(unit_tests
|
||||
UnitTestZFP.cxx
|
||||
)
|
||||
|
||||
set(libraries
|
||||
vtkm_filter_zfp
|
||||
)
|
||||
|
||||
vtkm_unit_tests(
|
||||
SOURCES ${unit_tests}
|
||||
LIBRARIES ${libraries}
|
||||
USE_VTKM_JOB_POOL
|
||||
)
|
@ -8,21 +8,18 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/CellSetSingleType.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/filter/ZFPCompressor1D.h>
|
||||
#include <vtkm/filter/ZFPCompressor2D.h>
|
||||
#include <vtkm/filter/ZFPCompressor3D.h>
|
||||
#include <vtkm/filter/ZFPDecompressor1D.h>
|
||||
#include <vtkm/filter/ZFPDecompressor2D.h>
|
||||
#include <vtkm/filter/ZFPDecompressor3D.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor1D.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor2D.h>
|
||||
#include <vtkm/filter/zfp/ZFPCompressor3D.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor1D.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor2D.h>
|
||||
#include <vtkm/filter/zfp/ZFPDecompressor3D.h>
|
||||
|
||||
namespace vtkm_ut_zfp_filter
|
||||
namespace
|
||||
{
|
||||
|
||||
void TestZFP1DFilter(vtkm::Float64 rate)
|
||||
@ -34,8 +31,8 @@ void TestZFP1DFilter(vtkm::Float64 rate)
|
||||
dynField.AsArrayHandle(field);
|
||||
auto oport = field.ReadPortal();
|
||||
|
||||
vtkm::filter::ZFPCompressor1D compressor;
|
||||
vtkm::filter::ZFPDecompressor1D decompressor;
|
||||
vtkm::filter::zfp::ZFPCompressor1D compressor;
|
||||
vtkm::filter::zfp::ZFPDecompressor1D decompressor;
|
||||
|
||||
compressor.SetActiveField("pointvar");
|
||||
compressor.SetRate(rate);
|
||||
@ -65,16 +62,13 @@ void TestZFP2DFilter(vtkm::Float64 rate)
|
||||
dynField.AsArrayHandle(field);
|
||||
auto oport = field.ReadPortal();
|
||||
|
||||
|
||||
vtkm::filter::ZFPCompressor2D compressor;
|
||||
vtkm::filter::ZFPDecompressor2D decompressor;
|
||||
vtkm::filter::zfp::ZFPCompressor2D compressor;
|
||||
vtkm::filter::zfp::ZFPDecompressor2D decompressor;
|
||||
|
||||
compressor.SetActiveField("pointvar");
|
||||
compressor.SetRate(rate);
|
||||
auto compressed = compressor.Execute(dataset);
|
||||
|
||||
|
||||
|
||||
decompressor.SetActiveField("compressed");
|
||||
decompressor.SetRate(rate);
|
||||
auto decompress = decompressor.Execute(compressed);
|
||||
@ -99,9 +93,8 @@ void TestZFP3DFilter(vtkm::Float64 rate)
|
||||
dynField.AsArrayHandle(field);
|
||||
auto oport = field.ReadPortal();
|
||||
|
||||
|
||||
vtkm::filter::ZFPCompressor3D compressor;
|
||||
vtkm::filter::ZFPDecompressor3D decompressor;
|
||||
vtkm::filter::zfp::ZFPCompressor3D compressor;
|
||||
vtkm::filter::zfp::ZFPDecompressor3D decompressor;
|
||||
|
||||
compressor.SetActiveField("pointvar");
|
||||
compressor.SetRate(rate);
|
||||
@ -131,5 +124,5 @@ void TestZFPFilter()
|
||||
|
||||
int UnitTestZFP(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(vtkm_ut_zfp_filter::TestZFPFilter, argc, argv);
|
||||
return vtkm::cont::testing::Testing::Run(TestZFPFilter, argc, argv);
|
||||
}
|
23
vtkm/filter/zfp/worklet/CMakeLists.txt
Normal file
23
vtkm/filter/zfp/worklet/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
##============================================================================
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
|
||||
set(headers
|
||||
ZFP1DCompressor.h
|
||||
ZFP1DDecompress.h
|
||||
ZFP2DCompressor.h
|
||||
ZFP2DDecompress.h
|
||||
ZFPCompressor.h
|
||||
ZFPDecompress.h
|
||||
)
|
||||
|
||||
add_subdirectory(zfp)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
vtkm_declare_headers(${headers})
|
@ -19,8 +19,8 @@
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPEncode1.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode1.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode1.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode1.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPEncode2.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode2.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode2.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode2.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPEncode3.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode3.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <vtkm/cont/AtomicArray.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode3.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTools.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode3.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef vtk_m_worklet_zfp_block_reader_h
|
||||
#define vtk_m_worklet_zfp_block_reader_h
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -10,7 +10,7 @@
|
||||
#ifndef vtk_m_worklet_zfp_block_writer_h
|
||||
#define vtk_m_worklet_zfp_block_writer_h
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -11,10 +11,10 @@
|
||||
#define vtk_m_worklet_zfp_decode_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockReader.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockReader.h>
|
||||
#include <vtkm/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPDecode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -11,10 +11,10 @@
|
||||
#define vtk_m_worklet_zfp_encode_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPEncode.h>
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPStructs.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -11,9 +11,9 @@
|
||||
#define vtk_m_worklet_zfp_functions_h
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPBlockWriter.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPCodec.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -15,8 +15,8 @@
|
||||
#define ZFP_MAX_PREC 64 /* maximum precision supported */
|
||||
#define ZFP_MIN_EXP -1074 /* minimum floating-point base-2 exponent */
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTypeInfo.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPFunctions.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPTypeInfo.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -19,7 +19,7 @@
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/worklet/zfp/ZFPEncode3.h>
|
||||
#include <vtkm/filter/zfp/worklet/zfp/ZFPEncode3.h>
|
||||
|
||||
using ZFPWord = vtkm::UInt64;
|
||||
|
@ -57,12 +57,6 @@ set(headers
|
||||
WorkletCellNeighborhood.h
|
||||
WorkletPointNeighborhood.h
|
||||
WorkletReduceByKey.h
|
||||
ZFPCompressor.h
|
||||
ZFPDecompress.h
|
||||
ZFP1DCompressor.h
|
||||
ZFP1DDecompress.h
|
||||
ZFP2DCompressor.h
|
||||
ZFP2DDecompress.h
|
||||
)
|
||||
|
||||
|
||||
@ -103,7 +97,6 @@ add_subdirectory(tetrahedralize)
|
||||
add_subdirectory(triangulate)
|
||||
add_subdirectory(wavelets)
|
||||
add_subdirectory(particleadvection)
|
||||
add_subdirectory(zfp)
|
||||
|
||||
vtkm_library(
|
||||
NAME vtkm_worklet
|
||||
|
@ -56,7 +56,6 @@ set(unit_tests
|
||||
UnitTestWorkletReduceByKey.cxx
|
||||
UnitTestVertexClustering.cxx
|
||||
UnitTestWaveletCompressor.cxx
|
||||
UnitTestZFPCompressor.cxx
|
||||
)
|
||||
|
||||
if(HIP IN_LIST Kokkos_DEVICES)
|
||||
|
@ -1,169 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/worklet/ZFPCompressor.h>
|
||||
#include <vtkm/worklet/ZFPDecompress.h>
|
||||
|
||||
#include <vtkm/worklet/ZFP1DCompressor.h>
|
||||
#include <vtkm/worklet/ZFP1DDecompress.h>
|
||||
|
||||
#include <vtkm/worklet/ZFP2DCompressor.h>
|
||||
#include <vtkm/worklet/ZFP2DDecompress.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/worklet/zfp/ZFPTools.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
template <typename T>
|
||||
void writeArray(vtkm::cont::ArrayHandle<T>& field, std::string filename)
|
||||
{
|
||||
auto val = vtkm::worklet::zfp::detail::GetVTKMPointer(field);
|
||||
std::ofstream output(filename, std::ios::binary | std::ios::out);
|
||||
output.write(reinterpret_cast<char*>(val), field.GetNumberOfValues() * 8);
|
||||
output.close();
|
||||
|
||||
for (int i = 0; i < field.GetNumberOfValues(); i++)
|
||||
{
|
||||
std::cout << val[i] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
using Handle64 = vtkm::cont::ArrayHandle<vtkm::Float64>;
|
||||
template <typename Scalar>
|
||||
void Test1D(int rate)
|
||||
{
|
||||
vtkm::Id dims = 256;
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataset = testDataSet.Make1DUniformDataSet2();
|
||||
auto dynField = dataset.GetField("pointvar").GetData();
|
||||
|
||||
vtkm::worklet::ZFP1DCompressor compressor;
|
||||
vtkm::worklet::ZFP1DDecompressor decompressor;
|
||||
|
||||
if (vtkm::cont::IsType<Handle64>(dynField))
|
||||
{
|
||||
vtkm::cont::ArrayHandle<Scalar> handle;
|
||||
const vtkm::Id size = dynField.AsArrayHandle<Handle64>().GetNumberOfValues();
|
||||
handle.Allocate(size);
|
||||
|
||||
auto fPortal = dynField.AsArrayHandle<Handle64>().ReadPortal();
|
||||
auto hPortal = handle.WritePortal();
|
||||
for (vtkm::Id i = 0; i < size; ++i)
|
||||
{
|
||||
hPortal.Set(i, static_cast<Scalar>(fPortal.Get(i)));
|
||||
}
|
||||
|
||||
auto compressed = compressor.Compress(handle, rate, dims);
|
||||
//writeArray(compressed, "output.zfp");
|
||||
vtkm::cont::ArrayHandle<Scalar> decoded;
|
||||
decompressor.Decompress(compressed, decoded, rate, dims);
|
||||
auto oport = decoded.ReadPortal();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(oport.Get(i), fPortal.Get(i), 0.8));
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename Scalar>
|
||||
void Test2D(int rate)
|
||||
{
|
||||
vtkm::Id2 dims(16, 16);
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataset = testDataSet.Make2DUniformDataSet2();
|
||||
auto dynField = dataset.GetField("pointvar").GetData();
|
||||
|
||||
vtkm::worklet::ZFP2DCompressor compressor;
|
||||
vtkm::worklet::ZFP2DDecompressor decompressor;
|
||||
|
||||
if (vtkm::cont::IsType<Handle64>(dynField))
|
||||
{
|
||||
vtkm::cont::ArrayHandle<Scalar> handle;
|
||||
const vtkm::Id size = dynField.AsArrayHandle<Handle64>().GetNumberOfValues();
|
||||
handle.Allocate(size);
|
||||
|
||||
auto fPortal = dynField.AsArrayHandle<Handle64>().ReadPortal();
|
||||
auto hPortal = handle.WritePortal();
|
||||
for (vtkm::Id i = 0; i < size; ++i)
|
||||
{
|
||||
hPortal.Set(i, static_cast<Scalar>(fPortal.Get(i)));
|
||||
}
|
||||
|
||||
auto compressed = compressor.Compress(handle, rate, dims);
|
||||
vtkm::cont::ArrayHandle<Scalar> decoded;
|
||||
decompressor.Decompress(compressed, decoded, rate, dims);
|
||||
auto oport = decoded.ReadPortal();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(oport.Get(i), fPortal.Get(i), 0.8));
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename Scalar>
|
||||
void Test3D(int rate)
|
||||
{
|
||||
vtkm::Id3 dims(4, 4, 4);
|
||||
//vtkm::Id3 dims(4,4,7);
|
||||
//vtkm::Id3 dims(8,8,8);
|
||||
//vtkm::Id3 dims(256,256,256);
|
||||
//vtkm::Id3 dims(128,128,128);
|
||||
vtkm::cont::testing::MakeTestDataSet testDataSet;
|
||||
vtkm::cont::DataSet dataset = testDataSet.Make3DUniformDataSet3(dims);
|
||||
auto dynField = dataset.GetField("pointvar").GetData();
|
||||
|
||||
vtkm::worklet::ZFPCompressor compressor;
|
||||
vtkm::worklet::ZFPDecompressor decompressor;
|
||||
|
||||
if (vtkm::cont::IsType<Handle64>(dynField))
|
||||
{
|
||||
vtkm::cont::ArrayHandle<Scalar> handle;
|
||||
const vtkm::Id size = dynField.AsArrayHandle<Handle64>().GetNumberOfValues();
|
||||
handle.Allocate(size);
|
||||
|
||||
auto fPortal = dynField.AsArrayHandle<Handle64>().ReadPortal();
|
||||
auto hPortal = handle.WritePortal();
|
||||
for (vtkm::Id i = 0; i < size; ++i)
|
||||
{
|
||||
hPortal.Set(i, static_cast<Scalar>(fPortal.Get(i)));
|
||||
}
|
||||
|
||||
auto compressed = compressor.Compress(handle, rate, dims);
|
||||
|
||||
vtkm::cont::ArrayHandle<Scalar> decoded;
|
||||
decompressor.Decompress(compressed, decoded, rate, dims);
|
||||
auto oport = decoded.ReadPortal();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// Note the huge tolerance: This filter is clearly wrong.
|
||||
// See Issue #582.
|
||||
VTKM_TEST_ASSERT(test_equal(oport.Get(i), fPortal.Get(i), 0.8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestZFP()
|
||||
{
|
||||
Test3D<vtkm::Float64>(4);
|
||||
Test2D<vtkm::Float64>(4);
|
||||
Test1D<vtkm::Float64>(4);
|
||||
//Test3D<vtkm::Float32>(4);
|
||||
//Test3D<vtkm::Int64>(4);
|
||||
//Test3D<vtkm::Int32>(4);
|
||||
}
|
||||
|
||||
int UnitTestZFPCompressor(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(TestZFP, argc, argv);
|
||||
}
|
Loading…
Reference in New Issue
Block a user