mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Merge topic 'improve-ExternalFaces-filter'
b1d6e743 Improve ExternalFaces filter Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kenneth Moreland <kmorel@sandia.gov> Merge-request: !714
This commit is contained in:
commit
f1bc19f4a2
@ -21,42 +21,6 @@
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template< typename DeviceAdapter >
|
||||
class ExternalFacesWorkletWrapper
|
||||
{
|
||||
vtkm::cont::DataSet* Output;
|
||||
bool* Valid;
|
||||
public:
|
||||
|
||||
|
||||
ExternalFacesWorkletWrapper(vtkm::cont::DataSet& data, bool& v):
|
||||
Output(&data),
|
||||
Valid(&v)
|
||||
{ }
|
||||
|
||||
template<typename T, typename U, typename V, typename W>
|
||||
void operator()(const vtkm::cont::CellSetExplicit<T,U,V,W>& cellset ) const
|
||||
{
|
||||
vtkm::cont::CellSetExplicit<> output_cs(cellset.GetName());
|
||||
vtkm::worklet::ExternalFaces exfaces;
|
||||
exfaces.Run(cellset, output_cs, DeviceAdapter());
|
||||
|
||||
this->Output->AddCellSet(output_cs);
|
||||
*this->Valid = true;
|
||||
}
|
||||
|
||||
void operator()(const vtkm::cont::CellSet& ) const
|
||||
{
|
||||
//don't support this cell type
|
||||
*this->Valid = false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT
|
||||
ExternalFaces::ExternalFaces():
|
||||
@ -77,25 +41,20 @@ vtkm::filter::ResultDataSet ExternalFaces::DoExecute(const vtkm::cont::DataSet&
|
||||
const vtkm::cont::DynamicCellSet& cells =
|
||||
input.GetCellSet(this->GetActiveCellSetIndex());
|
||||
|
||||
//2. using the policy convert the dynamic cell set, and verify
|
||||
// that we have an explicit cell set. Once that is found run the
|
||||
//2. using the policy convert the dynamic cell set, and run the
|
||||
// external faces worklet
|
||||
vtkm::cont::CellSetExplicit<> outCellSet(cells.GetName());
|
||||
vtkm::worklet::ExternalFaces exfaces;
|
||||
exfaces.Run(vtkm::filter::ApplyPolicyUnstructured(cells, policy),
|
||||
outCellSet, DeviceAdapter());
|
||||
|
||||
//3. create the output dataset
|
||||
vtkm::cont::DataSet output;
|
||||
bool workletRan = false;
|
||||
ExternalFacesWorkletWrapper<DeviceAdapter> wrapper(output, workletRan);
|
||||
vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicyUnstructured(cells,policy),
|
||||
wrapper);
|
||||
|
||||
if(!workletRan)
|
||||
{
|
||||
return vtkm::filter::ResultDataSet();
|
||||
}
|
||||
|
||||
//3. add coordinates, etc to the
|
||||
output.AddCellSet(outCellSet);
|
||||
output.AddCoordinateSystem(
|
||||
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()) );
|
||||
return vtkm::filter::ResultDataSet(output);
|
||||
|
||||
return vtkm::filter::ResultDataSet(output);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user