Viskores  1.0
Filter.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 #ifndef viskores_filter_Filter_h
19 #define viskores_filter_Filter_h
20 
22 #include <viskores/cont/DataSet.h>
23 #include <viskores/cont/Field.h>
24 #include <viskores/cont/Invoker.h>
25 #include <viskores/cont/Logging.h>
27 
31 
32 namespace viskores
33 {
34 namespace filter
35 {
171 class VISKORES_FILTER_CORE_EXPORT Filter
172 {
173 public:
175 
176  VISKORES_CONT virtual ~Filter();
177 
182 
188 
198  VISKORES_CONT void SetFieldsToPass(const viskores::filter::FieldSelection& fieldsToPass);
200  VISKORES_CONT void SetFieldsToPass(viskores::filter::FieldSelection&& fieldsToPass);
201 
203  VISKORES_CONT void SetFieldsToPass(const viskores::filter::FieldSelection& fieldsToPass,
205 
207  VISKORES_CONT void SetFieldsToPass(
208  std::initializer_list<std::string> fields,
210 
212  VISKORES_CONT void SetFieldsToPass(
213  std::initializer_list<std::pair<std::string, viskores::cont::Field::Association>> fields,
215 
216 
218  VISKORES_CONT void SetFieldsToPass(
219  const std::string& fieldname,
222 
224  VISKORES_CONT void SetFieldsToPass(const std::string& fieldname,
226  {
227  this->SetFieldsToPass(fieldname, viskores::cont::Field::Association::Any, mode);
228  }
229 
232  const viskores::filter::FieldSelection& GetFieldsToPass() const { return this->FieldsToPass; }
235  viskores::filter::FieldSelection& GetFieldsToPass() { return this->FieldsToPass; }
236 
247  VISKORES_CONT void SetPassCoordinateSystems(bool flag) { this->PassCoordinateSystems = flag; }
249  VISKORES_CONT bool GetPassCoordinateSystems() const { return this->PassCoordinateSystems; }
250 
254  VISKORES_CONT void SetOutputFieldName(const std::string& name) { this->OutputFieldName = name; }
255 
257  VISKORES_CONT const std::string& GetOutputFieldName() const { return this->OutputFieldName; }
258 
264  const std::string& name,
266  {
267  this->SetActiveField(0, name, association);
268  }
269 
272  viskores::IdComponent index,
273  const std::string& name,
275  {
276  auto index_st = static_cast<std::size_t>(index);
277  this->ResizeIfNeeded(index_st);
278  this->ActiveFieldNames[index_st] = name;
279  this->ActiveFieldAssociation[index_st] = association;
280  }
281 
283  VISKORES_CONT const std::string& GetActiveFieldName(viskores::IdComponent index = 0) const
284  {
285  VISKORES_ASSERT((index >= 0) &&
286  (index < static_cast<viskores::IdComponent>(this->ActiveFieldNames.size())));
287  return this->ActiveFieldNames[index];
288  }
289 
292  viskores::IdComponent index = 0) const
293  {
294  return this->ActiveFieldAssociation[index];
295  }
296 
301  {
302  this->SetActiveCoordinateSystem(0, coord_idx);
303  }
304 
307  {
308  auto index_st = static_cast<std::size_t>(index);
309  this->ResizeIfNeeded(index_st);
310  this->ActiveCoordinateSystemIndices[index_st] = coord_idx;
311  }
312 
315  {
316  auto index_st = static_cast<std::size_t>(index);
317  return this->ActiveCoordinateSystemIndices[index_st];
318  }
319 
323  {
324  SetUseCoordinateSystemAsField(0, val);
325  }
326 
329  {
330  auto index_st = static_cast<std::size_t>(index);
331  this->ResizeIfNeeded(index_st);
332  this->UseCoordinateSystemAsField[index] = val;
333  }
334 
338  {
339  VISKORES_ASSERT((index >= 0) &&
340  (index < static_cast<viskores::IdComponent>(this->ActiveFieldNames.size())));
341  return this->UseCoordinateSystemAsField[index];
342  }
343 
352  {
353  VISKORES_ASSERT(this->ActiveFieldNames.size() == this->UseCoordinateSystemAsField.size());
354  return static_cast<viskores::IdComponent>(this->UseCoordinateSystemAsField.size());
355  }
356 
361  VISKORES_CONT virtual bool CanThread() const;
362 
364  {
365  this->NumThreadsPerCPU = numThreads;
366  }
368  {
369  this->NumThreadsPerGPU = numThreads;
370  }
371 
372  VISKORES_CONT viskores::Id GetThreadsPerCPU() const { return this->NumThreadsPerCPU; }
373  VISKORES_CONT viskores::Id GetThreadsPerGPU() const { return this->NumThreadsPerGPU; }
374 
376  {
377  return this->CanThread() && this->RunFilterWithMultipleThreads;
378  }
379 
381  {
382  if (this->CanThread())
383  this->RunFilterWithMultipleThreads = val;
384  else
385  {
386  std::string msg =
387  "Multi threaded filter not supported for " + std::string(typeid(*this).name());
389  }
390  }
391 
392  // FIXME: Is this actually materialize? Are there different kinds of Invoker?
396  void SetInvoker(viskores::cont::Invoker inv) { this->Invoke = inv; }
397 
398 protected:
400 
412  const viskores::cont::DataSet& inDataSet) const;
413 
426  VISKORES_CONT viskores::cont::DataSet CreateResultField(
427  const viskores::cont::DataSet& inDataSet,
428  const viskores::cont::Field& resultField) const;
429 
447  const viskores::cont::DataSet& inDataSet,
448  const std::string& resultFieldName,
449  viskores::cont::Field::Association resultFieldAssociation,
450  const viskores::cont::UnknownArrayHandle& resultFieldArray) const
451  {
452  return this->CreateResultField(
453  inDataSet,
454  viskores::cont::Field{ resultFieldName, resultFieldAssociation, resultFieldArray });
455  }
456 
472  const viskores::cont::DataSet& inDataSet,
473  const std::string& resultFieldName,
474  const viskores::cont::UnknownArrayHandle& resultFieldArray) const
475  {
476  return this->CreateResultField(
477  inDataSet,
479  resultFieldName, viskores::cont::Field::Association::Points, resultFieldArray });
480  }
481 
497  const viskores::cont::DataSet& inDataSet,
498  const std::string& resultFieldName,
499  const viskores::cont::UnknownArrayHandle& resultFieldArray) const
500  {
501  return this->CreateResultField(inDataSet,
502  viskores::cont::Field{ resultFieldName,
504  resultFieldArray });
505  }
506 
507 
521  const viskores::cont::PartitionedDataSet& resultPartitions) const;
522 
537  template <typename FieldMapper>
540  const viskores::cont::PartitionedDataSet& resultPartitions,
541  FieldMapper&& fieldMapper) const
542  {
543  viskores::cont::PartitionedDataSet output(resultPartitions.GetPartitions());
544  this->MapFieldsOntoOutput(input, this->GetFieldsToPass(), output, fieldMapper);
545  return output;
546  }
547 
566  template <typename FieldMapper>
568  const viskores::cont::DataSet& inDataSet,
569  const viskores::cont::UnknownCellSet& resultCellSet,
570  FieldMapper&& fieldMapper) const
571  {
572  viskores::cont::DataSet outDataSet;
573  outDataSet.SetCellSet(resultCellSet);
574  this->MapFieldsOntoOutput(inDataSet, this->GetFieldsToPass(), outDataSet, fieldMapper);
575  return outDataSet;
576  }
577 
598  template <typename FieldMapper>
600  const viskores::cont::DataSet& inDataSet,
601  const viskores::cont::UnknownCellSet& resultCellSet,
602  const viskores::cont::CoordinateSystem& resultCoordSystem,
603  FieldMapper&& fieldMapper) const
604  {
605  viskores::cont::DataSet outDataSet;
606  outDataSet.SetCellSet(resultCellSet);
607  viskores::filter::FieldSelection fieldSelection = this->GetFieldsToPass();
608  if (this->GetPassCoordinateSystems() || fieldSelection.HasField(resultCoordSystem))
609  {
610  outDataSet.AddCoordinateSystem(resultCoordSystem);
611  fieldSelection.AddField(resultCoordSystem, viskores::filter::FieldSelection::Mode::Exclude);
612  }
613  this->MapFieldsOntoOutput(inDataSet, fieldSelection, outDataSet, fieldMapper);
614  return outDataSet;
615  }
616 
638  template <typename FieldMapper>
640  const viskores::cont::DataSet& inDataSet,
641  const viskores::cont::UnknownCellSet& resultCellSet,
642  const std::string& coordsName,
643  const viskores::cont::UnknownArrayHandle& coordsData,
644  FieldMapper&& fieldMapper) const
645  {
646  return this->CreateResultCoordinateSystem(
647  inDataSet,
648  resultCellSet,
649  viskores::cont::CoordinateSystem{ coordsName, coordsData },
650  fieldMapper);
651  }
652 
658  const viskores::cont::DataSet& input) const
659  {
660  return this->GetFieldFromDataSet(0, input);
661  }
662 
665  viskores::IdComponent index,
666  const viskores::cont::DataSet& input) const
667  {
668  if (this->UseCoordinateSystemAsField[index])
669  {
670  // Note that we cannot use input.GetCoordinateSystem because that does not return
671  // a reference to a field. Instead, get the field name for the coordinate system
672  // and return the field.
673  const std::string& coordSystemName =
674  input.GetCoordinateSystemName(this->GetActiveCoordinateSystemIndex(index));
675  return input.GetPointField(coordSystemName);
676  }
677  else
678  {
679  return input.GetField(this->GetActiveFieldName(index),
680  this->GetActiveFieldAssociation(index));
681  }
682  }
683 
684  VISKORES_CONT virtual viskores::cont::DataSet DoExecute(
685  const viskores::cont::DataSet& inData) = 0;
686  VISKORES_CONT virtual viskores::cont::PartitionedDataSet DoExecutePartitions(
687  const viskores::cont::PartitionedDataSet& inData);
688 
699  template <typename Functor, typename... Args>
701  Functor&& functor,
702  Args&&... args) const
703  {
706  std::forward<Functor>(functor), std::forward<Args>(args)...);
707  }
709  template <typename Functor, typename... Args>
711  Functor&& functor,
712  Args&&... args) const
713  {
714  this->CastAndCallScalarField(
715  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
716  }
717 
730  template <viskores::IdComponent VecSize, typename Functor, typename... Args>
732  Functor&& functor,
733  Args&&... args) const
734  {
735  using VecList =
738  std::forward<Functor>(functor), std::forward<Args>(args)...);
739  }
741  template <viskores::IdComponent VecSize, typename Functor, typename... Args>
743  Functor&& functor,
744  Args&&... args) const
745  {
746  this->CastAndCallVecField<VecSize>(
747  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
748  }
749 
761  template <typename Functor, typename... Args>
763  const viskores::cont::UnknownArrayHandle& fieldArray,
764  Functor&& functor,
765  Args&&... args) const
766  {
767  if (fieldArray.IsBaseComponentType<viskores::Float32>())
768  {
769  functor(fieldArray.ExtractArrayFromComponents<viskores::Float32>(),
770  std::forward<Args>(args)...);
771  }
772  else if (fieldArray.IsBaseComponentType<viskores::Float64>())
773  {
774  functor(fieldArray.ExtractArrayFromComponents<viskores::Float64>(),
775  std::forward<Args>(args)...);
776  }
777  else
778  {
779  // Field component type is not directly supported. Copy to floating point array.
781  viskores::cont::ArrayCopy(fieldArray, floatArray);
783  std::forward<Args>(args)...);
784  }
785  }
787  template <typename Functor, typename... Args>
789  Functor&& functor,
790  Args&&... args) const
791  {
792  this->CastAndCallVariableVecField(
793  field.GetData(), std::forward<Functor>(functor), std::forward<Args>(args)...);
794  }
795 
796 private:
797  template <typename FieldMapper>
799  const viskores::filter::FieldSelection& fieldSelection,
800  viskores::cont::DataSet& output,
801  FieldMapper&& fieldMapper) const
802  {
803  // Basic field mapping
804  for (viskores::IdComponent cc = 0; cc < input.GetNumberOfFields(); ++cc)
805  {
806  auto field = input.GetField(cc);
807  if (fieldSelection.IsFieldSelected(field))
808  {
809  fieldMapper(output, field);
810  }
811  }
812 
813  // Check if the ghost levels have been copied. If so, set so on the output.
814  if (input.HasGhostCellField())
815  {
816  const std::string& ghostFieldName = input.GetGhostCellFieldName();
817  if (output.HasCellField(ghostFieldName) && (output.GetGhostCellFieldName() != ghostFieldName))
818  {
819  output.SetGhostCellFieldName(ghostFieldName);
820  }
821  }
822 
823  for (viskores::IdComponent csIndex = 0; csIndex < input.GetNumberOfCoordinateSystems();
824  ++csIndex)
825  {
826  auto coords = input.GetCoordinateSystem(csIndex);
827  if (!output.HasCoordinateSystem(coords.GetName()))
828  {
829  if (!output.HasPointField(coords.GetName()) && this->GetPassCoordinateSystems())
830  {
831  fieldMapper(output, coords);
832  }
833  if (output.HasPointField(coords.GetName()))
834  {
835  output.AddCoordinateSystem(coords.GetName());
836  }
837  }
838  }
839  }
840 
841  template <typename FieldMapper>
843  const viskores::filter::FieldSelection& fieldSelection,
845  FieldMapper&& fieldMapper) const
846  {
847  for (viskores::IdComponent cc = 0; cc < input.GetNumberOfFields(); ++cc)
848  {
849  auto field = input.GetField(cc);
850  if (fieldSelection.IsFieldSelected(field))
851  {
852  fieldMapper(output, field);
853  }
854  }
855  }
856 
857  template <viskores::IdComponent VecSize>
858  struct ScalarToVec
859  {
860  template <typename T>
862  };
863 
865  virtual viskores::Id DetermineNumberOfThreads(const viskores::cont::PartitionedDataSet& input);
866 
867  void ResizeIfNeeded(size_t index_st);
868 
870  bool PassCoordinateSystems = true;
871  bool RunFilterWithMultipleThreads = false;
872  viskores::Id NumThreadsPerCPU = 4;
873  viskores::Id NumThreadsPerGPU = 8;
874 
875  std::string OutputFieldName;
876 
877  std::vector<std::string> ActiveFieldNames;
878  std::vector<viskores::cont::Field::Association> ActiveFieldAssociation;
879  std::vector<bool> UseCoordinateSystemAsField;
880  std::vector<viskores::Id> ActiveCoordinateSystemIndices;
881 };
882 
883 class VISKORES_DEPRECATED(2.2, "Inherit from `viskores::cont::Filter` directly.") FilterField
884  : public viskores::filter::Filter
885 {
886 };
887 
888 }
889 } // namespace viskores::filter
890 
891 #endif
viskores::filter::Filter::CastAndCallScalarField
void CastAndCallScalarField(const viskores::cont::Field &field, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input scalar field.
Definition: Filter.h:710
viskores::cont::UnknownArrayHandle::NewInstanceFloatBasic
UnknownArrayHandle NewInstanceFloatBasic() const
Create a new ArrayHandleBasic with the base component of viskores::FloatDefault
viskores::cont::DataSet::GetCoordinateSystem
viskores::cont::CoordinateSystem GetCoordinateSystem(viskores::Id index=0) const
viskores::filter::Filter::OutputFieldName
std::string OutputFieldName
Definition: Filter.h:875
viskores::cont::DataSet::GetNumberOfCoordinateSystems
viskores::IdComponent GetNumberOfCoordinateSystems() const
Definition: DataSet.h:431
viskores::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:1231
viskores::cont::DataSet::GetPointField
const viskores::cont::Field & GetPointField(const std::string &name) const
Returns the first point field that matches the provided name.
Definition: DataSet.h:225
viskores::filter::FilterField
Definition: Filter.h:883
viskores::filter::Filter::GetActiveFieldAssociation
viskores::cont::Field::Association GetActiveFieldAssociation(viskores::IdComponent index=0) const
Specifies a field to operate on.
Definition: Filter.h:291
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::Filter::ActiveFieldAssociation
std::vector< viskores::cont::Field::Association > ActiveFieldAssociation
Definition: Filter.h:878
viskores::cont::Field::Association
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:46
viskores::filter::FieldSelection::Mode::Exclude
@ Exclude
viskores::filter::Filter::SetOutputFieldName
void SetOutputFieldName(const std::string &name)
Specifies the name of the output field generated.
Definition: Filter.h:254
viskores::cont::DataSet::HasPointField
bool HasPointField(const std::string &name) const
Definition: DataSet.h:147
viskores::cont::Field::Association::Any
@ Any
Any field regardless of the association.
viskores::filter::Filter::CreateResultFieldCell
viskores::cont::DataSet CreateResultFieldCell(const viskores::cont::DataSet &inDataSet, const std::string &resultFieldName, const viskores::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: Filter.h:496
viskores::filter::FieldSelection::Mode::Select
@ Select
viskores::filter::Filter::UseCoordinateSystemAsField
std::vector< bool > UseCoordinateSystemAsField
Definition: Filter.h:879
viskores::filter::Filter::SetPassCoordinateSystems
void SetPassCoordinateSystems(bool flag)
Specify whether to always pass coordinate systems.
Definition: Filter.h:247
viskores::cont::Field::GetData
const viskores::cont::UnknownArrayHandle & GetData() const
Get the array of the data for the field.
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::cont::CoordinateSystem
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:38
viskores::filter::Filter::SetThreadsPerCPU
void SetThreadsPerCPU(viskores::Id numThreads)
Definition: Filter.h:363
viskores_filter_core_export.h
viskores::cont::DataSet::GetField
const viskores::cont::Field & GetField(viskores::Id index) const
Retrieves a field by index.
Definition: DataSet.h:117
viskores::cont::DataSet::GetNumberOfFields
viskores::IdComponent GetNumberOfFields() const
Definition: DataSet.h:428
viskores::filter::Filter::MapFieldsOntoOutput
void MapFieldsOntoOutput(const viskores::cont::PartitionedDataSet &input, const viskores::filter::FieldSelection &fieldSelection, viskores::cont::PartitionedDataSet &output, FieldMapper &&fieldMapper) const
Definition: Filter.h:842
viskores::cont::LogLevel::Info
@ Info
Information messages (detected hardware, etc) and temporary debugging output.
Invoker.h
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::cont::Field::Association::Cells
@ Cells
A field that applies to cells.
VISKORES_DEFAULT_STORAGE_LIST
#define VISKORES_DEFAULT_STORAGE_LIST
Definition: DefaultTypes.h:58
viskores::filter::Filter::GetFieldsToPass
const viskores::filter::FieldSelection & GetFieldsToPass() const
Specify which fields get passed from input to output.
Definition: Filter.h:232
viskores::filter::Filter::GetActiveFieldName
const std::string & GetActiveFieldName(viskores::IdComponent index=0) const
Specifies a field to operate on.
Definition: Filter.h:283
ArrayCopy.h
viskores::cont::PartitionedDataSet::GetField
const viskores::cont::Field & GetField(viskores::Id index) const
Definition: PartitionedDataSet.h:168
viskores::filter::Filter::SetActiveField
void SetActiveField(const std::string &name, viskores::cont::Field::Association association=viskores::cont::Field::Association::Any)
Specifies a field to operate on.
Definition: Filter.h:263
viskores::cont::DataSet::AddCoordinateSystem
viskores::IdComponent AddCoordinateSystem(const viskores::cont::CoordinateSystem &cs)
Adds the given CoordinateSystem to the DataSet.
viskores::cont::DataSet::HasCoordinateSystem
bool HasCoordinateSystem(const std::string &name) const
Definition: DataSet.h:393
viskores::filter::Filter::GetThreadsPerGPU
viskores::Id GetThreadsPerGPU() const
Definition: Filter.h:373
viskores::filter::Filter::SetActiveCoordinateSystem
void SetActiveCoordinateSystem(viskores::Id coord_idx)
Specifies the coordinate system index to make active to use when processing the input viskores::cont:...
Definition: Filter.h:300
viskores::cont::DataSet::GetGhostCellFieldName
const std::string & GetGhostCellFieldName() const
viskores::filter::Filter::CreateResultField
viskores::cont::DataSet CreateResultField(const viskores::cont::DataSet &inDataSet, const std::string &resultFieldName, viskores::cont::Field::Association resultFieldAssociation, const viskores::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: Filter.h:446
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::filter::Filter::GetFieldFromDataSet
const viskores::cont::Field & GetFieldFromDataSet(viskores::IdComponent index, const viskores::cont::DataSet &input) const
Retrieve an input field from a viskores::cont::DataSet object.
Definition: Filter.h:664
viskores::cont::DataSet::GetCoordinateSystemName
const std::string & GetCoordinateSystemName(viskores::Id index=0) const
viskores::filter::Filter::CreateResult
viskores::cont::PartitionedDataSet CreateResult(const viskores::cont::PartitionedDataSet &input, const viskores::cont::PartitionedDataSet &resultPartitions, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:538
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::filter::FieldSelection::IsFieldSelected
bool IsFieldSelected(const viskores::cont::Field &inputField) const
Returns true if the input field should be mapped to the output dataset.
Definition: FieldSelection.h:112
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
FieldSelection.h
viskores::filter::FieldSelection::HasField
bool HasField(const viskores::cont::Field &inputField) const
Returns true if the input field has been added to this selection.
Definition: FieldSelection.h:170
viskores::filter::Filter::MapFieldsOntoOutput
void MapFieldsOntoOutput(const viskores::cont::DataSet &input, const viskores::filter::FieldSelection &fieldSelection, viskores::cont::DataSet &output, FieldMapper &&fieldMapper) const
Definition: Filter.h:798
viskores::cont::PartitionedDataSet::GetPartitions
const std::vector< viskores::cont::DataSet > & GetPartitions() const
Get an STL vector of all DataSet objects stored in PartitionedDataSet.
viskores::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:617
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::filter::Filter::CreateResultFieldPoint
viskores::cont::DataSet CreateResultFieldPoint(const viskores::cont::DataSet &inDataSet, const std::string &resultFieldName, const viskores::cont::UnknownArrayHandle &resultFieldArray) const
Create the output data set for DoExecute
Definition: Filter.h:471
viskores::cont::DataSet::SetGhostCellFieldName
void SetGhostCellFieldName(const std::string &name)
Sets the name of the field to use for cell ghost levels.
viskores::filter::Filter::GetFieldsToPass
viskores::filter::FieldSelection & GetFieldsToPass()
Specify which fields get passed from input to output.
Definition: Filter.h:235
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::filter::FieldSelection::Mode
Mode
Definition: FieldSelection.h:42
viskores::filter::Filter::GetUseCoordinateSystemAsField
bool GetUseCoordinateSystemAsField(viskores::IdComponent index=0) const
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:337
viskores::filter::Filter::ScalarToVec
Definition: Filter.h:858
Field.h
VISKORES_ASSERT
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
viskores::cont::PartitionedDataSet
Comprises a set of viskores::cont::DataSet objects.
Definition: PartitionedDataSet.h:34
viskores::filter::Filter::CastAndCallVecField
void CastAndCallVecField(const viskores::cont::Field &field, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input vector field.
Definition: Filter.h:742
viskores::filter::Filter::SetFieldsToPass
void SetFieldsToPass(const std::string &fieldname, viskores::filter::FieldSelection::Mode mode)
Specify which fields get passed from input to output.
Definition: Filter.h:224
viskores::filter::Filter::CreateResult
viskores::cont::DataSet CreateResult(const viskores::cont::DataSet &inDataSet, const viskores::cont::UnknownCellSet &resultCellSet, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:567
viskores::filter::Filter::CreateResultCoordinateSystem
viskores::cont::DataSet CreateResultCoordinateSystem(const viskores::cont::DataSet &inDataSet, const viskores::cont::UnknownCellSet &resultCellSet, const viskores::cont::CoordinateSystem &resultCoordSystem, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:599
viskores::filter::Filter::CastAndCallVariableVecField
void CastAndCallVariableVecField(const viskores::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:762
TaskQueue.h
viskores::filter::Filter::SetUseCoordinateSystemAsField
void SetUseCoordinateSystemAsField(viskores::IdComponent index, bool val)
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:328
viskores::filter::Filter::CreateResultCoordinateSystem
viskores::cont::DataSet CreateResultCoordinateSystem(const viskores::cont::DataSet &inDataSet, const viskores::cont::UnknownCellSet &resultCellSet, const std::string &coordsName, const viskores::cont::UnknownArrayHandle &coordsData, FieldMapper &&fieldMapper) const
Create the output data set for DoExecute.
Definition: Filter.h:639
viskores::filter::Filter::GetRunMultiThreadedFilter
bool GetRunMultiThreadedFilter() const
Definition: Filter.h:375
viskores::filter::FieldSelection::Mode::All
@ All
viskores::filter::Filter::SetUseCoordinateSystemAsField
void SetUseCoordinateSystemAsField(bool val)
Specifies whether to use point coordinates as the input field.
Definition: Filter.h:322
viskores::filter::FieldSelection
A FieldSelection stores information about fields to map for input dataset to output when a filter is ...
Definition: FieldSelection.h:39
viskores::filter::Filter::Invoke
viskores::cont::Invoker Invoke
Definition: Filter.h:399
viskores::cont::DataSet::HasCellField
bool HasCellField(const std::string &name) const
Definition: DataSet.h:135
viskores::cont::PartitionedDataSet::GetNumberOfFields
viskores::IdComponent GetNumberOfFields() const
Methods to Add and Get fields on a PartitionedDataSet.
Definition: PartitionedDataSet.h:99
viskores::cont::UnknownCellSet
A CellSet of an unknown type.
Definition: UnknownCellSet.h:56
viskores::filter::Filter::SetThreadsPerGPU
void SetThreadsPerGPU(viskores::Id numThreads)
Definition: Filter.h:367
VISKORES_LOG_S
#define VISKORES_LOG_S(level,...)
Writes a message using stream syntax to the indicated log level.
Definition: Logging.h:216
viskores::filter::Filter::GetFieldFromDataSet
const viskores::cont::Field & GetFieldFromDataSet(const viskores::cont::DataSet &input) const
Retrieve an input field from a viskores::cont::DataSet object.
Definition: Filter.h:657
viskores::filter::Filter::CastAndCallVariableVecField
void CastAndCallVariableVecField(const viskores::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:788
PartitionedDataSet.h
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::filter::FieldSelection::AddField
void AddField(const viskores::cont::Field &inputField)
Definition: FieldSelection.h:124
viskores::TypeListFieldScalar
viskores::List< viskores::Float32, viskores::Float64 > TypeListFieldScalar
A list containing types used for scalar fields.
Definition: TypeList.h:55
viskores::filter::Filter::SetRunMultiThreadedFilter
void SetRunMultiThreadedFilter(bool val)
Definition: Filter.h:380
viskores::cont::UnknownArrayHandle::ExtractArrayFromComponents
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
viskores::cont::UnknownArrayHandle::IsBaseComponentType
bool IsBaseComponentType() const
Returns true if this array's ValueType has the provided base component type.
Definition: UnknownArrayHandle.h:561
viskores::filter::Filter::GetOutputFieldName
const std::string & GetOutputFieldName() const
Specifies the name of the output field generated.
Definition: Filter.h:257
viskores::filter::Filter::SetActiveCoordinateSystem
void SetActiveCoordinateSystem(viskores::IdComponent index, viskores::Id coord_idx)
Specifies the coordinate system index to make active to use when processing the input viskores::cont:...
Definition: Filter.h:306
viskores::filter::Filter::SetInvoker
void SetInvoker(viskores::cont::Invoker inv)
Specify the viskores::cont::Invoker to be used to execute worklets by this filter instance.
Definition: Filter.h:396
viskores::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:49
viskores::filter::Filter::GetThreadsPerCPU
viskores::Id GetThreadsPerCPU() const
Definition: Filter.h:372
viskores::cont::ArrayCopy
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:129
Logging.h
Logging utilities.
viskores::filter::Filter::SetActiveField
void SetActiveField(viskores::IdComponent index, const std::string &name, viskores::cont::Field::Association association=viskores::cont::Field::Association::Any)
Specifies a field to operate on.
Definition: Filter.h:271
viskores::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
viskores::filter::Filter::GetNumberOfActiveFields
viskores::IdComponent GetNumberOfActiveFields() const
Return the number of active fields currently set.
Definition: Filter.h:351
viskores::filter::Filter::ActiveCoordinateSystemIndices
std::vector< viskores::Id > ActiveCoordinateSystemIndices
Definition: Filter.h:880
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::cont::DataSet::HasGhostCellField
bool HasGhostCellField() const
viskores::cont::Field::Association::Points
@ Points
A field that applies to points.
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
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::filter::Filter::CastAndCallVecField
void CastAndCallVecField(const viskores::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input vector field.
Definition: Filter.h:731
viskores::filter::Filter::GetPassCoordinateSystems
bool GetPassCoordinateSystems() const
Specify whether to always pass coordinate systems.
Definition: Filter.h:249
DataSet.h
viskores::filter::Filter::GetActiveCoordinateSystemIndex
viskores::Id GetActiveCoordinateSystemIndex(viskores::IdComponent index=0) const
Specifies the coordinate system index to make active to use when processing the input viskores::cont:...
Definition: Filter.h:314
viskores::filter::Filter::CastAndCallScalarField
void CastAndCallScalarField(const viskores::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
Convenience method to get the array from a filter's input scalar field.
Definition: Filter.h:700
viskores::filter::Filter::ActiveFieldNames
std::vector< std::string > ActiveFieldNames
Definition: Filter.h:877
viskores::cont::DataSet::SetCellSet
void SetCellSet(const CellSetType &cellSet)
Definition: DataSet.h:415