Renamed the ``Convert` method to `ApplyPolicy``

The original name was a really bad name, so thank to Ken for suggesting
a better name.
This commit is contained in:
Robert Maynard 2016-02-15 11:38:51 -05:00
parent 8e72ec8ea4
commit f699c98602
8 changed files with 32 additions and 30 deletions

@ -126,7 +126,7 @@ bool DataSetFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
valid);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
}
//the bool valid will be modified by the map algorithm to hold if the

@ -129,7 +129,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
result);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result;
}
@ -156,7 +156,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
result);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result;
}
@ -189,7 +189,7 @@ bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
valid);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
}
//the bool valid will be modified by the map algorithm to hold if the

@ -105,7 +105,7 @@ vtkm::filter::DataSetResult ExternalFaces::DoExecute(const vtkm::cont::DataSet&
vtkm::cont::DataSet output;
bool workletRan = false;
ExternalFacesWorkletWrapper<DeviceAdapter> wrapper(output, workletRan);
vtkm::filter::Convert(cells,policy).CastAndCall( wrapper );
vtkm::filter::ApplyPolicy(cells,policy).CastAndCall( wrapper );
if(!workletRan)
{

@ -147,7 +147,7 @@ FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet
result);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result;
}
@ -173,7 +173,7 @@ FieldResult FieldFilter<Derived>::PrepareForExecution(const vtkm::cont::DataSet
result);
typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor);
vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result;
}

@ -326,7 +326,7 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
vtkm::cont::ArrayHandle<vtkm::IdComponent> numOutputTrisPerCell;
classifyCellDispatcher.Invoke(field,
vtkm::filter::Convert(cells, policy),
vtkm::filter::ApplyPolicy(cells, policy),
numOutputTrisPerCell,
this->NumTrianglesTable);
@ -342,10 +342,10 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
GenerateDispatcher edgeDispatcher(weightGenerate);
edgeDispatcher.Invoke(
vtkm::filter::Convert(cells, policy),
vtkm::filter::ApplyPolicy(cells, policy),
//cast to a scalar field if not one, as cellderivative only works on those
make_ScalarField(field),
vtkm::filter::Convert(coords, policy),
vtkm::filter::ApplyPolicy(coords, policy),
vtkm::cont::make_ArrayHandleGroupVec<3>(normals),
vtkm::cont::make_ArrayHandleGroupVec<3>(this->InterpolationWeights),
vtkm::cont::make_ArrayHandleGroupVec<3>(this->InterpolationIds),
@ -410,7 +410,8 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
Algorithm::LowerBounds(unqiueIds, this->InterpolationIds, connectivity);
vtkm::cont::CellSetSingleType< > outputCells( (vtkm::CellShapeTagTriangle()) );
CellShapeTagTriangle triangleTag;
vtkm::cont::CellSetSingleType< > outputCells( triangleTag );
outputCells.Fill( connectivity );
output.AddCellSet( outputCells );
}
@ -422,13 +423,14 @@ vtkm::filter::DataSetResult MarchingCubes::DoExecute(const vtkm::cont::DataSet&
applyFieldDispatcher.Invoke(this->InterpolationIds,
this->InterpolationWeights,
vtkm::filter::Convert(coords, policy),
vtkm::filter::ApplyPolicy(coords, policy),
vertices);
//when we don't merge points, the connectivity array can be represented
//by a counting array
typedef typename vtkm::cont::ArrayHandleIndex::StorageTag IndexStorageTag;
vtkm::cont::CellSetSingleType< IndexStorageTag > outputCells( (vtkm::CellShapeTagTriangle()) );
CellShapeTagTriangle triangleTag;
vtkm::cont::CellSetSingleType< IndexStorageTag > outputCells( triangleTag );
vtkm::cont::ArrayHandleIndex connectivity(vertices.GetNumberOfValues());
outputCells.Fill( connectivity );
output.AddCellSet( outputCells );

@ -45,8 +45,8 @@ vtkm::cont::DynamicArrayHandleBase<
typename DerivedPolicy::FieldTypeList,
typename DerivedPolicy::FieldStorageList
>
Convert(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
ApplyPolicy(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
typedef typename DerivedPolicy::FieldTypeList TypeList;
typedef typename DerivedPolicy::FieldStorageList StorageList;
@ -60,9 +60,9 @@ vtkm::cont::DynamicArrayHandleBase<
typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList,
typename DerivedPolicy::FieldStorageList
>
Convert(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
const vtkm::filter::FilterTraits<FilterType>&)
ApplyPolicy(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
const vtkm::filter::FilterTraits<FilterType>&)
{
//todo: we need to intersect the policy field type list and the
//filter traits to the get smallest set of valid types
@ -79,8 +79,8 @@ vtkm::cont::DynamicArrayHandleBase<
typename DerivedPolicy::CoordinateTypeList,
typename DerivedPolicy::CoordinateStorageList
>
Convert(const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
typedef typename DerivedPolicy::CoordinateTypeList TypeList;
typedef typename DerivedPolicy::CoordinateStorageList StorageList;
@ -94,9 +94,9 @@ vtkm::cont::DynamicArrayHandleBase<
typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList,
typename DerivedPolicy::CoordinateStorageList
>
Convert(const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
const vtkm::filter::FilterTraits<FilterType>&)
ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
const vtkm::filter::FilterTraits<FilterType>&)
{
//todo: we need to intersect the policy field type list and the
//filter traits to the get smallest set of valid types
@ -110,8 +110,8 @@ Convert(const vtkm::cont::CoordinateSystem& coordinates,
template<typename DerivedPolicy>
VTKM_CONT_EXPORT
vtkm::cont::DynamicCellSetBase< typename DerivedPolicy::CellSetList >
Convert(const vtkm::cont::DynamicCellSet& cellset,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
ApplyPolicy(const vtkm::cont::DynamicCellSet& cellset,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
typedef typename DerivedPolicy::CellSetList CellSetList;
return cellset.ResetCellSetList(CellSetList());

@ -114,7 +114,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
typedef Worklets::ThresholdByPointField< ThresholdRange > ThresholdWorklet;
ThresholdWorklet worklet(predicate);
vtkm::worklet::DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet);
dispatcher.Invoke(vtkm::filter::Convert(cells, policy), field, passFlags);
dispatcher.Invoke(vtkm::filter::ApplyPolicy(cells, policy), field, passFlags);
}
else if(fieldMeta.IsCellField())
{
@ -122,7 +122,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
typedef Worklets::ThresholdByCellField< ThresholdRange > ThresholdWorklet;
ThresholdWorklet worklet(predicate);
vtkm::worklet::DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet);
dispatcher.Invoke(vtkm::filter::Convert(cells, policy), field, passFlags);
dispatcher.Invoke(vtkm::filter::ApplyPolicy(cells, policy), field, passFlags);
}
else
{
@ -145,7 +145,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
//can use to reduce code duplication, and make it easier to write filters
//that return complex dataset types.
AddPermutationCellSet addCellSet(output, this->ValidCellIds);
vtkm::filter::Convert(cells, policy).CastAndCall(addCellSet);
vtkm::filter::ApplyPolicy(cells, policy).CastAndCall(addCellSet);
//todo: We need to generate a new output policy that replaces
//the original storage tag with a new storage tag where everything is

@ -62,8 +62,8 @@ vtkm::filter::DataSetResult VertexClustering::DoExecute(const vtkm::cont::DataSe
vtkm::Float64 bounds[6];
compute_bounds(input.GetCoordinateSystem(), bounds, policy, tag);
vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::Convert(input.GetCellSet(), policy),
vtkm::filter::Convert(input.GetCoordinateSystem(), policy),
vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::ApplyPolicy(input.GetCellSet(), policy),
vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy),
bounds,
this->GetNumberOfDivisions(),
tag);