Viskores  1.0
ExternalFaces.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_filter_entity_extraction_ExternalFaces_h
20 #define viskores_filter_entity_extraction_ExternalFaces_h
21 
22 #include <viskores/filter/Filter.h>
24 
25 namespace viskores
26 {
27 namespace worklet
28 {
29 struct ExternalFaces;
30 }
31 namespace filter
32 {
33 namespace entity_extraction
34 {
41 class VISKORES_FILTER_ENTITY_EXTRACTION_EXPORT ExternalFaces : public viskores::filter::Filter
42 {
43 public:
44  ExternalFaces();
45  ~ExternalFaces() override;
46 
47  // New Design: I am too lazy to make this filter thread-safe. Let's use it as an example of
48  // thread un-safe filter.
49  bool CanThread() const override { return false; }
50 
58  VISKORES_CONT bool GetCompactPoints() const { return this->CompactPoints; }
60  VISKORES_CONT void SetCompactPoints(bool value) { this->CompactPoints = value; }
61 
67  VISKORES_CONT bool GetPassPolyData() const { return this->PassPolyData; }
69  VISKORES_CONT void SetPassPolyData(bool value);
70 
71 private:
72  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
73 
74  viskores::cont::DataSet GenerateOutput(const viskores::cont::DataSet& input,
75  viskores::cont::UnknownCellSet& outCellSet);
76 
77  VISKORES_CONT bool MapFieldOntoOutput(viskores::cont::DataSet& result,
78  const viskores::cont::Field& field);
79 
80  bool CompactPoints = false;
81  bool PassPolyData = true;
82 
83  // Note: This shared state as a data member requires us to explicitly implement the
84  // constructor and destructor in the .cxx file, after the compiler actually have
85  // seen the definition of worklet:ExternalFaces, even if the implementation of
86  // the cstr/dstr is just = default. Otherwise the compiler does not know how to
87  // allocate/free storage for the std::unique_ptr.
88  std::unique_ptr<viskores::worklet::ExternalFaces> Worklet;
89 };
90 } // namespace entity_extraction
91 } // namespace filter
92 } // namespace viskores
93 
94 #endif // viskores_filter_entity_extraction_ExternalFaces_h
viskores::filter::entity_extraction::ExternalFaces::CanThread
bool CanThread() const override
Returns whether the filter can execute on partitions in concurrent threads.
Definition: ExternalFaces.h:49
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::filter::entity_extraction::ExternalFaces::GetCompactPoints
bool GetCompactPoints() const
Option to remove unused points and compact result int a smaller array.
Definition: ExternalFaces.h:58
viskores::filter::entity_extraction::ExternalFaces::Worklet
std::unique_ptr< viskores::worklet::ExternalFaces > Worklet
Definition: ExternalFaces.h:88
viskores::filter::entity_extraction::ExternalFaces::SetCompactPoints
void SetCompactPoints(bool value)
Option to remove unused points and compact result int a smaller array.
Definition: ExternalFaces.h:60
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores_filter_entity_extraction_export.h
viskores::filter::entity_extraction::ExternalFaces
Extract external faces of a geometry.
Definition: ExternalFaces.h:41
viskores::cont::UnknownCellSet
A CellSet of an unknown type.
Definition: UnknownCellSet.h:56
viskores::filter::entity_extraction::ExternalFaces::GetPassPolyData
bool GetPassPolyData() const
Specify how polygonal data (polygons, lines, and vertices) will be handled.
Definition: ExternalFaces.h:67
viskores::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:39
Filter.h