VTK-m  2.2
Filter.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_filter_Filter_h
11 #define vtk_m_filter_Filter_h
12 
13 #include <vtkm/cont/ArrayCopy.h>
14 #include <vtkm/cont/DataSet.h>
15 #include <vtkm/cont/Field.h>
16 #include <vtkm/cont/Invoker.h>
17 #include <vtkm/cont/Logging.h>
19 
21 #include <vtkm/filter/TaskQueue.h>
23 
24 namespace vtkm
25 {
26 namespace filter
27 {
164 {
165 public:
166  VTKM_CONT Filter();
167 
168  VTKM_CONT virtual ~Filter();
169 
173  VTKM_CONT vtkm::cont::DataSet Execute(const vtkm::cont::DataSet& input);
174 
179 
189  VTKM_CONT void SetFieldsToPass(const vtkm::filter::FieldSelection& fieldsToPass);
191  VTKM_CONT void SetFieldsToPass(vtkm::filter::FieldSelection&& fieldsToPass);
192 
193  VTKM_DEPRECATED(2.0)
194  VTKM_CONT void SetFieldsToPass(const vtkm::filter::FieldSelection& fieldsToPass,
196 
198  VTKM_CONT void SetFieldsToPass(
199  std::initializer_list<std::string> fields,
201 
203  VTKM_CONT void SetFieldsToPass(
204  std::initializer_list<std::pair<std::string, vtkm::cont::Field::Association>> fields,
206 
207 
209  VTKM_CONT void SetFieldsToPass(
210  const std::string& fieldname,
211  vtkm::cont::Field::Association association,
213 
215  VTKM_CONT void SetFieldsToPass(const std::string& fieldname,
217  {
218  this->SetFieldsToPass(fieldname, vtkm::cont::Field::Association::Any, mode);
219  }
220 
222  VTKM_CONT
223  const vtkm::filter::FieldSelection& GetFieldsToPass() const { return this->FieldsToPass; }
225  VTKM_CONT
226  vtkm::filter::FieldSelection& GetFieldsToPass() { return this->FieldsToPass; }
227 
238  VTKM_CONT void SetPassCoordinateSystems(bool flag) { this->PassCoordinateSystems = flag; }
240  VTKM_CONT bool GetPassCoordinateSystems() const { return this->PassCoordinateSystems; }
241 
245  VTKM_CONT void SetOutputFieldName(const std::string& name) { this->OutputFieldName = name; }
246 
248  VTKM_CONT const std::string& GetOutputFieldName() const { return this->OutputFieldName; }
249 
255  const std::string& name,
257  {
258  this->SetActiveField(0, name, association);
259  }
260 
263  vtkm::IdComponent index,
264  const std::string& name,
266  {
267  auto index_st = static_cast<std::size_t>(index);
268  this->ResizeIfNeeded(index_st);
269  this->ActiveFieldNames[index_st] = name;
270  this->ActiveFieldAssociation[index_st] = association;
271  }
272 
274  VTKM_CONT const std::string& GetActiveFieldName(vtkm::IdComponent index = 0) const
275  {
276  VTKM_ASSERT((index >= 0) &&
277  (index < static_cast<vtkm::IdComponent>(this->ActiveFieldNames.size())));
278  return this->ActiveFieldNames[index];
279  }
280 
283  vtkm::IdComponent index = 0) const
284  {
285  return this->ActiveFieldAssociation[index];
286  }
287 
292  {
293  this->SetActiveCoordinateSystem(0, coord_idx);
294  }
295 
298  {
299  auto index_st = static_cast<std::size_t>(index);
300  this->ResizeIfNeeded(index_st);
301  this->ActiveCoordinateSystemIndices[index_st] = coord_idx;
302  }
303 
306  {
307  auto index_st = static_cast<std::size_t>(index);
308  return this->ActiveCoordinateSystemIndices[index_st];
309  }
310 
314 
317  {
318  auto index_st = static_cast<std::size_t>(index);
319  this->ResizeIfNeeded(index_st);
320  this->UseCoordinateSystemAsField[index] = val;
321  }
322 
324  VTKM_CONT
326  {
327  VTKM_ASSERT((index >= 0) &&
328  (index < static_cast<vtkm::IdComponent>(this->ActiveFieldNames.size())));
329  return this->UseCoordinateSystemAsField[index];
330  }
331 
340  {
341  VTKM_ASSERT(this->ActiveFieldNames.size() == this->UseCoordinateSystemAsField.size());
342  return static_cast<vtkm::IdComponent>(this->UseCoordinateSystemAsField.size());
343  }
344 
349  VTKM_CONT virtual bool CanThread() const;
350 
351  VTKM_CONT void SetThreadsPerCPU(vtkm::Id numThreads) { this->NumThreadsPerCPU = numThreads; }
352  VTKM_CONT void SetThreadsPerGPU(vtkm::Id numThreads) { this->NumThreadsPerGPU = numThreads; }
353 
354  VTKM_CONT vtkm::Id GetThreadsPerCPU() const { return this->NumThreadsPerCPU; }
355  VTKM_CONT vtkm::Id GetThreadsPerGPU() const { return this->NumThreadsPerGPU; }
356 
358  {
359  return this->CanThread() && this->RunFilterWithMultipleThreads;
360  }
361 
363  {
364  if (this->CanThread())
365  this->RunFilterWithMultipleThreads = val;
366  else
367  {
368  std::string msg =
369  "Multi threaded filter not supported for " + std::string(typeid(*this).name());
371  }
372  }
373 
374  // FIXME: Is this actually materialize? Are there different kinds of Invoker?
378  void SetInvoker(vtkm::cont::Invoker inv) { this->Invoke = inv; }
379 
380 protected:
382 
393  VTKM_CONT vtkm::cont::DataSet CreateResult(const vtkm::cont::DataSet& inDataSet) const;
394 
407  VTKM_CONT vtkm::cont::DataSet CreateResultField(const vtkm::cont::DataSet& inDataSet,
408  const vtkm::cont::Field& resultField) const;
409 
427  const vtkm::cont::DataSet& inDataSet,
428  const std::string& resultFieldName,
429  vtkm::cont::Field::Association resultFieldAssociation,
430  const vtkm::cont::UnknownArrayHandle& resultFieldArray) const
431  {
432  return this->CreateResultField(
433  inDataSet, vtkm::cont::Field{ resultFieldName, resultFieldAssociation, resultFieldArray });
434  }
435 
451  const vtkm::cont::DataSet& inDataSet,
452  const std::string& resultFieldName,
453  const vtkm::cont::UnknownArrayHandle& resultFieldArray) const
454  {
455  return this->CreateResultField(inDataSet,
456  vtkm::cont::Field{ resultFieldName,
458  resultFieldArray });
459  }
460 
476  const vtkm::cont::DataSet& inDataSet,
477  const std::string& resultFieldName,
478  const vtkm::cont::UnknownArrayHandle& resultFieldArray) const
479  {
480  return this->CreateResultField(inDataSet,
481  vtkm::cont::Field{ resultFieldName,
483  resultFieldArray });
484  }
485 
486 
499  const vtkm::cont::PartitionedDataSet& input,
500  const vtkm::cont::PartitionedDataSet& resultPartitions) const;
501 
516  template <typename FieldMapper>
518  const vtkm::cont::PartitionedDataSet& input,
519  const vtkm::cont::PartitionedDataSet& resultPartitions,
520  FieldMapper&& fieldMapper) const
521  {
522  vtkm::cont::PartitionedDataSet output(resultPartitions.GetPartitions());
523  this->MapFieldsOntoOutput(input, this->GetFieldsToPass(), output, fieldMapper);
524  return output;
525  }
526 
545  template <typename FieldMapper>
547  const vtkm::cont::UnknownCellSet& resultCellSet,
548  FieldMapper&& fieldMapper) const
549  {
550  vtkm::cont::DataSet outDataSet;
551  outDataSet.SetCellSet(resultCellSet);
552  this->MapFieldsOntoOutput(inDataSet, this->GetFieldsToPass(), outDataSet, fieldMapper);
553  return outDataSet;
554  }
555 
576  template <typename FieldMapper>
578  const vtkm::cont::DataSet& inDataSet,
579  const vtkm::cont::UnknownCellSet& resultCellSet,
580  const vtkm::cont::CoordinateSystem& resultCoordSystem,
581  FieldMapper&& fieldMapper) const
582  {
583  vtkm::cont::DataSet outDataSet;
584  outDataSet.SetCellSet(resultCellSet);
585  vtkm::filter::FieldSelection fieldSelection = this->GetFieldsToPass();
586  if (this->GetPassCoordinateSystems() || fieldSelection.HasField(resultCoordSystem))
587  {
588  outDataSet.AddCoordinateSystem(resultCoordSystem);
589  fieldSelection.AddField(resultCoordSystem, vtkm::filter::FieldSelection::Mode::Exclude);
590  }
591  this->MapFieldsOntoOutput(inDataSet, fieldSelection, outDataSet, fieldMapper);
592  return outDataSet;
593  }
594 
616  template <typename FieldMapper>
618  const vtkm::cont::DataSet& inDataSet,
619  const vtkm::cont::UnknownCellSet& resultCellSet,
620  const std::string& coordsName,
621  const vtkm::cont::UnknownArrayHandle& coordsData,
622  FieldMapper&& fieldMapper) const
623  {
624  return this->CreateResultCoordinateSystem(
625  inDataSet,
626  resultCellSet,
627  vtkm::cont::CoordinateSystem{ coordsName, coordsData },
628  fieldMapper);
629  }
630 
636  {
637  return this->GetFieldFromDataSet(0, input);
638  }
639 
642  const vtkm::cont::DataSet& input) const
643  {
644  if (this->UseCoordinateSystemAsField[index])
645  {
646  // Note that we cannot use input.GetCoordinateSystem because that does not return
647  // a reference to a field. Instead, get the field name for the coordinate system
648  // and return the field.
649  const std::string& coordSystemName =
650  input.GetCoordinateSystemName(this->GetActiveCoordinateSystemIndex(index));
651  return input.GetPointField(coordSystemName);
652  }
653  else
654  {
655  return input.GetField(this->GetActiveFieldName(index),
656  this->GetActiveFieldAssociation(index));
657  }
658  }
659 
660  VTKM_CONT virtual vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& inData) = 0;
661  VTKM_CONT virtual vtkm::cont::PartitionedDataSet DoExecutePartitions(
662  const vtkm::cont::PartitionedDataSet& inData);
663 
674  template <typename Functor, typename... Args>
676  Functor&& functor,
677  Args&&... args) const
678  {
679  fieldArray
681  std::forward<Functor>(functor), std::forward<Args>(args)...);
682  }
684  template <typename Functor, typename... Args>
686  Functor&& functor,
687  Args&&... args) const
688  {
689  this->CastAndCallScalarField(
690  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
691  }
692 
705  template <vtkm::IdComponent VecSize, typename Functor, typename... Args>
707  Functor&& functor,
708  Args&&... args) const
709  {
710  using VecList =
713  std::forward<Functor>(functor), std::forward<Args>(args)...);
714  }
716  template <vtkm::IdComponent VecSize, typename Functor, typename... Args>
718  Functor&& functor,
719  Args&&... args) const
720  {
721  this->CastAndCallVecField<VecSize>(
722  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
723  }
724 
736  template <typename Functor, typename... Args>
738  Functor&& functor,
739  Args&&... args) const
740  {
741  if (fieldArray.IsBaseComponentType<vtkm::Float32>())
742  {
743  functor(fieldArray.ExtractArrayFromComponents<vtkm::Float32>(), std::forward<Args>(args)...);
744  }
745  else if (fieldArray.IsBaseComponentType<vtkm::Float64>())
746  {
747  functor(fieldArray.ExtractArrayFromComponents<vtkm::Float64>(), std::forward<Args>(args)...);
748  }
749  else
750  {
751  // Field component type is not directly supported. Copy to floating point array.
752  vtkm::cont::UnknownArrayHandle floatArray = fieldArray.NewInstanceFloatBasic();
753  vtkm::cont::ArrayCopy(fieldArray, floatArray);
754  functor(floatArray.ExtractArrayFromComponents<vtkm::FloatDefault>(),
755  std::forward<Args>(args)...);
756  }
757  }
759  template <typename Functor, typename... Args>
761  Functor&& functor,
762  Args&&... args) const
763  {
764  this->CastAndCallVariableVecField(
765  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
766  }
767 
768 private:
769  template <typename FieldMapper>
771  const vtkm::filter::FieldSelection& fieldSelection,
772  vtkm::cont::DataSet& output,
773  FieldMapper&& fieldMapper) const
774  {
775  // Basic field mapping
776  for (vtkm::IdComponent cc = 0; cc < input.GetNumberOfFields(); ++cc)
777  {
778  auto field = input.GetField(cc);
779  if (fieldSelection.IsFieldSelected(field))
780  {
781  fieldMapper(output, field);
782  }
783  }
784 
785  // Check if the ghost levels have been copied. If so, set so on the output.
786  if (input.HasGhostCellField())
787  {
788  const std::string& ghostFieldName = input.GetGhostCellFieldName();
789  if (output.HasCellField(ghostFieldName) && (output.GetGhostCellFieldName() != ghostFieldName))
790  {
791  output.SetGhostCellFieldName(ghostFieldName);
792  }
793  }
794 
795  for (vtkm::IdComponent csIndex = 0; csIndex < input.GetNumberOfCoordinateSystems(); ++csIndex)
796  {
797  auto coords = input.GetCoordinateSystem(csIndex);
798  if (!output.HasCoordinateSystem(coords.GetName()))
799  {
800  if (!output.HasPointField(coords.GetName()) && this->GetPassCoordinateSystems())
801  {
802  fieldMapper(output, coords);
803  }
804  if (output.HasPointField(coords.GetName()))
805  {
806  output.AddCoordinateSystem(coords.GetName());
807  }
808  }
809  }
810  }
811 
812  template <typename FieldMapper>
814  const vtkm::filter::FieldSelection& fieldSelection,
816  FieldMapper&& fieldMapper) const
817  {
818  for (vtkm::IdComponent cc = 0; cc < input.GetNumberOfFields(); ++cc)
819  {
820  auto field = input.GetField(cc);
821  if (fieldSelection.IsFieldSelected(field))
822  {
823  fieldMapper(output, field);
824  }
825  }
826  }
827 
828  template <vtkm::IdComponent VecSize>
829  struct ScalarToVec
830  {
831  template <typename T>
833  };
834 
835  VTKM_CONT
836  virtual vtkm::Id DetermineNumberOfThreads(const vtkm::cont::PartitionedDataSet& input);
837 
838  void ResizeIfNeeded(size_t index_st);
839 
841  bool PassCoordinateSystems = true;
842  bool RunFilterWithMultipleThreads = false;
843  vtkm::Id NumThreadsPerCPU = 4;
844  vtkm::Id NumThreadsPerGPU = 8;
845 
846  std::string OutputFieldName;
847 
848  std::vector<std::string> ActiveFieldNames;
849  std::vector<vtkm::cont::Field::Association> ActiveFieldAssociation;
850  std::vector<bool> UseCoordinateSystemAsField;
851  std::vector<vtkm::Id> ActiveCoordinateSystemIndices;
852 };
853 
854 class VTKM_DEPRECATED(2.2, "Inherit from `vtkm::cont::Filter` directly.") FilterField
855  : public vtkm::filter::Filter
856 {
857 };
858 
859 }
860 } // namespace vtkm::filter
861 
862 #endif
vtkm::cont::PartitionedDataSet::GetPartitions
const std::vector< vtkm::cont::DataSet > & GetPartitions() const
Get an STL vector of all DataSet objects stored in PartitionedDataSet.
vtkm::filter::Filter::GetFieldFromDataSet
const vtkm::cont::Field & GetFieldFromDataSet(const vtkm::cont::DataSet &input) const
Retrieve an input field from a vtkm::cont::DataSet object.
Definition: Filter.h:635
vtkm_filter_core_export.h
vtkm::filter::Filter::SetUseCoordinateSystemAsField
void SetUseCoordinateSystemAsField(bool val)
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:313
vtkm::filter::Filter::GetActiveFieldName
const std::string & GetActiveFieldName(vtkm::IdComponent index=0) const
Specifies a field to operate on.
Definition: Filter.h:274
vtkm::filter::Filter::SetActiveCoordinateSystem
void SetActiveCoordinateSystem(vtkm::IdComponent index, vtkm::Id coord_idx)
Specifies the coordinate system index to make active to use when processing the input vtkm::cont::Dat...
Definition: Filter.h:297
vtkm::filter::Filter::GetFieldsToPass
const vtkm::filter::FieldSelection & GetFieldsToPass() const
Specify which fields get passed from input to output.
Definition: Filter.h:223
vtkm::cont::UnknownArrayHandle::IsBaseComponentType
bool IsBaseComponentType() const
Returns true if this array's ValueType has the provided base component type.
Definition: UnknownArrayHandle.h:540
vtkm::filter::Filter::SetOutputFieldName
void SetOutputFieldName(const std::string &name)
Specifies the name of the output field generated.
Definition: Filter.h:245
vtkm::filter::Filter::GetActiveCoordinateSystemIndex
vtkm::Id GetActiveCoordinateSystemIndex(vtkm::IdComponent index=0) const
Specifies the coordinate system index to make active to use when processing the input vtkm::cont::Dat...
Definition: Filter.h:305
vtkm::filter::FieldSelection::Mode::All
@ All
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::PartitionedDataSet::GetNumberOfFields
vtkm::IdComponent GetNumberOfFields() const
Methods to Add and Get fields on a PartitionedDataSet.
Definition: PartitionedDataSet.h:90
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
vtkm::filter::FieldSelection
A FieldSelection stores information about fields to map for input dataset to output when a filter is ...
Definition: FieldSelection.h:31
vtkm::filter::Filter::MapFieldsOntoOutput
void MapFieldsOntoOutput(const vtkm::cont::DataSet &input, const vtkm::filter::FieldSelection &fieldSelection, vtkm::cont::DataSet &output, FieldMapper &&fieldMapper) const
Definition: Filter.h:770
vtkm::filter::Filter::SetUseCoordinateSystemAsField
void SetUseCoordinateSystemAsField(vtkm::IdComponent index, bool val)
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:316
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::cont::DataSet::HasPointField
bool HasPointField(const std::string &name) const
Definition: DataSet.h:134
vtkm::filter::Filter::GetActiveFieldAssociation
vtkm::cont::Field::Association GetActiveFieldAssociation(vtkm::IdComponent index=0) const
Specifies a field to operate on.
Definition: Filter.h:282
vtkm::cont::DataSet::GetField
const vtkm::cont::Field & GetField(vtkm::Id index) const
Retrieves a field by index.
Definition: DataSet.h:108
vtkm::cont::Field::Association
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:38
vtkm::cont::DataSet::HasGhostCellField
bool HasGhostCellField() const
vtkm::cont::DataSet::SetCellSet
void SetCellSet(const CellSetType &cellSet)
Definition: DataSet.h:396
vtkm::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:430
vtkm::filter::Filter::ActiveFieldNames
std::vector< std::string > ActiveFieldNames
Definition: Filter.h:848
vtkm::filter::Filter::SetActiveField
void SetActiveField(const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Specifies a field to operate on.
Definition: Filter.h:254
vtkm::filter::Filter::Invoke
vtkm::cont::Invoker Invoke
Definition: Filter.h:381
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm::cont::DataSet::SetGhostCellFieldName
void SetGhostCellFieldName(const std::string &name)
Sets the name of the field to use for cell ghost levels.
vtkm::filter::Filter::SetThreadsPerCPU
void SetThreadsPerCPU(vtkm::Id numThreads)
Definition: Filter.h:351
vtkm::cont::DataSet::GetPointField
const vtkm::cont::Field & GetPointField(const std::string &name) const
Returns the first point field that matches the provided name.
Definition: DataSet.h:212
vtkm::filter::Filter::CastAndCallVecField
void CastAndCallVecField(const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input vector field.
Definition: Filter.h:717
Invoker.h
vtkm::filter::FieldSelection::HasField
bool HasField(const vtkm::cont::Field &inputField) const
Returns true if the input field has been added to this selection.
Definition: FieldSelection.h:161
vtkm::cont::UnknownCellSet
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
vtkm::filter::Filter::SetFieldsToPass
void SetFieldsToPass(const std::string &fieldname, vtkm::filter::FieldSelection::Mode mode)
Specify which fields get passed from input to output.
Definition: Filter.h:215
vtkm::cont::DataSet::GetGhostCellFieldName
const std::string & GetGhostCellFieldName() const
vtkm::filter::Filter::SetRunMultiThreadedFilter
void SetRunMultiThreadedFilter(bool val)
Definition: Filter.h:362
vtkm::cont::DataSet::HasCellField
bool HasCellField(const std::string &name) const
Definition: DataSet.h:122
vtkm::cont::DataSet::GetNumberOfCoordinateSystems
vtkm::IdComponent GetNumberOfCoordinateSystems() const
Definition: DataSet.h:412
ArrayCopy.h
vtkm::filter::Filter::CastAndCallScalarField
void CastAndCallScalarField(const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input scalar field.
Definition: Filter.h:675
vtkm::cont::Field::GetData
const vtkm::cont::UnknownArrayHandle & GetData() const
Get the array of the data for the field.
vtkm::cont::CoordinateSystem
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:30
vtkm::filter::Filter::GetUseCoordinateSystemAsField
bool GetUseCoordinateSystemAsField(vtkm::IdComponent index=0) const
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:325
vtkm::filter::FieldSelection::AddField
void AddField(const vtkm::cont::Field &inputField)
Definition: FieldSelection.h:116
vtkm::filter::FieldSelection::Mode::Select
@ Select
vtkm::filter::FilterField
Definition: Filter.h:854
vtkm::filter::Filter::GetFieldFromDataSet
const vtkm::cont::Field & GetFieldFromDataSet(vtkm::IdComponent index, const vtkm::cont::DataSet &input) const
Retrieve an input field from a vtkm::cont::DataSet object.
Definition: Filter.h:641
vtkm::filter::Filter::CreateResultCoordinateSystem
vtkm::cont::DataSet CreateResultCoordinateSystem(const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, const std::string &coordsName, const vtkm::cont::UnknownArrayHandle &coordsData, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:617
vtkm::cont::LogLevel::Info
@ Info
Information messages (detected hardware, etc) and temporary debugging output.
vtkm::filter::Filter::OutputFieldName
std::string OutputFieldName
Definition: Filter.h:846
vtkm::filter::Filter::ScalarToVec
Definition: Filter.h:829
FieldSelection.h
vtkm::filter::Filter::CreateResultField
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: Filter.h:426
vtkm::filter::Filter::CastAndCallScalarField
void CastAndCallScalarField(const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input scalar field.
Definition: Filter.h:685
vtkm::ListTransform
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:598
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:31
vtkm::filter::Filter::GetThreadsPerGPU
vtkm::Id GetThreadsPerGPU() const
Definition: Filter.h:355
vtkm::filter::Filter::GetNumberOfActiveFields
vtkm::IdComponent GetNumberOfActiveFields() const
Return the number of active fields currently set.
Definition: Filter.h:339
vtkm::filter::Filter::GetFieldsToPass
vtkm::filter::FieldSelection & GetFieldsToPass()
Specify which fields get passed from input to output.
Definition: Filter.h:226
vtkm::filter::Filter::CreateResultFieldPoint
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: Filter.h:450
vtkm::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:41
vtkm::filter::Filter::GetRunMultiThreadedFilter
bool GetRunMultiThreadedFilter() const
Definition: Filter.h:357
VTKM_FILTER_CORE_EXPORT
#define VTKM_FILTER_CORE_EXPORT
Definition: vtkm_filter_core_export.h:44
vtkm::cont::UnknownArrayHandle::CastAndCallForTypesWithFloatFallback
void CastAndCallForTypesWithFloatFallback(Functor &&functor, Args &&... args) const
Call a functor using the underlying array type with a float cast fallback.
Definition: UnknownArrayHandle.h:1195
vtkm::filter::Filter
Base class for all filters.
Definition: Filter.h:163
vtkm::cont::ArrayCopy
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:120
vtkm::cont::Field::Association::Any
@ Any
Any field regardless of the association.
vtkm::filter::Filter::SetActiveCoordinateSystem
void SetActiveCoordinateSystem(vtkm::Id coord_idx)
Specifies the coordinate system index to make active to use when processing the input vtkm::cont::Dat...
Definition: Filter.h:291
vtkm::filter::Filter::GetPassCoordinateSystems
bool GetPassCoordinateSystems() const
Specify whether to always pass coordinate systems.
Definition: Filter.h:240
vtkm::filter::FieldSelection::IsFieldSelected
bool IsFieldSelected(const vtkm::cont::Field &inputField) const
Returns true if the input field should be mapped to the output dataset.
Definition: FieldSelection.h:104
VTKM_DEFAULT_STORAGE_LIST
#define VTKM_DEFAULT_STORAGE_LIST
Definition: DefaultTypes.h:50
vtkm::cont::Field::Association::Points
@ Points
A field that applies to points.
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
Field.h
vtkm::filter::Filter::SetPassCoordinateSystems
void SetPassCoordinateSystems(bool flag)
Specify whether to always pass coordinate systems.
Definition: Filter.h:238
vtkm::cont::DataSet::HasCoordinateSystem
bool HasCoordinateSystem(const std::string &name) const
Definition: DataSet.h:374
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::filter::Filter::CreateResult
vtkm::cont::PartitionedDataSet CreateResult(const vtkm::cont::PartitionedDataSet &input, const vtkm::cont::PartitionedDataSet &resultPartitions, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:517
TaskQueue.h
vtkm::cont::DataSet::AddCoordinateSystem
vtkm::IdComponent AddCoordinateSystem(const vtkm::cont::CoordinateSystem &cs)
Adds the given CoordinateSystem to the DataSet.
VTKM_LOG_S
#define VTKM_LOG_S(level,...)
Writes a message using stream syntax to the indicated log level.
Definition: Logging.h:208
vtkm::filter::Filter::SetActiveField
void SetActiveField(vtkm::IdComponent index, const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Specifies a field to operate on.
Definition: Filter.h:262
vtkm::filter::FieldSelection::Mode::Exclude
@ Exclude
vtkm::filter::Filter::CastAndCallVecField
void CastAndCallVecField(const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input vector field.
Definition: Filter.h:706
vtkm::Vec
A short fixed-length array.
Definition: Types.h:357
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
PartitionedDataSet.h
vtkm::filter::Filter::MapFieldsOntoOutput
void MapFieldsOntoOutput(const vtkm::cont::PartitionedDataSet &input, const vtkm::filter::FieldSelection &fieldSelection, vtkm::cont::PartitionedDataSet &output, FieldMapper &&fieldMapper) const
Definition: Filter.h:813
vtkm::filter::Filter::ActiveFieldAssociation
std::vector< vtkm::cont::Field::Association > ActiveFieldAssociation
Definition: Filter.h:849
vtkm::filter::Filter::CreateResult
vtkm::cont::DataSet CreateResult(const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:546
vtkm::cont::Field::Association::Cells
@ Cells
A field that applies to cells.
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::cont::DataSet::GetCoordinateSystem
vtkm::cont::CoordinateSystem GetCoordinateSystem(vtkm::Id index=0) const
vtkm::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:161
vtkm::cont::UnknownArrayHandle::ExtractArrayFromComponents
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::filter::Filter::GetThreadsPerCPU
vtkm::Id GetThreadsPerCPU() const
Definition: Filter.h:354
vtkm::filter::Filter::SetThreadsPerGPU
void SetThreadsPerGPU(vtkm::Id numThreads)
Definition: Filter.h:352
vtkm::cont::UnknownArrayHandle::NewInstanceFloatBasic
UnknownArrayHandle NewInstanceFloatBasic() const
Create a new ArrayHandleBasic with the base component of vtkm::FloatDefault
Logging.h
Logging utilities.
VTKM_DEPRECATED
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
vtkm::filter::Filter::GetOutputFieldName
const std::string & GetOutputFieldName() const
Specifies the name of the output field generated.
Definition: Filter.h:248
vtkm::filter::Filter::CastAndCallVariableVecField
void CastAndCallVariableVecField(const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
This method is like CastAndCallVecField except that it can be used for a field of unknown vector size...
Definition: Filter.h:760
vtkm::filter::Filter::SetInvoker
void SetInvoker(vtkm::cont::Invoker inv)
Specify the vtkm::cont::Invoker to be used to execute worklets by this filter instance.
Definition: Filter.h:378
vtkm::cont::DataSet::GetCoordinateSystemName
const std::string & GetCoordinateSystemName(vtkm::Id index=0) const
vtkm::filter::Filter::ActiveCoordinateSystemIndices
std::vector< vtkm::Id > ActiveCoordinateSystemIndices
Definition: Filter.h:851
vtkm::filter::Filter::CreateResultFieldCell
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: Filter.h:475
DataSet.h
vtkm::cont::DataSet::GetNumberOfFields
vtkm::IdComponent GetNumberOfFields() const
Definition: DataSet.h:409
vtkm::filter::Filter::UseCoordinateSystemAsField
std::vector< bool > UseCoordinateSystemAsField
Definition: Filter.h:850
vtkm::filter::Filter::CreateResultCoordinateSystem
vtkm::cont::DataSet CreateResultCoordinateSystem(const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, const vtkm::cont::CoordinateSystem &resultCoordSystem, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:577
vtkm::TypeListFieldScalar
vtkm::List< vtkm::Float32, vtkm::Float64 > TypeListFieldScalar
A list containing types used for scalar fields.
Definition: TypeList.h:47
vtkm::filter::FieldSelection::Mode
Mode
Definition: FieldSelection.h:34
vtkm::cont::PartitionedDataSet::GetField
const vtkm::cont::Field & GetField(vtkm::Id index) const
Definition: PartitionedDataSet.h:152
vtkm::cont::PartitionedDataSet
Comprises a set of vtkm::cont::DataSet objects.
Definition: PartitionedDataSet.h:26
vtkm::filter::Filter::CastAndCallVariableVecField
void CastAndCallVariableVecField(const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
This method is like CastAndCallVecField except that it can be used for a field of unknown vector size...
Definition: Filter.h:737