Go to the documentation of this file.
11 #ifndef vtk_m_filter_contour_AbstractContour_h
12 #define vtk_m_filter_contour_AbstractContour_h
36 this->IsoValues.resize(
static_cast<std::size_t
>(num));
53 std::size_t i =
static_cast<std::size_t
>(index);
54 if (i >= this->IsoValues.size())
56 this->IsoValues.resize(i + 1);
58 this->IsoValues[i] = v;
78 void SetIsoValues(
const std::vector<vtkm::Float64>& values) { this->IsoValues = values; }
83 return this->IsoValues[
static_cast<std::size_t
>(index)];
154 template <
typename WorkletType>
157 WorkletType& worklet)
164 auto functor = [&](
const auto& concrete) {
165 using ComponentType =
typename std::decay_t<decltype(concrete)>::ValueType::ComponentType;
167 worklet.ProcessPointField(concrete, fieldArray);
190 if (this->GenerateNormals)
192 if (this->GetComputeFastNormals())
197 output = surfaceNormals.
Execute(output);
206 template <
typename WorkletType>
209 if (this->AddInterpolationEdgeIds)
213 worklet.GetInterpolationEdgeIds());
214 output.
AddField(interpolationEdgeIdsField);
223 bool GenerateNormals =
true;
224 bool ComputeFastNormals =
false;
226 bool AddInterpolationEdgeIds =
false;
227 bool MergeDuplicatedPoints =
true;
228 std::string NormalArrayName =
"normals";
229 std::string InterpolationEdgeIdsArrayName =
"edgeIds";
235 #endif // vtk_m_filter_contour_AbstractContour_h
Contour filter interface.
Definition: AbstractContour.h:29
bool GetAddInterpolationEdgeIds() const
Get whether to append the ids of the intersected edges to the vertices of the isosurface triangles.
Definition: AbstractContour.h:105
Groups connected points that have the same field value.
Definition: Atomic.h:19
bool IsCellField() const
Return true if this field is associated with cells.
Definition: Field.h:117
void SetPointNormalsName(const std::string &name)
Specify the name of the point normals field.
Definition: SurfaceNormals.h:87
bool MapFieldPermutation(const vtkm::cont::Field &inputField, const vtkm::cont::ArrayHandle< vtkm::Id > &permutation, vtkm::cont::Field &outputField, vtkm::Float64 invalidValue=vtkm::Nan< vtkm::Float64 >())
Maps a field by permuting it by a given index array.
void SetNumberOfIsoValues(vtkm::Id num)
Definition: AbstractContour.h:32
vtkm::Float64 GetIsoValue(vtkm::Id index=0) const
Return a value used to contour the mesh.
Definition: AbstractContour.h:81
static bool DoMapField(vtkm::cont::DataSet &result, const vtkm::cont::Field &field, WorkletType &worklet)
Map a given field to the output DataSet , depending on its type.
Definition: AbstractContour.h:155
UnknownArrayHandle NewInstanceBasic() const
Create a new ArrayHandleBasic with the same ValueType as this array.
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:430
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
void SetIsoValues(const std::vector< vtkm::Float64 > &values)
Set multiple iso values at once.
Definition: AbstractContour.h:78
void SetComputeFastNormals(bool flag)
Set whether the fast path should be used for normals computation.
Definition: AbstractContour.h:117
void SetAddInterpolationEdgeIds(bool flag)
Set whether to append the ids of the intersected edges to the vertices of the isosurface triangles.
Definition: AbstractContour.h:101
void CastAndCallWithExtractedArray(Functor &&functor, Args &&... args) const
Call a functor on an array extracted from the components.
Definition: UnknownArrayHandle.h:1284
bool GetComputeFastNormals() const
Get whether the fast path should be used for normals computation.
Definition: AbstractContour.h:120
void SetIsoValue(vtkm::Id index, vtkm::Float64 v)
Set a field value on which to extract a contour.
Definition: AbstractContour.h:51
const vtkm::cont::UnknownArrayHandle & GetData() const
Get the array of the data for the field.
void SetNormalArrayName(const std::string &name)
Set the name of the field for the generated normals.
Definition: AbstractContour.h:124
void SetGeneratePointNormals(bool value)
Specify whether the point normals should be generated.
Definition: SurfaceNormals.h:73
std::vector< vtkm::Float64 > IsoValues
Definition: AbstractContour.h:222
void SetGenerateNormals(bool flag)
Set whether normals should be generated.
Definition: AbstractContour.h:93
bool GetMergeDuplicatePoints()
Get whether the points generated should be unique for every triangle or will duplicate points be merg...
Definition: AbstractContour.h:147
Computes normals for polygonal mesh.
Definition: SurfaceNormals.h:44
void AddField(const Field &field)
Adds a field to the DataSet.
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:31
#define VTKM_FILTER_CONTOUR_EXPORT
Definition: vtkm_filter_contour_export.h:44
Base class for all filters.
Definition: Filter.h:163
const std::string & GetNormalArrayName() const
Get the name of the field for the generated normals.
Definition: AbstractContour.h:128
@ Points
A field that applies to points.
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
const std::string & GetName() const
Return the name of the field.
Definition: Field.h:143
bool IsWholeDataSetField() const
Return true if this field is associated with the whole data set.
Definition: Field.h:121
bool IsPointField() const
Return true if this field is associated with points.
Definition: Field.h:119
vtkm::cont::DataSet Execute(const vtkm::cont::DataSet &input)
Executes the filter on the input and produces a result dataset.
bool GetGenerateNormals() const
Get whether normals should be generated.
Definition: AbstractContour.h:96
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:161
void AddPointField(const std::string &fieldName, const vtkm::cont::UnknownArrayHandle &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:232
vtkm::cont::ArrayHandleRecombineVec< BaseComponentType > ExtractArrayFromComponents(vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
Extract the array knowing only the component type of the array.
Definition: UnknownArrayHandle.h:847
vtkm::Id GetNumberOfIsoValues() const
Definition: AbstractContour.h:40
void SetIsoValue(vtkm::Float64 v)
Set a field value on which to extract a contour.
Definition: AbstractContour.h:45
void ExecuteAddInterpolationEdgeIds(vtkm::cont::DataSet &output, WorkletType &worklet)
Definition: AbstractContour.h:207
vtkm::cont::Field make_FieldPoint(std::string name, const vtkm::cont::ArrayHandle< T, S > &data)
Convenience function to build point fields from vtkm::cont::ArrayHandle.
Definition: Field.h:304
void SetMergeDuplicatePoints(bool on)
Set whether the points generated should be unique for every triangle or will duplicate points be merg...
Definition: AbstractContour.h:142
void ExecuteGenerateNormals(vtkm::cont::DataSet &output, const vtkm::cont::ArrayHandle< vtkm::Vec3f > &normals)
Definition: AbstractContour.h:187