2017-05-04 19:13:53 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2017-05-04 19:13:53 +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.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef vtk_m_filter_ExtractGeometry_h
|
|
|
|
#define vtk_m_filter_ExtractGeometry_h
|
|
|
|
|
2020-08-19 23:20:43 +00:00
|
|
|
#include <vtkm/filter/vtkm_filter_common_export.h>
|
2020-02-06 21:58:59 +00:00
|
|
|
|
2017-10-23 13:38:33 +00:00
|
|
|
#include <vtkm/cont/ImplicitFunctionHandle.h>
|
2017-05-04 19:13:53 +00:00
|
|
|
#include <vtkm/filter/FilterDataSet.h>
|
|
|
|
#include <vtkm/worklet/ExtractGeometry.h>
|
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
2017-05-04 19:13:53 +00:00
|
|
|
|
2017-07-06 17:51:45 +00:00
|
|
|
/// \brief Extract a subset of geometry based on an implicit function
|
|
|
|
///
|
|
|
|
/// Extracts from its input geometry all cells that are either
|
|
|
|
/// completely inside or outside of a specified implicit function. Any type of
|
|
|
|
/// data can be input to this filter.
|
|
|
|
///
|
|
|
|
/// To use this filter you must specify an implicit function. You must also
|
|
|
|
/// specify whether to extract cells laying inside or outside of the implicit
|
|
|
|
/// function. (The inside of an implicit function is the negative values
|
|
|
|
/// region.) An option exists to extract cells that are neither inside or
|
|
|
|
/// outside (i.e., boundary).
|
|
|
|
///
|
|
|
|
/// This differs from Clip in that Clip will subdivide boundary cells into new
|
|
|
|
/// cells, while this filter will not, producing a more 'crinkly' output.
|
|
|
|
///
|
2020-11-17 19:37:05 +00:00
|
|
|
class VTKM_FILTER_COMMON_EXPORT ExtractGeometry
|
|
|
|
: public vtkm::filter::FilterDataSet<ExtractGeometry>
|
2017-05-04 19:13:53 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-08-02 02:03:04 +00:00
|
|
|
//currently the ExtractGeometry filter only works on scalar data.
|
2019-12-05 17:55:57 +00:00
|
|
|
using SupportedTypes = TypeListScalarAll;
|
2019-08-02 02:03:04 +00:00
|
|
|
|
2020-11-17 19:37:05 +00:00
|
|
|
VTKM_CONT ExtractGeometry();
|
2017-05-04 19:13:53 +00:00
|
|
|
|
|
|
|
// Set the volume of interest to extract
|
2017-10-23 13:38:33 +00:00
|
|
|
void SetImplicitFunction(const vtkm::cont::ImplicitFunctionHandle& func)
|
2017-05-04 19:13:53 +00:00
|
|
|
{
|
|
|
|
this->Function = func;
|
|
|
|
}
|
|
|
|
|
2017-10-23 13:38:33 +00:00
|
|
|
const vtkm::cont::ImplicitFunctionHandle& GetImplicitFunction() const { return this->Function; }
|
2017-05-04 19:13:53 +00:00
|
|
|
|
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
bool GetExtractInside() { return this->ExtractInside; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void SetExtractInside(bool value) { this->ExtractInside = value; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractInsideOn() { this->ExtractInside = true; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractInsideOff() { this->ExtractInside = false; }
|
2017-05-04 19:13:53 +00:00
|
|
|
|
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
bool GetExtractBoundaryCells() { return this->ExtractBoundaryCells; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void SetExtractBoundaryCells(bool value) { this->ExtractBoundaryCells = value; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractBoundaryCellsOn() { this->ExtractBoundaryCells = true; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractBoundaryCellsOff() { this->ExtractBoundaryCells = false; }
|
|
|
|
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
bool GetExtractOnlyBoundaryCells() { return this->ExtractOnlyBoundaryCells; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void SetExtractOnlyBoundaryCells(bool value) { this->ExtractOnlyBoundaryCells = value; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractOnlyBoundaryCellsOn() { this->ExtractOnlyBoundaryCells = true; }
|
2017-05-04 19:13:53 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ExtractOnlyBoundaryCellsOff() { this->ExtractOnlyBoundaryCells = false; }
|
2017-05-04 19:13:53 +00:00
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename DerivedPolicy>
|
2018-04-02 21:58:21 +00:00
|
|
|
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
2020-11-17 19:37:05 +00:00
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
2017-05-04 19:13:53 +00:00
|
|
|
|
2020-11-17 19:37:05 +00:00
|
|
|
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result, const vtkm::cont::Field& field);
|
2020-02-06 21:58:59 +00:00
|
|
|
|
|
|
|
template <typename DerivedPolicy>
|
|
|
|
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result,
|
|
|
|
const vtkm::cont::Field& field,
|
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy>)
|
|
|
|
{
|
|
|
|
return this->MapFieldOntoOutput(result, field);
|
|
|
|
}
|
2017-05-04 19:13:53 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool ExtractInside;
|
|
|
|
bool ExtractBoundaryCells;
|
|
|
|
bool ExtractOnlyBoundaryCells;
|
2017-10-23 13:38:33 +00:00
|
|
|
vtkm::cont::ImplicitFunctionHandle Function;
|
2017-06-13 19:48:27 +00:00
|
|
|
vtkm::worklet::ExtractGeometry Worklet;
|
2017-05-04 19:13:53 +00:00
|
|
|
};
|
2020-02-06 21:58:59 +00:00
|
|
|
|
|
|
|
#ifndef vtkm_filter_ExtractGeometry_cxx
|
2020-11-17 19:37:05 +00:00
|
|
|
extern template VTKM_FILTER_COMMON_TEMPLATE_EXPORT vtkm::cont::DataSet ExtractGeometry::DoExecute(
|
|
|
|
const vtkm::cont::DataSet&,
|
|
|
|
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
2020-02-06 21:58:59 +00:00
|
|
|
#endif
|
2017-05-04 19:13:53 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::filter
|
|
|
|
|
|
|
|
#endif // vtk_m_filter_ExtractGeometry_h
|