Go to the documentation of this file.
19 #ifndef viskores_filter_contour_AbstractContour_h
20 #define viskores_filter_contour_AbstractContour_h
45 this->IsoValues.resize(
static_cast<std::size_t
>(num));
51 return static_cast<viskores::Id>(this->IsoValues.size());
65 std::size_t i =
static_cast<std::size_t
>(index);
66 if (i >= this->IsoValues.size())
68 this->IsoValues.resize(i + 1);
70 this->IsoValues[i] = v;
90 void SetIsoValues(
const std::vector<viskores::Float64>& values) { this->IsoValues = values; }
95 return this->IsoValues[
static_cast<std::size_t
>(index)];
150 this->InputCellDimension = dimension;
156 return this->InputCellDimension;
225 template <
typename WorkletType>
228 WorkletType& worklet)
235 auto functor = [&](
const auto& concrete)
237 using ComponentType =
typename std::decay_t<decltype(concrete)>::ValueType::ComponentType;
239 worklet.ProcessPointField(concrete, fieldArray);
263 if (this->GenerateNormals)
265 if (this->GetComputeFastNormals())
270 output = surfaceNormals.
Execute(output);
279 template <
typename WorkletType>
281 WorkletType& worklet)
283 if (this->AddInterpolationEdgeIds)
287 worklet.GetInterpolationEdgeIds());
288 output.
AddField(interpolationEdgeIdsField);
297 bool GenerateNormals =
true;
298 bool ComputeFastNormals =
false;
303 bool AddInterpolationEdgeIds =
false;
304 bool MergeDuplicatedPoints =
true;
305 std::string NormalArrayName =
"normals";
306 std::string InterpolationEdgeIdsArrayName =
"edgeIds";
312 #endif // viskores_filter_contour_AbstractContour_h
void SetNumberOfIsoValues(viskores::Id num)
Definition: AbstractContour.h:41
void SetInputCellDimensionToAuto()
Specifies an automatic selection of the input cell dimension.
Definition: AbstractContour.h:164
void SetInputCellDimensionToLines()
Specifies running contours on lines.
Definition: AbstractContour.h:196
const std::string & GetNormalArrayName() const
Get the name of the field for the generated normals.
Definition: AbstractContour.h:140
void SetIsoValue(viskores::Id index, viskores::Float64 v)
Set a field value on which to extract a contour.
Definition: AbstractContour.h:63
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
bool GetMergeDuplicatePoints() const
Get whether the points generated should be unique for every triangle or will duplicate points be merg...
Definition: AbstractContour.h:218
Computes normals for polygonal mesh.
Definition: SurfaceNormals.h:52
@ Auto
Specifies an automatic selection of the input cell dimension.
const viskores::cont::UnknownArrayHandle & GetData() const
Get the array of the data for the field.
Base class for all filters.
Definition: Filter.h:171
void SetIsoValue(viskores::Float64 v)
Set a field value on which to extract a contour.
Definition: AbstractContour.h:57
void SetInputCellDimensionToPolyhedra()
Specifies running contours on polyhedra.
Definition: AbstractContour.h:180
void ExecuteGenerateNormals(viskores::cont::DataSet &output, const viskores::cont::ArrayHandle< viskores::Vec3f > &normals)
Definition: AbstractContour.h:259
void AddPointField(const std::string &fieldName, const viskores::cont::UnknownArrayHandle &field)
Adds a point field of a given name to the DataSet.
Definition: DataSet.h:245
viskores::Float64 GetIsoValue(viskores::Id index=0) const
Return a value used to contour the mesh.
Definition: AbstractContour.h:93
void CastAndCallWithExtractedArray(Functor &&functor, Args &&... args) const
Call a functor on an array extracted from the components.
Definition: UnknownArrayHandle.h:1320
viskores::cont::DataSet Execute(const viskores::cont::DataSet &input)
Executes the filter on the input and produces a result dataset.
Contour filter interface.
Definition: AbstractContour.h:38
bool IsPointField() const
Return true if this field is associated with points.
Definition: Field.h:127
void SetMergeDuplicatePoints(bool on)
Set whether the points generated should be unique for every triangle or will duplicate points be merg...
Definition: AbstractContour.h:213
@ Polyhedra
Specifies running contours on polyhedra.
bool GetAddInterpolationEdgeIds() const
Get whether to append the ids of the intersected edges to the vertices of the isosurface triangles.
Definition: AbstractContour.h:117
viskores::cont::Field make_FieldPoint(std::string name, const viskores::cont::ArrayHandle< T, S > &data)
Convenience function to build point fields from viskores::cont::ArrayHandle.
Definition: Field.h:315
void AddField(const Field &field)
Adds a field to the DataSet.
void SetComputeFastNormals(bool flag)
Set whether the fast path should be used for normals computation.
Definition: AbstractContour.h:129
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
#define VISKORES_CONT
Definition: ExportMacros.h:65
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::Id GetNumberOfIsoValues() const
Definition: AbstractContour.h:49
std::vector< viskores::Float64 > IsoValues
Definition: AbstractContour.h:296
void SetAddInterpolationEdgeIds(bool flag)
Set whether to append the ids of the intersected edges to the vertices of the isosurface triangles.
Definition: AbstractContour.h:113
viskores::filter::contour::ContourDimension GetInputCellDimension() const
Specify the dimension of cells on which to operate the contour.
Definition: AbstractContour.h:154
void SetInputCellDimension(viskores::filter::contour::ContourDimension dimension)
Specify the dimension of cells on which to operate the contour.
Definition: AbstractContour.h:148
@ Lines
Specifies running contours on lines.
void SetPointNormalsName(const std::string &name)
Specify the name of the point normals field.
Definition: SurfaceNormals.h:95
@ Polygons
Specifies running contours on polygons.
const std::string & GetName() const
Return the name of the field.
Definition: Field.h:151
bool GetGenerateNormals() const
Get whether normals should be generated.
Definition: AbstractContour.h:108
static bool DoMapField(viskores::cont::DataSet &result, const viskores::cont::Field &field, WorkletType &worklet)
Map a given field to the output DataSet , depending on its type.
Definition: AbstractContour.h:226
void SetIsoValues(const std::vector< viskores::Float64 > &values)
Set multiple iso values at once.
Definition: AbstractContour.h:90
void SetNormalArrayName(const std::string &name)
Set the name of the field for the generated normals.
Definition: AbstractContour.h:136
UnknownArrayHandle NewInstanceBasic() const
Create a new ArrayHandleBasic with the same ValueType as this array.
bool MapFieldPermutation(const viskores::cont::Field &inputField, const viskores::cont::ArrayHandle< viskores::Id > &permutation, viskores::cont::Field &outputField, viskores::Float64 invalidValue=viskores::Nan< viskores::Float64 >())
Maps a field by permuting it by a given index array.
void SetGeneratePointNormals(bool value)
Specify whether the point normals should be generated.
Definition: SurfaceNormals.h:81
viskores::cont::ArrayHandleRecombineVec< BaseComponentType > ExtractArrayFromComponents(viskores::CopyFlag allowCopy=viskores::CopyFlag::On) const
Extract the array knowing only the component type of the array.
Definition: UnknownArrayHandle.h:873
void ExecuteAddInterpolationEdgeIds(viskores::cont::DataSet &output, WorkletType &worklet)
Definition: AbstractContour.h:280
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
bool IsCellField() const
Return true if this field is associated with cells.
Definition: Field.h:125
@ Points
A field that applies to points.
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:39
void SetInputCellDimensionToPolygons()
Specifies running contours on polygons.
Definition: AbstractContour.h:188
bool IsWholeDataSetField() const
Return true if this field is associated with the whole data set.
Definition: Field.h:129
void SetGenerateNormals(bool flag)
Set whether normals should be generated.
Definition: AbstractContour.h:105
void SetInputCellDimensionToAll()
Specifies a combination of all possible contours.
Definition: AbstractContour.h:172
bool GetComputeFastNormals() const
Get whether the fast path should be used for normals computation.
Definition: AbstractContour.h:132
@ All
Specifies a combination of all possible contours.
ContourDimension
Identifies what type cells will be contoured.
Definition: ContourDimension.h:32