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); valid);
typedef vtkm::filter::FilterTraits< Derived > Traits; 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 //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); result);
typedef vtkm::filter::FilterTraits< Derived > Traits; typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor); vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result; return result;
} }
@ -156,7 +156,7 @@ DataSetResult DataSetWithFieldFilter<Derived>::PrepareForExecution(const vtkm::c
result); result);
typedef vtkm::filter::FilterTraits< Derived > Traits; typedef vtkm::filter::FilterTraits< Derived > Traits;
vtkm::filter::Convert(field, policy, Traits()).CastAndCall(functor); vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor);
return result; return result;
} }
@ -189,7 +189,7 @@ bool DataSetWithFieldFilter<Derived>::MapFieldOntoOutput(DataSetResult& result,
valid); valid);
typedef vtkm::filter::FilterTraits< Derived > Traits; 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 //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; vtkm::cont::DataSet output;
bool workletRan = false; bool workletRan = false;
ExternalFacesWorkletWrapper<DeviceAdapter> wrapper(output, workletRan); ExternalFacesWorkletWrapper<DeviceAdapter> wrapper(output, workletRan);
vtkm::filter::Convert(cells,policy).CastAndCall( wrapper ); vtkm::filter::ApplyPolicy(cells,policy).CastAndCall( wrapper );
if(!workletRan) if(!workletRan)
{ {

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

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

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

@ -114,7 +114,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
typedef Worklets::ThresholdByPointField< ThresholdRange > ThresholdWorklet; typedef Worklets::ThresholdByPointField< ThresholdRange > ThresholdWorklet;
ThresholdWorklet worklet(predicate); ThresholdWorklet worklet(predicate);
vtkm::worklet::DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet); 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()) else if(fieldMeta.IsCellField())
{ {
@ -122,7 +122,7 @@ vtkm::filter::DataSetResult Threshold::DoExecute(const vtkm::cont::DataSet& inpu
typedef Worklets::ThresholdByCellField< ThresholdRange > ThresholdWorklet; typedef Worklets::ThresholdByCellField< ThresholdRange > ThresholdWorklet;
ThresholdWorklet worklet(predicate); ThresholdWorklet worklet(predicate);
vtkm::worklet::DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet); 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 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 //can use to reduce code duplication, and make it easier to write filters
//that return complex dataset types. //that return complex dataset types.
AddPermutationCellSet addCellSet(output, this->ValidCellIds); 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 //todo: We need to generate a new output policy that replaces
//the original storage tag with a new storage tag where everything is //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]; vtkm::Float64 bounds[6];
compute_bounds(input.GetCoordinateSystem(), bounds, policy, tag); compute_bounds(input.GetCoordinateSystem(), bounds, policy, tag);
vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::Convert(input.GetCellSet(), policy), vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::ApplyPolicy(input.GetCellSet(), policy),
vtkm::filter::Convert(input.GetCoordinateSystem(), policy), vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy),
bounds, bounds,
this->GetNumberOfDivisions(), this->GetNumberOfDivisions(),
tag); tag);