VTK-m  2.2
ANARIActor.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 
11 #ifndef vtk_m_interop_anari_ANARIActor_h
12 #define vtk_m_interop_anari_ANARIActor_h
13 
14 // vtk-m
16 #include <vtkm/cont/DataSet.h>
17 #include <vtkm/cont/Field.h>
20 // std
21 #include <array>
22 #include <memory>
23 
24 #include <vtkm/interop/anari/vtkm_anari_export.h>
25 
26 namespace vtkm
27 {
28 namespace interop
29 {
30 namespace anari
31 {
32 
35 using FieldSet = std::array<vtkm::cont::Field, 4>;
36 
40 
52 struct VTKM_ANARI_EXPORT ANARIActor
53 {
54  ANARIActor() = default;
55 
59  const vtkm::cont::CoordinateSystem& coordinates,
60  const vtkm::cont::Field& field0 = {},
61  const vtkm::cont::Field& field1 = {},
62  const vtkm::cont::Field& field2 = {},
63  const vtkm::cont::Field& field3 = {});
64 
68  const vtkm::cont::CoordinateSystem& coordinates,
69  const FieldSet& fieldset);
70 
73  ANARIActor(const vtkm::cont::DataSet& dataset,
74  const std::string& field0 = "",
75  const std::string& field1 = "",
76  const std::string& field2 = "",
77  const std::string& field3 = "");
78 
79  const vtkm::cont::UnknownCellSet& GetCellSet() const;
80  const vtkm::cont::CoordinateSystem& GetCoordinateSystem() const;
81  const vtkm::cont::Field& GetField(vtkm::IdComponent idx = -1) const;
82 
83  FieldSet GetFieldSet() const;
84 
85  void SetPrimaryFieldIndex(vtkm::IdComponent idx);
86  vtkm::IdComponent GetPrimaryFieldIndex() const;
87 
90  vtkm::cont::DataSet MakeDataSet(bool includeFields = false) const;
91 
92 private:
93  struct ActorData
94  {
98  vtkm::IdComponent PrimaryField{ 0 };
99  };
100 
101  std::shared_ptr<ActorData> Data = std::make_shared<ActorData>();
102 };
103 
104 } // namespace anari
105 } // namespace interop
106 } // namespace vtkm
107 
108 #endif
anari
Definition: VtkmANARITypes.h:30
VtkmANARITypes.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
UnknownCellSet.h
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::interop::anari::AnariMaterialInputString
const char * AnariMaterialInputString(vtkm::IdComponent p)
Returns the appropriate ANARI attribute string based on field index.
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm::cont::UnknownCellSet
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
vtkm::interop::anari::ANARIActor::ActorData::Fields
FieldSet Fields
Definition: ANARIActor.h:97
CoordinateSystem.h
vtkm::cont::CoordinateSystem
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:30
vtkm::interop::anari::ANARIActor::ActorData::Coordinates
vtkm::cont::CoordinateSystem Coordinates
Definition: ANARIActor.h:96
vtkm::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:52
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::interop::anari::FieldSet
std::array< vtkm::cont::Field, 4 > FieldSet
Convenience type used to represent all the fields in an ANARIActor.
Definition: ANARIActor.h:35
vtkm::interop::anari::ANARIActor::ActorData::Cells
vtkm::cont::UnknownCellSet Cells
Definition: ANARIActor.h:95
Field.h
vtkm::interop::anari::ANARIActor::ActorData
Definition: ANARIActor.h:93
DataSet.h