vtk-m/vtkm/filter/GhostCellRemove.h

86 lines
2.7 KiB
C
Raw Normal View History

2018-09-06 15:39:04 +00:00
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
2018-09-06 15:39:04 +00:00
// 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.
//============================================================================
2019-03-25 13:08:16 +00:00
#ifndef vtk_m_filter_GhostCellRemove_h
#define vtk_m_filter_GhostCellRemove_h
2018-09-06 15:39:04 +00:00
#include <vtkm/CellClassification.h>
2018-09-06 15:39:04 +00:00
#include <vtkm/filter/FilterDataSetWithField.h>
#include <vtkm/filter/Threshold.h>
namespace vtkm
{
namespace filter
{
2019-03-25 13:08:16 +00:00
struct GhostCellRemovePolicy : vtkm::filter::PolicyBase<GhostCellRemovePolicy>
2018-09-06 15:39:04 +00:00
{
2019-12-05 21:38:41 +00:00
using FieldTypeList = vtkm::List<vtkm::UInt8>;
2018-09-06 15:39:04 +00:00
};
2019-03-25 13:11:02 +00:00
/// \brief Removes ghost cells
2018-09-06 15:39:04 +00:00
///
2019-03-25 13:08:16 +00:00
class GhostCellRemove : public vtkm::filter::FilterDataSetWithField<GhostCellRemove>
2018-09-06 15:39:04 +00:00
{
public:
//currently the GhostCellRemove filter only works on uint8 data.
2019-12-05 21:38:41 +00:00
using SupportedTypes = vtkm::List<vtkm::UInt8>;
2018-09-06 15:39:04 +00:00
VTKM_CONT
2019-03-25 13:08:16 +00:00
GhostCellRemove();
2018-09-06 15:39:04 +00:00
2019-02-28 20:51:55 +00:00
VTKM_CONT
void RemoveGhostField() { this->RemoveField = true; }
2018-09-06 15:39:04 +00:00
VTKM_CONT
void RemoveAllGhost() { this->RemoveAll = true; }
VTKM_CONT
void RemoveByType(const vtkm::UInt8& vals)
{
this->RemoveAll = false;
this->RemoveVals = vals;
}
VTKM_CONT
2019-02-28 20:51:55 +00:00
bool GetRemoveGhostField() { return this->RemoveField; }
VTKM_CONT
2018-09-06 15:39:04 +00:00
bool GetRemoveAllGhost() const { return this->RemoveAll; }
VTKM_CONT
2019-02-27 15:29:05 +00:00
bool GetRemoveByType() const { return !this->RemoveAll; }
2018-09-06 15:39:04 +00:00
VTKM_CONT
vtkm::UInt8 GetRemoveType() const { return this->RemoveVals; }
template <typename T, typename StorageType, typename DerivedPolicy>
2018-09-06 15:39:04 +00:00
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
2018-09-06 15:39:04 +00:00
//Map a new field onto the resulting dataset after running the filter
//this call is only valid after DoExecute is run
template <typename DerivedPolicy>
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result,
const vtkm::cont::Field& field,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
2018-09-06 15:39:04 +00:00
private:
bool RemoveAll;
2019-02-28 20:51:55 +00:00
bool RemoveField;
2018-09-06 15:39:04 +00:00
vtkm::UInt8 RemoveVals;
vtkm::worklet::Threshold Worklet;
};
}
} // namespace vtkm::filter
#ifndef vtk_m_filter_GhostCellRemove_hxx
2019-03-25 13:08:16 +00:00
#include <vtkm/filter/GhostCellRemove.hxx>
#endif
2018-09-06 15:39:04 +00:00
2019-03-25 13:08:16 +00:00
#endif // vtk_m_filter_GhostCellRemove_h