Go to the documentation of this file.
11 #ifndef vtk_m_filter_FilterField_h
12 #define vtk_m_filter_FilterField_h
37 const std::string& name,
40 this->SetActiveField(0, name, association);
45 const std::string& name,
48 auto index_st =
static_cast<std::size_t
>(index);
49 ResizeIfNeeded(index_st);
50 this->ActiveFieldNames[index_st] = name;
51 this->ActiveFieldAssociation[index_st] = association;
58 return this->ActiveFieldNames[index];
64 return this->ActiveFieldAssociation[index];
75 this->SetActiveCoordinateSystem(0, coord_idx);
81 auto index_st =
static_cast<std::size_t
>(index);
82 ResizeIfNeeded(index_st);
83 this->ActiveCoordinateSystemIndices[index_st] = coord_idx;
89 return this->GetActiveCoordinateSystemIndex(0);
95 auto index_st =
static_cast<std::size_t
>(index);
96 return this->ActiveCoordinateSystemIndices[index_st];
109 auto index_st =
static_cast<std::size_t
>(index);
110 this->ResizeIfNeeded(index_st);
111 this->UseCoordinateSystemAsField[index] = val;
119 return this->UseCoordinateSystemAsField[index];
127 return this->GetFieldFromDataSet(0, input);
134 if (this->UseCoordinateSystemAsField[index])
139 const std::string& coordSystemName =
145 return input.
GetField(this->GetActiveFieldName(index),
146 this->GetActiveFieldAssociation(index));
150 template <
typename Functor,
typename... Args>
153 Args&&... args)
const
157 std::forward<Functor>(functor), std::forward<Args>(args)...);
160 template <
typename Functor,
typename... Args>
163 Args&&... args)
const
165 this->CastAndCallScalarField(
166 field.
GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
171 template <vtkm::IdComponent VecSize>
174 template <
typename T>
182 Args&&... args)
const
187 std::forward<Functor>(functor), std::forward<Args>(args)...);
193 Args&&... args)
const
195 this->CastAndCallVecField<VecSize>(
196 field.
GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
232 const std::string& resultFieldName,
236 return this->CreateResultField(
237 inDataSet,
vtkm::cont::Field{ resultFieldName, resultFieldAssociation, resultFieldArray });
256 const std::string& resultFieldName,
259 return this->CreateResultField(inDataSet,
281 const std::string& resultFieldName,
284 return this->CreateResultField(inDataSet,
291 void ResizeIfNeeded(
size_t index_st);
303 #endif // vtk_m_filter_FilterField_h
std::vector< bool > UseCoordinateSystemAsField
Definition: FilterField.h:297
VTKM_CONT void CastAndCallVecField(const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
Definition: FilterField.h:191
VTKM_CONT void SetActiveField(const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Definition: FilterField.h:36
VTKM_CONT vtkm::cont::Field::Association GetActiveFieldAssociation(vtkm::IdComponent index=0) const
Definition: FilterField.h:61
Groups connected points that have the same field value.
Definition: Atomic.h:19
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
VTKM_CONT void CastAndCallForTypesWithFloatFallback(Functor &&functor, Args &&... args) const
Call a functor using the underlying array type with a float cast fallback.
Definition: UnknownArrayHandle.h:1051
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
Association
Definition: cont/Field.h:34
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:406
const VTKM_CONT std::string & GetCoordinateSystemName(vtkm::Id index=0) const
VTKM_CONT bool GetUseCoordinateSystemAsField(vtkm::IdComponent index=0) const
Definition: FilterField.h:115
VTKM_CONT void CastAndCallScalarField(const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
Definition: FilterField.h:161
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
const vtkm::cont::UnknownArrayHandle & GetData() const
const VTKM_CONT vtkm::cont::Field & GetFieldFromDataSet(const vtkm::cont::DataSet &input) const
Definition: FilterField.h:125
Definition: FilterField.h:21
const VTKM_CONT std::string & GetActiveFieldName(vtkm::IdComponent index=0) const
Definition: FilterField.h:54
typename detail::ListTransformImpl< List, Transform >::type ListTransform
Constructs a list containing all types in a source list applied to a transform template.
Definition: List.h:592
VTKM_CONT void SetActiveCoordinateSystem(vtkm::Id coord_idx)
Definition: FilterField.h:73
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
VTKM_CONT void SetOutputFieldName(const std::string &name)
Definition: FilterField.h:27
std::string OutputFieldName
Definition: FilterField.h:293
void SetActiveField(vtkm::IdComponent index, const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Definition: FilterField.h:43
VTKM_CONT void CastAndCallScalarField(const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Definition: FilterField.h:151
base class for all filters.
Definition: Filter.h:218
VTKM_CONT void SetUseCoordinateSystemAsField(vtkm::IdComponent index, bool val)
Definition: FilterField.h:107
#define VTKM_CONT
Definition: ExportMacros.h:57
const VTKM_CONT vtkm::cont::Field & GetPointField(const std::string &name) const
Returns the first point field that matches the provided name.
Definition: DataSet.h:179
std::vector< vtkm::cont::Field::Association > ActiveFieldAssociation
Definition: FilterField.h:296
VTKM_CONT vtkm::Id GetActiveCoordinateSystemIndex(vtkm::IdComponent index) const
Definition: FilterField.h:93
VTKM_CONT void CastAndCallVecField(const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Definition: FilterField.h:180
FilterField()
Definition: FilterField.h:24
Definition: FilterField.h:172
A short fixed-length array.
Definition: Types.h:767
std::vector< vtkm::Id > ActiveCoordinateSystemIndices
Definition: FilterField.h:298
VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: FilterField.h:279
VTKM_CONT vtkm::cont::DataSet CreateResultFieldPoint(const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: FilterField.h:254
VTKM_CONT void SetActiveCoordinateSystem(vtkm::IdComponent index, vtkm::Id coord_idx)
Definition: FilterField.h:79
const VTKM_CONT std::string & GetOutputFieldName() const
Definition: FilterField.h:30
const VTKM_CONT vtkm::cont::Field & GetField(vtkm::Id index) const
Retrieves a field by index.
Definition: DataSet.h:75
VTKM_CONT vtkm::Id GetActiveCoordinateSystemIndex() const
Definition: FilterField.h:87
const VTKM_CONT vtkm::cont::Field & GetFieldFromDataSet(vtkm::IdComponent index, const vtkm::cont::DataSet &input) const
Definition: FilterField.h:131
VTKM_CONT vtkm::cont::DataSet CreateResultField(const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, vtkm::cont::Field::Association resultFieldAssociation, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: FilterField.h:230
std::vector< std::string > ActiveFieldNames
Definition: FilterField.h:295
VTKM_CONT void SetUseCoordinateSystemAsField(bool val)
Definition: FilterField.h:104
vtkm::List< vtkm::Float32, vtkm::Float64 > TypeListFieldScalar
A list containing types used for scalar fields.
Definition: TypeList.h:47