Commit 3da8b5be authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Remove `vtkm::filter::Result`

This commit removes `vtkm::filter::Result`. All methods that used
`vtkm::filter::Result` simply change to use `vtkm::cont::Dataset` instead.
The utility API on `Result` that was used to add fields to the resulting
dataset is now available via `vtkm::filter::internal::CreateResult`.
parent cebe6820
......@@ -124,9 +124,9 @@ class GameOfLife : public vtkm::filter::FilterDataSet<GameOfLife>
public:
template <typename Policy, typename Device>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<Policy> policy,
Device)
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<Policy> policy,
Device)
{
if (!this->PrintedDeviceMsg)
......@@ -164,11 +164,11 @@ public:
vtkm::cont::Field stateField("state", vtkm::cont::Field::ASSOC_POINTS, state);
output.AddField(stateField);
return vtkm::filter::Result(output);
return output;
}
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result&,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
......
......@@ -52,7 +52,6 @@ set(headers
PolicyBase.h
PolicyDefault.h
Probe.h
Result.h
Streamline.h
SurfaceNormals.h
Tetrahedralize.h
......
......@@ -42,11 +42,11 @@ public:
CellAverage();
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
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,
const DeviceAdapter& tag);
private:
vtkm::worklet::CellAverage Worklet;
......
......@@ -19,7 +19,8 @@
//============================================================================
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/internal/CreateResult.h>
#include <vtkm/worklet/DispatcherMapTopology.h>
namespace vtkm
......@@ -36,7 +37,7 @@ inline VTKM_CONT CellAverage::CellAverage()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result CellAverage::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet CellAverage::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& inField,
const vtkm::filter::FieldMetadata& fieldMetadata,
......@@ -45,7 +46,7 @@ inline VTKM_CONT vtkm::filter::Result CellAverage::DoExecute(
{
if (!fieldMetadata.IsPointField())
{
return vtkm::filter::Result();
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
vtkm::cont::DynamicCellSet cellSet = input.GetCellSet(this->GetActiveCellSetIndex());
......@@ -66,7 +67,7 @@ inline VTKM_CONT vtkm::filter::Result CellAverage::DoExecute(
outputName = fieldMetadata.GetName();
}
return vtkm::filter::Result(
return internal::CreateResult(
input, outArray, outputName, vtkm::cont::Field::ASSOC_CELL_SET, cellSet.GetName());
}
}
......
......@@ -58,12 +58,12 @@ public:
void SetCompactPointFields(bool flag) { this->CompactPointFields = flag; }
template <typename Policy, typename Device>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& inData,
vtkm::filter::PolicyBase<Policy> policy,
Device);
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& inData,
vtkm::filter::PolicyBase<Policy> policy,
Device);
template <typename ValueType, typename Storage, typename Policy, typename Device>
VTKM_CONT bool DoMapField(vtkm::filter::Result& result,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<ValueType, Storage>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<Policy>,
......
......@@ -34,9 +34,9 @@ inline VTKM_CONT CleanGrid::CleanGrid()
}
template <typename Policy, typename Device>
inline VTKM_CONT vtkm::filter::Result CleanGrid::DoExecute(const vtkm::cont::DataSet& inData,
vtkm::filter::PolicyBase<Policy> policy,
Device)
inline VTKM_CONT vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::DataSet& inData,
vtkm::filter::PolicyBase<Policy> policy,
Device)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
......@@ -105,12 +105,12 @@ inline VTKM_CONT vtkm::filter::Result CleanGrid::DoExecute(const vtkm::cont::Dat
}
}
return Result(outData);
return outData;
}
template <typename ValueType, typename Storage, typename Policy, typename Device>
inline VTKM_CONT bool CleanGrid::DoMapField(
vtkm::filter::Result& result,
vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<ValueType, Storage>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<Policy>,
......@@ -119,11 +119,11 @@ inline VTKM_CONT bool CleanGrid::DoMapField(
if (this->GetCompactPointFields() && fieldMeta.IsPointField())
{
vtkm::cont::ArrayHandle<ValueType> compactedArray = this->MapPointField(input, Device());
result.GetDataSet().AddField(fieldMeta.AsField(compactedArray));
result.AddField(fieldMeta.AsField(compactedArray));
}
else
{
result.GetDataSet().AddField(fieldMeta.AsField(input));
result.AddField(fieldMeta.AsField(input));
}
return true;
......
......@@ -50,16 +50,16 @@ public:
vtkm::Float64 GetClipValue() const { return this->ClipValue; }
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
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,
const DeviceAdapter& tag);
//Map a new field onto the resulting dataset after running the filter.
//This call is only valid after Execute has been called.
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result& result,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......
......@@ -23,7 +23,7 @@
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DynamicArrayHandle.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/worklet/DispatcherMapTopology.h>
namespace vtkm
......@@ -66,7 +66,7 @@ inline VTKM_CONT ClipWithField::ClipWithField()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result ClipWithField::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet ClipWithField::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -77,9 +77,7 @@ inline VTKM_CONT vtkm::filter::Result ClipWithField::DoExecute(
if (fieldMeta.IsPointField() == false)
{
//todo: we need to mark this as a failure of input, not a failure
//of the algorithm
return vtkm::filter::Result();
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
//get the cells and coordinates of the dataset
......@@ -99,15 +97,13 @@ inline VTKM_CONT vtkm::filter::Result ClipWithField::DoExecute(
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData(), device);
vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray);
output.AddCoordinateSystem(outputCoords);
vtkm::filter::Result result(output);
return result;
return output;
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT bool ClipWithField::DoMapField(
vtkm::filter::Result& result,
vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
......@@ -129,8 +125,7 @@ inline VTKM_CONT bool ClipWithField::DoMapField(
}
//use the same meta data as the input so we get the same field name, etc.
result.GetDataSet().AddField(fieldMeta.AsField(output));
result.AddField(fieldMeta.AsField(output));
return true;
}
}
......
......@@ -50,14 +50,14 @@ public:
const vtkm::cont::ImplicitFunctionHandle& GetImplicitFunction() const { return this->Function; }
template <typename DerivedPolicy, typename DeviceAdapter>
vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
//Map a new field onto the resulting dataset after running the filter.
//This call is only valid after Execute has been called.
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
bool DoMapField(vtkm::filter::Result& result,
bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......
......@@ -61,7 +61,7 @@ ClipWithImplicitFunction::ClipWithImplicitFunction()
}
template <typename DerivedPolicy, typename DeviceAdapter>
inline vtkm::filter::Result ClipWithImplicitFunction::DoExecute(
inline vtkm::cont::DataSet ClipWithImplicitFunction::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& device)
......@@ -86,14 +86,13 @@ inline vtkm::filter::Result ClipWithImplicitFunction::DoExecute(
output.AddCellSet(outputCellSet);
output.AddCoordinateSystem(outputCoords);
vtkm::filter::Result result(output);
return result;
return output;
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline bool ClipWithImplicitFunction::DoMapField(
vtkm::filter::Result& result,
vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
......@@ -115,7 +114,7 @@ inline bool ClipWithImplicitFunction::DoMapField(
}
//use the same meta data as the input so we get the same field name, etc.
result.GetDataSet().AddField(fieldMeta.AsField(output));
result.AddField(fieldMeta.AsField(output));
return true;
}
......
......@@ -88,11 +88,11 @@ public:
/// Output field
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
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,
const DeviceAdapter& tag);
};
template <>
......@@ -116,11 +116,11 @@ public:
/// Output field "saddlePeak" which is pairs of vertex ids indicating saddle and peak of contour
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
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,
const DeviceAdapter& tag);
};
template <>
......
......@@ -64,6 +64,9 @@
// Proceedings of the IEEE Symposium on Large Data Analysis and Visualization
// (LDAV), October 2016, Baltimore, Maryland.
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/internal/CreateResult.h>
#include <vtkm/worklet/ContourTreeUniform.h>
namespace vtkm
......@@ -79,7 +82,7 @@ ContourTreeMesh2D::ContourTreeMesh2D()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
vtkm::filter::Result ContourTreeMesh2D::DoExecute(
vtkm::cont::DataSet ContourTreeMesh2D::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -88,8 +91,7 @@ vtkm::filter::Result ContourTreeMesh2D::DoExecute(
{
if (fieldMeta.IsPointField() == false)
{
std::cout << "ERROR: Point field expected" << std::endl;
return vtkm::filter::Result();
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
// Collect sizing information from the dataset
......@@ -108,11 +110,11 @@ vtkm::filter::Result ContourTreeMesh2D::DoExecute(
vtkm::worklet::ContourTreeMesh2D worklet;
worklet.Run(field, nRows, nCols, saddlePeak, device);
return vtkm::filter::Result(input,
saddlePeak,
this->GetOutputFieldName(),
fieldMeta.GetAssociation(),
fieldMeta.GetCellSetName());
return internal::CreateResult(input,
saddlePeak,
this->GetOutputFieldName(),
fieldMeta.GetAssociation(),
fieldMeta.GetCellSetName());
}
//-----------------------------------------------------------------------------
ContourTreeMesh3D::ContourTreeMesh3D()
......@@ -122,7 +124,7 @@ ContourTreeMesh3D::ContourTreeMesh3D()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
vtkm::filter::Result ContourTreeMesh3D::DoExecute(
vtkm::cont::DataSet ContourTreeMesh3D::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -131,8 +133,7 @@ vtkm::filter::Result ContourTreeMesh3D::DoExecute(
{
if (fieldMeta.IsPointField() == false)
{
std::cout << "ERROR: Point field expected" << std::endl;
return vtkm::filter::Result();
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
// Collect sizing information from the dataset
......@@ -152,11 +153,11 @@ vtkm::filter::Result ContourTreeMesh3D::DoExecute(
vtkm::worklet::ContourTreeMesh3D worklet;
worklet.Run(field, nRows, nCols, nSlices, saddlePeak, device);
return vtkm::filter::Result(input,
saddlePeak,
this->GetOutputFieldName(),
fieldMeta.GetAssociation(),
fieldMeta.GetCellSetName());
return internal::CreateResult(input,
saddlePeak,
this->GetOutputFieldName(),
fieldMeta.GetAssociation(),
fieldMeta.GetCellSetName());
}
}
} // namespace vtkm::filter
......@@ -130,7 +130,7 @@ public:
//@}
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(
VTKM_CONT vtkm::cont::DataSet DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -138,7 +138,7 @@ public:
const DeviceAdapter& tag);
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result& result,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......
......@@ -18,9 +18,9 @@
// this software.
//============================================================================
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/filter/internal/CreateResult.h>
#include <vtkm/worklet/DispatcherMapField.h>
namespace vtkm
{
......@@ -60,7 +60,7 @@ inline VTKM_CONT CrossProduct::CrossProduct()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result CrossProduct::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet CrossProduct::DoExecute(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMetadata,
......@@ -89,27 +89,27 @@ inline VTKM_CONT vtkm::filter::Result CrossProduct::DoExecute(
}
catch (const vtkm::cont::Error&)
{
return vtkm::filter::Result();
throw vtkm::cont::ErrorExecution("failed to execute.");
}
return vtkm::filter::Result(inDataSet,
functor.OutArray,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
return internal::CreateResult(inDataSet,
functor.OutArray,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT bool CrossProduct::DoMapField(vtkm::filter::Result& result,
inline VTKM_CONT bool CrossProduct::DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
DeviceAdapter)
{
//we copy the input handle to the result dataset, reusing the metadata
result.GetDataSet().AddField(fieldMeta.AsField(input));
result.AddField(fieldMeta.AsField(input));
return true;
}
}
......
......@@ -130,7 +130,7 @@ public:
//@}
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(
VTKM_CONT vtkm::cont::DataSet DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -138,7 +138,7 @@ public:
const DeviceAdapter& tag);
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result& result,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......
......@@ -21,6 +21,7 @@
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/filter/internal/CreateResult.h>
namespace vtkm
{
......@@ -60,7 +61,7 @@ inline VTKM_CONT DotProduct::DotProduct()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result DotProduct::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet DotProduct::DoExecute(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMetadata,
......@@ -89,26 +90,26 @@ inline VTKM_CONT vtkm::filter::Result DotProduct::DoExecute(
}
catch (const vtkm::cont::Error&)
{
return vtkm::filter::Result();
throw vtkm::cont::ErrorExecution("failed to execute.");
}
return vtkm::filter::Result(inDataSet,
functor.OutArray,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
return internal::CreateResult(inDataSet,
functor.OutArray,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT bool DotProduct::DoMapField(vtkm::filter::Result& result,
inline VTKM_CONT bool DotProduct::DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
DeviceAdapter)
{
//we copy the input handle to the result dataset, reusing the metadata
result.GetDataSet().AddField(fieldMeta.AsField(input));
result.AddField(fieldMeta.AsField(input));
return true;
}
}
......
......@@ -43,11 +43,11 @@ public:
void SetNumberOfBins(vtkm::Id count) { this->NumberOfBins = count; }
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
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,
const DeviceAdapter& tag);
private:
vtkm::Id NumberOfBins;
......
......@@ -21,6 +21,8 @@
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/FieldEntropy.h>
#include <vtkm/filter/internal/CreateResult.h>
namespace vtkm
{
namespace filter
......@@ -35,7 +37,7 @@ inline VTKM_CONT Entropy::Entropy()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result Entropy::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet Entropy::DoExecute(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMetadata,
......@@ -51,11 +53,11 @@ inline VTKM_CONT vtkm::filter::Result Entropy::DoExecute(
entropy.Allocate(1);
entropy.GetPortalControl().Set(0, e);
return vtkm::filter::Result(inDataSet,
entropy,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
return internal::CreateResult(inDataSet,
entropy,
this->GetOutputFieldName(),
fieldMetadata.GetAssociation(),
fieldMetadata.GetCellSetName());
}
}
} // namespace vtkm::filter
......@@ -64,14 +64,14 @@ public:
}
template <typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
//Map a new field onto the resulting dataset after running the filter
//this call is only valid
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result& result,
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......
......@@ -52,7 +52,7 @@ inline vtkm::filter::PolicyBase<CellSetExplicitPolicy<DerivedPolicy>> GetCellSet
//-----------------------------------------------------------------------------
template <typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::filter::Result ExternalFaces::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet ExternalFaces::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter&)
......@@ -107,14 +107,14 @@ inline VTKM_CONT vtkm::filter::Result ExternalFaces::DoExecute(
}
else
{
return vtkm::filter::Result(output);
return output;
}
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT bool ExternalFaces::DoMapField(
vtkm::filter::Result& result,
vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
......@@ -128,7 +128,7 @@ inline VTKM_CONT bool ExternalFaces::DoMapField(
}
else
{
result.GetDataSet().AddField(fieldMeta.AsField(input));
result.AddField(fieldMeta.AsField(input));
return true;
}
}
......@@ -136,7 +136,7 @@ inline VTKM_CONT bool ExternalFaces::DoMapField(
{
vtkm::cont::ArrayHandle<T> fieldArray;
fieldArray = this->Worklet.ProcessCellField(input, device);
result.GetDataSet().AddField(fieldMeta.AsField(fieldArray));
result.AddField(fieldMeta.AsField(fieldArray));
return true;
}
......
......@@ -87,13 +87,13 @@ public:
void ExtractOnlyBoundaryCellsOff() { this->ExtractOnlyBoundaryCells = false; }
template <typename DerivedPolicy, typename DeviceAdapter>
vtkm::filter::Result DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const DeviceAdapter& tag);
//Map a new field onto the resulting dataset after running the filter
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
bool DoMapField(vtkm::filter::Result& result,
bool DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,