Deprecate Execute with policy

The version of `Filter::Execute` that takes a policy as an argument is now
deprecated. Filters are now able to specify their own fields and types,
which is often why you want to customize the policy for an execution. The
other reason is that you are compiling VTK-m into some other source that
uses a particular types of storage. However, there is now a mechanism in
the CMake configuration to allow you to provide a header that customizes
the "default" types used in filters. This is a much more convenient way to
compile filters for specific types.

One thing that filters were not able to do was to customize what cell sets
they allowed using. This allows filters to self-select what types of cell
sets they support (beyond simply just structured or unstructured). To
support this, the lists `SupportedCellSets`, `SupportedStructuredCellSets`,
and `SupportedUnstructuredCellSets` have been added to `Filter`. When you
apply a policy to a cell set, you now have to also provide the filter.
This commit is contained in:
Kenneth Moreland 2020-05-15 17:47:30 -06:00
parent 963c871b76
commit 72cd0107ee
45 changed files with 265 additions and 328 deletions

@ -0,0 +1,17 @@
# Deprecate Execute with policy
The version of `Filter::Execute` that takes a policy as an argument is now
deprecated. Filters are now able to specify their own fields and types,
which is often why you want to customize the policy for an execution. The
other reason is that you are compiling VTK-m into some other source that
uses a particular types of storage. However, there is now a mechanism in
the CMake configuration to allow you to provide a header that customizes
the "default" types used in filters. This is a much more convenient way to
compile filters for specific types.
One thing that filters were not able to do was to customize what cell sets
they allowed using. This allows filters to self-select what types of cell
sets they support (beyond simply just structured or unstructured). To
support this, the lists `SupportedCellSets`, `SupportedStructuredCellSets`,
and `SupportedUnstructuredCellSets` have been added to `Filter`. When you
apply a policy to a cell set, you now have to also provide the filter.

@ -219,7 +219,9 @@ inline VTKM_CONT vtkm::cont::PartitionedDataSet MultiDeviceGradient::PrepareForE
[=]() {
vtkm::filter::Gradient perThreadGrad = gradient;
VTKM_DEPRECATED_SUPPRESS_BEGIN
vtkm::cont::DataSet result = perThreadGrad.Execute(input, policy);
VTKM_DEPRECATED_SUPPRESS_END
outPtr->ReplacePartition(0, result);
});
this->Queue.waitForAllTasksToComplete();
@ -238,7 +240,9 @@ inline VTKM_CONT vtkm::cont::PartitionedDataSet MultiDeviceGradient::PrepareForE
[=]() {
vtkm::filter::Gradient perThreadGrad = gradient;
VTKM_DEPRECATED_SUPPRESS_BEGIN
vtkm::cont::DataSet result = perThreadGrad.Execute(input, policy);
VTKM_DEPRECATED_SUPPRESS_END
outPtr->ReplacePartition(index, result);
});
index++;

@ -38,11 +38,12 @@ static vtkmdiy::ContinuousBounds convert(const vtkm::Bounds& bds)
}
template <typename DerivedPolicy>
template <typename DerivedPolicy, typename FilterType>
class Redistributor
{
const vtkmdiy::RegularDecomposer<vtkmdiy::ContinuousBounds>& Decomposer;
const vtkm::filter::PolicyBase<DerivedPolicy>& Policy;
const FilterType& Filter;
vtkm::cont::DataSet Extract(const vtkm::cont::DataSet& input,
const vtkmdiy::ContinuousBounds& bds) const
@ -53,7 +54,9 @@ class Redistributor
vtkm::filter::ExtractPoints extractor;
extractor.SetCompactPoints(true);
extractor.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(box));
VTKM_DEPRECATED_SUPPRESS_BEGIN
return extractor.Execute(input, this->Policy);
VTKM_DEPRECATED_SUPPRESS_END
}
class ConcatenateFields
@ -120,9 +123,11 @@ class Redistributor
public:
Redistributor(const vtkmdiy::RegularDecomposer<vtkmdiy::ContinuousBounds>& decomposer,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
const vtkm::filter::PolicyBase<DerivedPolicy>& policy,
const FilterType& filter)
: Decomposer(decomposer)
, Policy(policy)
, Filter(filter)
{
}
@ -140,7 +145,9 @@ public:
this->Decomposer.fill_bounds(bds, target.gid);
auto extractedDS = this->Extract(*block, bds);
VTKM_DEPRECATED_SUPPRESS_BEGIN
rp.enqueue(target, vtkm::filter::MakeSerializableDataSet(extractedDS, DerivedPolicy{}));
VTKM_DEPRECATED_SUPPRESS_END
}
// clear our dataset.
*block = vtkm::cont::DataSet();
@ -155,7 +162,7 @@ public:
auto target = rp.in_link().target(cc);
if (rp.incoming(target.gid).size() > 0)
{
auto sds = vtkm::filter::MakeSerializableDataSet(DerivedPolicy{});
auto sds = vtkm::filter::MakeSerializableDataSet(DerivedPolicy{}, this->Filter);
rp.dequeue(target.gid, sds);
receives.push_back(sds.DataSet);
numValues += receives.back().GetCoordinateSystem(0).GetNumberOfPoints();
@ -237,7 +244,8 @@ inline VTKM_CONT vtkm::cont::PartitionedDataSet RedistributePoints::PrepareForEx
*ds = input.GetPartition(lid);
});
internal::Redistributor<DerivedPolicy> redistributor(decomposer, policy);
internal::Redistributor<DerivedPolicy, RedistributePoints> redistributor(
decomposer, policy, *this);
vtkmdiy::all_to_all(master, assigner, redistributor, /*k=*/2);
vtkm::cont::PartitionedDataSet result;

@ -16,7 +16,6 @@
#include <vtkm/filter/PointAverage.h>
#include <vtkm/filter/PointAverage.hxx>
#include <vtkm/filter/PolicyExtrude.h>
namespace
{
@ -144,7 +143,7 @@ int TestCellSetExtrude()
try
{
avg.SetActiveField("cfield");
auto result = avg.Execute(dataset, vtkm::filter::PolicyExtrude{});
auto result = avg.Execute(dataset);
VTKM_TEST_ASSERT(result.HasPointField("cfield"), "filter resulting dataset should be valid");
}
catch (const vtkm::cont::Error& err)

@ -37,7 +37,8 @@ inline VTKM_CONT vtkm::cont::DataSet CellAverage::DoExecute(
//If the input is implicit, we should know what to fall back to
vtkm::cont::ArrayHandle<T> outArray;
this->Invoke(this->Worklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), inField, outArray);
this->Invoke(
this->Worklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy, *this), inField, outArray);
std::string outputName = this->GetOutputFieldName();
if (outputName.empty())

@ -45,7 +45,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellMeasures<IntegrationType>::DoExecute(
vtkm::cont::ArrayHandle<T> outArray;
this->Invoke(vtkm::worklet::CellMeasure<IntegrationType>{},
vtkm::filter::ApplyPolicyCellSet(cellset, policy),
vtkm::filter::ApplyPolicyCellSet(cellset, policy, *this),
points,
outArray);

@ -32,7 +32,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellSetConnectivity::DoExecute(
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::CellSetConnectivity().Run(
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy), component);
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy, *this), component);
return CreateResultFieldCell(input, component, this->GetOutputFieldName());
}

@ -37,7 +37,7 @@ inline VTKM_CONT vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::Data
}
else
{ // Clean the grid
auto deducedCellSet = vtkm::filter::ApplyPolicyCellSet(inCellSet, policy);
auto deducedCellSet = vtkm::filter::ApplyPolicyCellSet(inCellSet, policy, *this);
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
this->Invoke(worklet::CellDeepCopy::CountCellPoints{}, deducedCellSet, numIndices);

@ -41,7 +41,7 @@ inline VTKM_CONT vtkm::cont::DataSet ClipWithField::DoExecute(
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
vtkm::cont::CellSetExplicit<> outputCellSet = this->Worklet.Run(
vtkm::filter::ApplyPolicyCellSet(cells, policy), field, this->ClipValue, this->Invert);
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this), field, this->ClipValue, this->Invert);
//create the output data
vtkm::cont::DataSet output;

@ -31,8 +31,11 @@ inline vtkm::cont::DataSet ClipWithImplicitFunction::DoExecute(
const vtkm::cont::CoordinateSystem& inputCoords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
vtkm::cont::CellSetExplicit<> outputCellSet = this->Worklet.Run(
vtkm::filter::ApplyPolicyCellSet(cells, policy), this->Function, inputCoords, this->Invert);
vtkm::cont::CellSetExplicit<> outputCellSet =
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
this->Function,
inputCoords,
this->Invert);
// compute output coordinates
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData());

@ -98,7 +98,7 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
if (this->GenerateNormals && generateHighQualityNormals)
{
outputCells = this->Worklet.Run(ivalues,
vtkm::filter::ApplyPolicyCellSet(cells, policy),
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
coords.GetData(),
field,
vertices,
@ -106,8 +106,11 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
}
else
{
outputCells = this->Worklet.Run(
ivalues, vtkm::filter::ApplyPolicyCellSet(cells, policy), coords.GetData(), field, vertices);
outputCells = this->Worklet.Run(ivalues,
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
coords.GetData(),
field,
vertices);
}
if (this->GenerateNormals)

@ -624,7 +624,7 @@ vtkm::cont::DataSet ContourTreeAugmented::DoExecute(
vtkm::Id nCols;
vtkm::Id nSlices = 1;
const auto& cells = input.GetCellSet();
vtkm::filter::ApplyPolicyCellSet(cells, policy)
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this)
.CastAndCall(GetRowsColsSlices(), nRows, nCols, nSlices);
// TODO blockIndex needs to change if we have multiple blocks per MPI rank and DoExecute is called for multiple blocks
std::size_t blockIndex = 0;

@ -56,7 +56,7 @@ vtkm::cont::DataSet ExternalFaces::GenerateOutput(const vtkm::cont::DataSet& inp
{
this->Compactor.SetCompactPointFields(true);
this->Compactor.SetMergePoints(false);
return this->Compactor.Execute(output, PolicyDefault{});
return this->Compactor.Execute(output);
}
else
{

@ -37,7 +37,8 @@ inline VTKM_CONT vtkm::cont::DataSet ExternalFaces::DoExecute(
}
else
{
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSetUnstructured(cells, policy), outCellSet);
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSetUnstructured(cells, policy, *this),
outCellSet);
}
return this->GenerateOutput(input, outCellSet);

@ -93,7 +93,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractGeometry::DoExecute(
this->ExtractInside,
this->ExtractBoundaryCells,
this->ExtractOnlyBoundaryCells);
vtkm::filter::ApplyPolicyCellSet(cells, policy).CastAndCall(worker);
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this).CastAndCall(worker);
// create the output dataset
vtkm::cont::DataSet output;

@ -41,7 +41,7 @@ inline vtkm::cont::DataSet ExtractPoints::DoExecute(const vtkm::cont::DataSet& i
vtkm::cont::CellSetSingleType<> outCellSet;
vtkm::worklet::ExtractPoints worklet;
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
coords.GetData(),
this->Function,
this->ExtractInside);
@ -56,7 +56,7 @@ inline vtkm::cont::DataSet ExtractPoints::DoExecute(const vtkm::cont::DataSet& i
{
this->Compactor.SetCompactPointFields(true);
this->Compactor.SetMergePoints(false);
return this->Compactor.Execute(output, PolicyDefault{});
return this->Compactor.Execute(output);
}
else
{

@ -24,7 +24,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractStructured::DoExecute(
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coordinates = input.GetCoordinateSystem();
auto cellset = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSetStructured(cells, policy),
auto cellset = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSetStructured(cells, policy, *this),
this->VOI,
this->SampleRate,
this->IncludeBoundary,

@ -181,21 +181,39 @@ public:
/// \brief Specify which subset of types a filter supports.
///
/// A filter is able to state what subset of types it supports
/// by default. By default we use ListUniversal to represent that the
/// filter accepts all types specified by the users provided policy
/// A filter is able to state what subset of types it supports.
using SupportedTypes = VTKM_DEFAULT_TYPE_LIST;
/// \brief Specify which additional field storage to support.
///
/// When a filter gets a field value from a DataSet, it has to determine what type
/// of storage the array has. Typically this is taken from the policy passed to
/// the filter's execute. In some cases it is useful to support additional types.
/// For example, the filter might make sense to support ArrayHandleIndex or
/// of storage the array has. Typically this is taken from the default storage
/// types defined in DefaultTypes.h. In some cases it is useful to support additional
/// types. For example, the filter might make sense to support ArrayHandleIndex or
/// ArrayHandleConstant. If so, the storage of those additional types should be
/// listed here.
using AdditionalFieldStorage = vtkm::ListEmpty;
/// \brief Specify which structured cell sets to support.
///
/// When a filter gets a cell set from a DataSet, it has to determine what type
/// of concrete cell set it is. This provides a list of supported structured
/// cell sets.
using SupportedStructuredCellSets = VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED;
/// \brief Specify which unstructured cell sets to support.
///
/// When a filter gets a cell set from a DataSet, it has to determine what type
/// of concrete cell set it is. This provides a list of supported unstructured
/// cell sets.
using SupportedUnstructuredCellSets = VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED;
/// \brief Specify which unstructured cell sets to support.
///
/// When a filter gets a cell set from a DataSet, it has to determine what type
/// of concrete cell set it is. This provides a list of supported cell sets.
using SupportedCellSets = VTKM_DEFAULT_CELL_SET_LIST;
//@{
/// \brief Specify which fields get passed from input to output.
///
@ -242,8 +260,11 @@ public:
VTKM_CONT vtkm::cont::DataSet Execute(const vtkm::cont::DataSet& input);
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::DataSet Execute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
VTKM_DEPRECATED(1.6,
"Filter::Execute no longer guarantees policy modifications. "
"Specify default types in CMake configuration instead.")
VTKM_CONT vtkm::cont::DataSet
Execute(const vtkm::cont::DataSet& input, vtkm::filter::PolicyBase<DerivedPolicy> policy);
//@}
//@{
@ -253,6 +274,9 @@ public:
VTKM_CONT vtkm::cont::PartitionedDataSet Execute(const vtkm::cont::PartitionedDataSet& input);
template <typename DerivedPolicy>
VTKM_DEPRECATED(1.6,
"Filter::Execute no longer guarantees policy modifications. "
"Specify default types in CMake configuration instead.")
VTKM_CONT vtkm::cont::PartitionedDataSet Execute(const vtkm::cont::PartitionedDataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
//@}

@ -249,7 +249,16 @@ inline VTKM_CONT Filter<Derived>::~Filter()
template <typename Derived>
inline VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(const vtkm::cont::DataSet& input)
{
return this->Execute(input, vtkm::filter::PolicyDefault());
VTKM_LOG_SCOPE(
vtkm::cont::LogLevel::Perf, "Filter: '%s'", vtkm::cont::TypeToString<Derived>().c_str());
Derived* self = static_cast<Derived*>(this);
vtkm::cont::PartitionedDataSet output = self->Execute(vtkm::cont::PartitionedDataSet(input));
if (output.GetNumberOfPartitions() > 1)
{
throw vtkm::cont::ErrorFilterExecution("Expecting at most 1 block.");
}
return output.GetNumberOfPartitions() == 1 ? output.GetPartition(0) : vtkm::cont::DataSet();
}
//----------------------------------------------------------------------------
@ -257,7 +266,23 @@ template <typename Derived>
inline VTKM_CONT vtkm::cont::PartitionedDataSet Filter<Derived>::Execute(
const vtkm::cont::PartitionedDataSet& input)
{
return this->Execute(input, vtkm::filter::PolicyDefault());
VTKM_LOG_SCOPE(vtkm::cont::LogLevel::Perf,
"Filter (PartitionedDataSet): '%s'",
vtkm::cont::TypeToString<Derived>().c_str());
Derived* self = static_cast<Derived*>(this);
vtkm::filter::PolicyDefault policy;
// Call `void Derived::PreExecute<DerivedPolicy>(input, policy)`, if defined.
internal::CallPreExecute(self, input, policy);
// Call `PrepareForExecution` (which should probably be renamed at some point)
vtkm::cont::PartitionedDataSet output = internal::CallPrepareForExecution(self, input, policy);
// Call `Derived::PostExecute<DerivedPolicy>(input, output, policy)` if defined.
internal::CallPostExecute(self, input, output, policy);
return output;
}
@ -272,8 +297,10 @@ VTKM_CONT vtkm::cont::DataSet Filter<Derived>::Execute(
vtkm::cont::LogLevel::Perf, "Filter: '%s'", vtkm::cont::TypeToString<Derived>().c_str());
Derived* self = static_cast<Derived*>(this);
VTKM_DEPRECATED_SUPPRESS_BEGIN
vtkm::cont::PartitionedDataSet output =
self->Execute(vtkm::cont::PartitionedDataSet(input), policy);
VTKM_DEPRECATED_SUPPRESS_END
if (output.GetNumberOfPartitions() > 1)
{
throw vtkm::cont::ErrorFilterExecution("Expecting at most 1 block.");

@ -17,7 +17,9 @@ namespace vtkm
namespace filter
{
struct GhostCellClassifyPolicy : vtkm::filter::PolicyBase<GhostCellClassifyPolicy>
struct VTKM_DEPRECATED(1.6,
"GhostCellClassifyPolicy no longer has an effect.") GhostCellClassifyPolicy
: vtkm::filter::PolicyBase<GhostCellClassifyPolicy>
{
using FieldTypeList = vtkm::List<vtkm::UInt8>;
};

@ -335,14 +335,14 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute(
if (this->GetRemoveAllGhost())
{
cellOut = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
cellOut = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
fieldMeta.GetAssociation(),
RemoveAllGhosts());
}
else if (this->GetRemoveByType())
{
cellOut = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
cellOut = this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
fieldMeta.GetAssociation(),
RemoveGhostByType(this->GetRemoveType()));

@ -86,13 +86,13 @@ inline vtkm::cont::DataSet Gradient::DoExecute(
{
vtkm::worklet::PointGradient gradient;
outArray = gradient.Run(
vtkm::filter::ApplyPolicyCellSet(cells, policy), coords, inField, gradientfields);
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this), coords, inField, gradientfields);
}
else
{
vtkm::worklet::CellGradient gradient;
outArray = gradient.Run(
vtkm::filter::ApplyPolicyCellSet(cells, policy), coords, inField, gradientfields);
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this), coords, inField, gradientfields);
}
if (!this->RowOrdering)
{

@ -31,7 +31,7 @@ inline VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute(
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::ImageConnectivity().Run(
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy), field, component);
vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy, *this), field, component);
auto result = CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata);
return result;

@ -108,7 +108,7 @@ inline VTKM_CONT vtkm::cont::DataSet ImageMedian::DoExecute(
if (this->Neighborhood == 1 || this->Neighborhood == 2)
{
this->Invoke(worklet::ImageMedian{ this->Neighborhood },
vtkm::filter::ApplyPolicyCellSetStructured(cells, policy),
vtkm::filter::ApplyPolicyCellSetStructured(cells, policy, *this),
field,
result);
}

@ -56,7 +56,7 @@ inline VTKM_CONT vtkm::cont::DataSet Mask::DoExecute(const vtkm::cont::DataSet&
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::DynamicCellSet cellOut;
CallWorklet workletCaller(this->Stride, cellOut, this->Worklet);
vtkm::filter::ApplyPolicyCellSet(cells, policy).CastAndCall(workletCaller);
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this).CastAndCall(workletCaller);
// create the output dataset
vtkm::cont::DataSet output;

@ -37,7 +37,7 @@ inline VTKM_CONT vtkm::cont::DataSet MaskPoints::DoExecute(
vtkm::cont::CellSetSingleType<> outCellSet;
vtkm::worklet::MaskPoints worklet;
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy), this->Stride);
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this), this->Stride);
// create the output dataset
vtkm::cont::DataSet output;
@ -49,7 +49,7 @@ inline VTKM_CONT vtkm::cont::DataSet MaskPoints::DoExecute(
{
this->Compactor.SetCompactPointFields(true);
this->Compactor.SetMergePoints(false);
return this->Compactor.Execute(output, PolicyDefault{});
return this->Compactor.Execute(output);
}
else
{

@ -69,13 +69,15 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
vtkm::worklet::MeshQuality<CellMetric> subWorklet;
vtkm::cont::ArrayHandle<T> array;
subWorklet.SetMetric(vtkm::filter::CellMetric::AREA);
this->Invoke(subWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), points, array);
this->Invoke(
subWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy, *this), points, array);
T zero = 0.0;
vtkm::FloatDefault totalArea = (vtkm::FloatDefault)vtkm::cont::Algorithm::Reduce(array, zero);
vtkm::FloatDefault averageVolume = 1.;
subWorklet.SetMetric(vtkm::filter::CellMetric::VOLUME);
this->Invoke(subWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), points, array);
this->Invoke(
subWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy, *this), points, array);
vtkm::FloatDefault totalVolume = (vtkm::FloatDefault)vtkm::cont::Algorithm::Reduce(array, zero);
vtkm::Id numVals = array.GetNumberOfValues();
@ -91,7 +93,8 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
//Invoke the MeshQuality worklet
vtkm::cont::ArrayHandle<T> outArray;
qualityWorklet.SetMetric(this->MyMetric);
this->Invoke(qualityWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), points, outArray);
this->Invoke(
qualityWorklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy, *this), points, outArray);
vtkm::cont::DataSet result;
result.CopyStructure(input); //clone of the input dataset

@ -14,6 +14,7 @@
#include <vtkm/filter/vtkm_filter_export.h>
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/cont/CellSetExtrude.h>
#include <vtkm/filter/FilterCell.h>
#include <vtkm/worklet/PointAverage.h>
@ -36,6 +37,11 @@ public:
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
// PointAverage is a simple filter that is used to test custom filter types.
using AdditionalFieldStorage = vtkm::List<vtkm::cont::internal::StorageTagExtrude>;
using SupportedCellSets =
vtkm::ListAppend<vtkm::List<vtkm::cont::CellSetExtrude>, VTKM_DEFAULT_CELL_SET_LIST>;
private:
vtkm::worklet::PointAverage Worklet;
};

@ -37,7 +37,8 @@ inline VTKM_CONT vtkm::cont::DataSet PointAverage::DoExecute(
//todo: we need to ask the policy what storage type we should be using
//If the input is implicit, we should know what to fall back to
vtkm::cont::ArrayHandle<T> outArray;
this->Invoke(this->Worklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy), inField, outArray);
this->Invoke(
this->Worklet, vtkm::filter::ApplyPolicyCellSet(cellSet, policy, *this), inField, outArray);
std::string outputName = this->GetOutputFieldName();
if (outputName.empty())

@ -277,7 +277,20 @@ ApplyPolicyFieldActive(const vtkm::cont::Field& field,
///
/// Adjusts the types of `CellSet`s to support those types specified in a policy.
///
template <typename DerivedPolicy, typename DerivedFilter>
VTKM_CONT vtkm::cont::DynamicCellSetBase<vtkm::ListAppend<typename DerivedFilter::SupportedCellSets,
typename DerivedPolicy::AllCellSetList>>
ApplyPolicyCellSet(const vtkm::cont::DynamicCellSet& cellset,
vtkm::filter::PolicyBase<DerivedPolicy>,
const vtkm::filter::Filter<DerivedFilter>&)
{
using CellSetList = vtkm::ListAppend<typename DerivedFilter::SupportedCellSets,
typename DerivedPolicy::AllCellSetList>;
return cellset.ResetCellSetList(CellSetList());
}
template <typename DerivedPolicy>
VTKM_DEPRECATED(1.6, "ApplyPolicyCellSet now takes the filter as an argument.")
VTKM_CONT vtkm::cont::DynamicCellSetBase<typename DerivedPolicy::AllCellSetList> ApplyPolicyCellSet(
const vtkm::cont::DynamicCellSet& cellset,
vtkm::filter::PolicyBase<DerivedPolicy>)
@ -292,10 +305,25 @@ VTKM_CONT vtkm::cont::DynamicCellSetBase<typename DerivedPolicy::AllCellSetList>
/// Adjusts the types of `CellSet`s to support those structured cell set types
/// specified in a policy.
///
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::DynamicCellSetBase<typename DerivedPolicy::StructuredCellSetList>
template <typename DerivedPolicy, typename DerivedFilter>
VTKM_CONT vtkm::cont::DynamicCellSetBase<
vtkm::ListAppend<typename DerivedFilter::SupportedStructuredCellSets,
typename DerivedPolicy::StructuredCellSetList>>
ApplyPolicyCellSetStructured(const vtkm::cont::DynamicCellSet& cellset,
vtkm::filter::PolicyBase<DerivedPolicy>)
vtkm::filter::PolicyBase<DerivedPolicy>,
const vtkm::filter::Filter<DerivedFilter>&)
{
using CellSetList = vtkm::ListAppend<typename DerivedFilter::SupportedStructuredCellSets,
typename DerivedPolicy::StructuredCellSetList>;
return cellset.ResetCellSetList(CellSetList());
}
template <typename DerivedPolicy>
VTKM_DEPRECATED(1.6, "ApplyPolicyCellSetStructured now takes the filter as an argument.")
VTKM_CONT vtkm::cont::
DynamicCellSetBase<typename DerivedPolicy::StructuredCellSetList> ApplyPolicyCellSetStructured(
const vtkm::cont::DynamicCellSet& cellset,
vtkm::filter::PolicyBase<DerivedPolicy>)
{
using CellSetList = typename DerivedPolicy::StructuredCellSetList;
return cellset.ResetCellSetList(CellSetList());
@ -307,10 +335,26 @@ ApplyPolicyCellSetStructured(const vtkm::cont::DynamicCellSet& cellset,
/// Adjusts the types of `CellSet`s to support those unstructured cell set types
/// specified in a policy.
///
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::DynamicCellSetBase<typename DerivedPolicy::UnstructuredCellSetList>
template <typename DerivedPolicy, typename DerivedFilter>
VTKM_CONT vtkm::cont::DynamicCellSetBase<
vtkm::ListAppend<typename DerivedFilter::SupportedUnstructuredCellSets,
typename DerivedPolicy::UnstructuredCellSetList>>
ApplyPolicyCellSetUnstructured(const vtkm::cont::DynamicCellSet& cellset,
vtkm::filter::PolicyBase<DerivedPolicy>)
vtkm::filter::PolicyBase<DerivedPolicy>,
const vtkm::filter::Filter<DerivedFilter>&)
{
using CellSetList = vtkm::ListAppend<typename DerivedFilter::SupportedUnstructuredCellSets,
typename DerivedPolicy::UnstructuredCellSetList>;
return cellset.ResetCellSetList(CellSetList());
}
template <typename DerivedPolicy>
VTKM_DEPRECATED(1.6, "ApplyPolicyCellSetUnstructured now takes the filter as an argument.")
VTKM_CONT vtkm::cont::DynamicCellSetBase<
typename DerivedPolicy::
UnstructuredCellSetList> ApplyPolicyCellSetUnstructured(const vtkm::cont::DynamicCellSet&
cellset,
vtkm::filter::PolicyBase<DerivedPolicy>)
{
using CellSetList = typename DerivedPolicy::UnstructuredCellSetList;
return cellset.ResetCellSetList(CellSetList());
@ -332,21 +376,54 @@ MakeSerializableField(const vtkm::cont::Field& field, vtkm::filter::PolicyBase<D
}
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::AllCellSetList>
MakeSerializableDataSet(vtkm::filter::PolicyBase<DerivedPolicy>)
VTKM_DEPRECATED(1.6, "MakeSerializableDataSet now takes the filter as an argument.")
VTKM_CONT vtkm::cont::SerializableDataSet<
typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::AllCellSetList> MakeSerializableDataSet(vtkm::filter::
PolicyBase<DerivedPolicy>)
{
return {};
}
template <typename DerivedPolicy, typename DerivedFilter>
VTKM_CONT
vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
vtkm::ListAppend<typename DerivedFilter::SupportedCellSets,
typename DerivedPolicy::AllCellSetList>>
MakeSerializableDataSet(vtkm::filter::PolicyBase<DerivedPolicy>,
const vtkm::filter::Filter<DerivedFilter>&)
{
return {};
}
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::AllCellSetList>
MakeSerializableDataSet(const vtkm::cont::DataSet& dataset, vtkm::filter::PolicyBase<DerivedPolicy>)
VTKM_DEPRECATED(1.6, "MakeSerializableDataSet now takes the filter as an argument.")
VTKM_CONT vtkm::cont::SerializableDataSet<
typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::AllCellSetList> MakeSerializableDataSet(const vtkm::cont::DataSet&
dataset,
vtkm::filter::PolicyBase<
DerivedPolicy>)
{
return vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::AllCellSetList>{ dataset };
}
template <typename DerivedPolicy, typename DerivedFilter>
VTKM_CONT
vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
vtkm::ListAppend<typename DerivedFilter::SupportedCellSets,
typename DerivedPolicy::AllCellSetList>>
MakeSerializableDataSet(const vtkm::cont::DataSet& dataset,
vtkm::filter::PolicyBase<DerivedPolicy>,
const vtkm::filter::Filter<DerivedFilter>&)
{
return vtkm::cont::SerializableDataSet<typename DerivedPolicy::FieldTypeList,
vtkm::ListAppend<typename DerivedFilter::SupportedCellSets,
typename DerivedPolicy::AllCellSetList>>{
dataset
};
}
}
} // vtkm::filter

@ -28,14 +28,14 @@ VTKM_CONT inline vtkm::cont::DataSet Probe::DoExecute(
const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy),
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(input.GetCellSet(), policy, *this),
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
this->Geometry.GetCoordinateSystem().GetData());
auto output = this->Geometry;
auto hpf = this->Worklet.GetHiddenPointsField();
auto hcf = this->Worklet.GetHiddenCellsField(
vtkm::filter::ApplyPolicyCellSet(output.GetCellSet(), policy));
vtkm::filter::ApplyPolicyCellSet(output.GetCellSet(), policy, *this));
output.AddField(vtkm::cont::make_FieldPoint("HIDDEN", hpf));
output.AddField(vtkm::cont::make_FieldCell("HIDDEN", hcf));

@ -41,7 +41,7 @@ inline VTKM_CONT vtkm::cont::DataSet SplitSharpEdges::DoExecute(
vtkm::cont::ArrayHandle<vtkm::Vec3f> newCoords;
vtkm::cont::CellSetExplicit<> newCellset;
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
this->FeatureAngle,
field,
input.GetCoordinateSystem().GetData(),

@ -83,7 +83,8 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
throw vtkm::cont::ErrorFilterExecution("No normals selected.");
}
const auto cellset = vtkm::filter::ApplyPolicyCellSetUnstructured(input.GetCellSet(), policy);
const auto cellset =
vtkm::filter::ApplyPolicyCellSetUnstructured(input.GetCellSet(), policy, *this);
const auto& coords = input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()).GetData();
vtkm::cont::ArrayHandle<vtkm::Vec3f> faceNormals;

@ -46,8 +46,10 @@ inline VTKM_CONT vtkm::cont::DataSet Tetrahedralize::DoExecute(
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::CellSetSingleType<> outCellSet;
vtkm::cont::CastAndCall(
vtkm::filter::ApplyPolicyCellSet(cells, policy), DeduceCellSet{}, this->Worklet, outCellSet);
vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
DeduceCellSet{},
this->Worklet,
outCellSet);
// create the output dataset
vtkm::cont::DataSet output;

@ -68,8 +68,11 @@ inline VTKM_CONT vtkm::cont::DataSet Threshold::DoExecute(
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
ThresholdRange predicate(this->GetLowerThreshold(), this->GetUpperThreshold());
vtkm::cont::DynamicCellSet cellOut = this->Worklet.Run(
vtkm::filter::ApplyPolicyCellSet(cells, policy), field, fieldMeta.GetAssociation(), predicate);
vtkm::cont::DynamicCellSet cellOut =
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
fieldMeta.GetAssociation(),
predicate);
vtkm::cont::DataSet output;
output.SetCellSet(cellOut);

@ -146,14 +146,14 @@ inline VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(
{
case THRESHOLD_BELOW:
{
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
ValuesBelow(this->GetLowerThreshold()));
break;
}
case THRESHOLD_ABOVE:
{
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
ValuesAbove(this->GetUpperThreshold()));
break;
@ -161,7 +161,7 @@ inline VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(
case THRESHOLD_BETWEEN:
default:
{
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy),
outCellSet = worklet.Run(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this),
field,
ValuesBetween(this->GetLowerThreshold(), this->GetUpperThreshold()));
break;
@ -178,7 +178,7 @@ inline VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(
{
this->Compactor.SetCompactPointFields(true);
this->Compactor.SetMergePoints(true);
return this->Compactor.Execute(output, PolicyDefault{});
return this->Compactor.Execute(output);
}
else
{

@ -70,7 +70,7 @@ inline VTKM_CONT vtkm::cont::DataSet Triangulate::DoExecute(
vtkm::cont::CellSetSingleType<> outCellSet;
DeduceCellSet triangulate(this->Worklet, outCellSet);
vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicyCellSet(cells, policy), triangulate);
vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicyCellSet(cells, policy, *this), triangulate);
// create the output dataset
vtkm::cont::DataSet output;

@ -33,11 +33,11 @@ inline VTKM_CONT vtkm::cont::DataSet VertexClustering::DoExecute(
//need to compute bounds first
vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds();
vtkm::cont::DataSet outDataSet =
this->Worklet.Run(vtkm::filter::ApplyPolicyCellSetUnstructured(input.GetCellSet(), policy),
input.GetCoordinateSystem(),
bounds,
this->GetNumberOfDivisions());
vtkm::cont::DataSet outDataSet = this->Worklet.Run(
vtkm::filter::ApplyPolicyCellSetUnstructured(input.GetCellSet(), policy, *this),
input.GetCoordinateSystem(),
bounds,
this->GetNumberOfDivisions());
return outDataSet;
}

@ -16,7 +16,6 @@ set(unit_tests
UnitTestClipWithFieldFilter.cxx
UnitTestClipWithImplicitFunctionFilter.cxx
UnitTestContourFilter.cxx
UnitTestContourFilterCustomPolicy.cxx
UnitTestContourFilterNormals.cxx
UnitTestContourTreeUniformFilter.cxx
UnitTestContourTreeUniformAugmentedFilter.cxx

@ -1,218 +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/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/DataSetFieldAdd.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/filter/Contour.hxx>
namespace vtkm_ut_mc_policy
{
class EuclideanNorm
{
public:
VTKM_EXEC_CONT
EuclideanNorm()
: Reference(0., 0., 0.)
{
}
VTKM_EXEC_CONT
EuclideanNorm(vtkm::Vec3f_32 reference)
: Reference(reference)
{
}
VTKM_EXEC_CONT
vtkm::Float32 operator()(vtkm::Vec3f_32 v) const
{
vtkm::Vec3f_32 d(
v[0] - this->Reference[0], v[1] - this->Reference[1], v[2] - this->Reference[2]);
return vtkm::Magnitude(d);
}
private:
vtkm::Vec3f_32 Reference;
};
class CubeGridConnectivity
{
public:
VTKM_EXEC_CONT
CubeGridConnectivity()
: Dimension(1)
, DimSquared(1)
, DimPlus1Squared(4)
{
}
VTKM_EXEC_CONT
CubeGridConnectivity(vtkm::Id dim)
: Dimension(dim)
, DimSquared(dim * dim)
, DimPlus1Squared((dim + 1) * (dim + 1))
{
}
VTKM_EXEC_CONT
vtkm::Id operator()(vtkm::Id vertex) const
{
using HexTag = vtkm::CellShapeTagHexahedron;
using HexTraits = vtkm::CellTraits<HexTag>;
vtkm::Id cellId = vertex / HexTraits::NUM_POINTS;
vtkm::Id localId = vertex % HexTraits::NUM_POINTS;
vtkm::Id globalId =
(cellId + cellId / this->Dimension + (this->Dimension + 1) * (cellId / (this->DimSquared)));
switch (localId)
{
case 0:
break;
case 1:
globalId += 1;
break;
case 2:
globalId += this->Dimension + 2;
break;
case 3:
globalId += this->Dimension + 1;
break;
case 4:
globalId += this->DimPlus1Squared;
break;
case 5:
globalId += this->DimPlus1Squared + 1;
break;
case 6:
globalId += this->Dimension + this->DimPlus1Squared + 2;
break;
case 7:
globalId += this->Dimension + this->DimPlus1Squared + 1;
break;
}
return globalId;
}
private:
vtkm::Id Dimension;
vtkm::Id DimSquared;
vtkm::Id DimPlus1Squared;
};
class MakeRadiantDataSet
{
public:
using CoordinateArrayHandle = vtkm::cont::ArrayHandleUniformPointCoordinates;
using DataArrayHandle =
vtkm::cont::ArrayHandleTransform<vtkm::cont::ArrayHandleUniformPointCoordinates, EuclideanNorm>;
using ConnectivityArrayHandle =
vtkm::cont::ArrayHandleTransform<vtkm::cont::ArrayHandleCounting<vtkm::Id>,
CubeGridConnectivity>;
using CellSet = vtkm::cont::CellSetSingleType<
vtkm::cont::ArrayHandleTransform<vtkm::cont::ArrayHandleCounting<vtkm::Id>,
CubeGridConnectivity>::StorageTag>;
vtkm::cont::DataSet Make3DRadiantDataSet(vtkm::IdComponent dim = 5);
};
class PolicyRadiantDataSet : public vtkm::filter::PolicyBase<PolicyRadiantDataSet>
{
public:
using TypeListRadiantCellSetTypes = vtkm::List<MakeRadiantDataSet::CellSet>;
using AllCellSetList = TypeListRadiantCellSetTypes;
};
inline vtkm::cont::DataSet MakeRadiantDataSet::Make3DRadiantDataSet(vtkm::IdComponent dim)
{
// create a cube from -.5 to .5 in x,y,z, consisting of <dim> cells on each
// axis, with point values equal to the Euclidean distance from the origin.
vtkm::cont::DataSet dataSet;
using HexTag = vtkm::CellShapeTagHexahedron;
using HexTraits = vtkm::CellTraits<HexTag>;
using CoordType = vtkm::Vec3f_32;
const vtkm::IdComponent nCells = dim * dim * dim;
vtkm::Float32 spacing = vtkm::Float32(1. / dim);
CoordinateArrayHandle coordinates(vtkm::Id3(dim + 1, dim + 1, dim + 1),
CoordType(-.5, -.5, -.5),
CoordType(spacing, spacing, spacing));
DataArrayHandle distanceToOrigin(coordinates);
DataArrayHandle distanceToOther(coordinates, EuclideanNorm(CoordType(1., 1., 1.)));
ConnectivityArrayHandle connectivity(
vtkm::cont::ArrayHandleCounting<vtkm::Id>(0, 1, nCells * HexTraits::NUM_POINTS),
CubeGridConnectivity(dim));
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
//Set point scalar
dataSet.AddField(vtkm::cont::Field(
"distanceToOrigin", vtkm::cont::Field::Association::POINTS, distanceToOrigin));
dataSet.AddField(
vtkm::cont::Field("distanceToOther", vtkm::cont::Field::Association::POINTS, distanceToOther));
CellSet cellSet;
cellSet.Fill(coordinates.GetNumberOfValues(), HexTag::Id, HexTraits::NUM_POINTS, connectivity);
dataSet.SetCellSet(cellSet);
return dataSet;
}
void TestContourCustomPolicy()
{
std::cout << "Testing Contour filter with custom field and cellset" << std::endl;
using DataSetGenerator = MakeRadiantDataSet;
DataSetGenerator dataSetGenerator;
const vtkm::IdComponent Dimension = 10;
vtkm::cont::DataSet dataSet = dataSetGenerator.Make3DRadiantDataSet(Dimension);
vtkm::filter::Contour mc;
mc.SetGenerateNormals(false);
mc.SetIsoValue(0, 0.45);
mc.SetIsoValue(1, 0.45);
mc.SetIsoValue(2, 0.45);
mc.SetIsoValue(3, 0.45);
//We specify a custom execution policy here, since the "distanceToOrigin" is a
//custom field type
mc.SetActiveField("distanceToOrigin");
mc.SetFieldsToPass({ "distanceToOrigin", "distanceToOther" });
vtkm::cont::DataSet outputData = mc.Execute(dataSet, PolicyRadiantDataSet{});
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 2,
"Wrong number of fields in the output dataset");
vtkm::cont::CoordinateSystem coords = outputData.GetCoordinateSystem();
VTKM_TEST_ASSERT(coords.GetNumberOfPoints() == (414 * 4), "Should have some coordinates");
}
} // namespace
int UnitTestContourFilterCustomPolicy(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(vtkm_ut_mc_policy::TestContourCustomPolicy, argc, argv);
}

@ -103,7 +103,7 @@ void TestStructured()
vtkm::filter::GhostCellClassify addGhost;
auto output = addGhost.Execute(ds, vtkm::filter::GhostCellClassifyPolicy());
auto output = addGhost.Execute(ds);
//Validate the output.
VTKM_TEST_ASSERT(output.HasCellField("vtkmGhostCells"),

@ -99,8 +99,7 @@ void TestPointElevationWithPolicy()
filter.SetRange(0.0, 2.0);
filter.SetUseCoordinateSystemAsField(true);
vtkm::filter::PolicyDefault p;
auto result = filter.Execute(inputData, p);
auto result = filter.Execute(inputData);
//verify the result
VTKM_TEST_ASSERT(result.HasPointField("elevation"), "Output field has wrong association");

@ -219,14 +219,6 @@ void TestWithExplicitData()
TestSplitSharpEdgesFilterNoSplit(simpleCubeWithSN, splitSharpEdgesFilter);
}
struct SplitSharpTestPolicy : public vtkm::filter::PolicyBase<SplitSharpTestPolicy>
{
using StructuredCellSetList = vtkm::List<vtkm::cont::CellSetStructured<3>>;
using UnstructuredCellSetList = vtkm::List<vtkm::cont::CellSetSingleType<>>;
using AllCellSetList = vtkm::ListAppend<StructuredCellSetList, UnstructuredCellSetList>;
using FieldTypeList = vtkm::List<vtkm::FloatDefault, vtkm::Vec3f>;
};
void TestWithStructuredData()
{
@ -254,7 +246,7 @@ void TestWithStructuredData()
std::cout << dataSet.GetNumberOfPoints() << std::endl;
vtkm::filter::SplitSharpEdges split;
split.SetActiveField("normals", vtkm::cont::Field::Association::CELL_SET);
dataSet = split.Execute(dataSet, SplitSharpTestPolicy{});
dataSet = split.Execute(dataSet);
}

@ -51,15 +51,6 @@ vtkm::cont::DataSet MakeWarpVectorTestDataSet()
return dataSet;
}
class PolicyWarpVector : public vtkm::filter::PolicyBase<PolicyWarpVector>
{
public:
using vecType = vtkm::Vec3f;
using TypeListWarpVectorTags = vtkm::List<vtkm::cont::ArrayHandleConstant<vecType>::StorageTag,
vtkm::cont::ArrayHandle<vecType>::StorageTag>;
using FieldStorageList = TypeListWarpVectorTags;
};
void CheckResult(const vtkm::filter::WarpVector& filter, const vtkm::cont::DataSet& result)
{
VTKM_TEST_ASSERT(result.HasPointField("warpvector"), "Output filed WarpVector is missing");
@ -100,7 +91,7 @@ void TestWarpVectorFilter()
vtkm::filter::WarpVector filter(scale);
filter.SetUseCoordinateSystemAsField(true);
filter.SetVectorField("vec2");
vtkm::cont::DataSet result = filter.Execute(ds, PolicyWarpVector());
vtkm::cont::DataSet result = filter.Execute(ds);
CheckResult(filter, result);
}
@ -109,7 +100,7 @@ void TestWarpVectorFilter()
vtkm::filter::WarpVector filter(scale);
filter.SetActiveField("vec1");
filter.SetVectorField("vec2");
vtkm::cont::DataSet result = filter.Execute(ds, PolicyWarpVector());
vtkm::cont::DataSet result = filter.Execute(ds);
CheckResult(filter, result);
}
}

@ -48,14 +48,6 @@
namespace
{
struct TestPolicy : public vtkm::filter::PolicyBase<TestPolicy>
{
using StructuredCellSetList = vtkm::List<vtkm::cont::CellSetStructured<3>>;
using UnstructuredCellSetList = vtkm::List<vtkm::cont::CellSetSingleType<>>;
using AllCellSetList = vtkm::ListAppend<StructuredCellSetList, UnstructuredCellSetList>;
using FieldTypeList = vtkm::List<vtkm::FloatDefault, vtkm::Vec<vtkm::FloatDefault, 3>>;
};
VTKM_CONT
vtkm::cont::DataSet CreateDataSet(bool pointNormals, bool cellNormals)
{
@ -79,7 +71,7 @@ vtkm::cont::DataSet CreateDataSet(bool pointNormals, bool cellNormals)
normals.SetPointNormalsName("normals");
normals.SetCellNormalsName("normals");
normals.SetAutoOrientNormals(false);
dataSet = normals.Execute(dataSet, TestPolicy{});
dataSet = normals.Execute(dataSet);
return dataSet;
}