Viskores  1.0
ANARIMapper.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 
19 #ifndef viskores_interop_anari_ANARIMapper_h
20 #define viskores_interop_anari_ANARIMapper_h
21 
22 // viskores
25 
26 #include <viskores/interop/anari/viskores_anari_export.h>
27 
28 namespace viskores
29 {
30 namespace interop
31 {
32 namespace anari
33 {
34 
35 inline void NoopANARIDeleter(const void*, const void*) {}
36 
45 struct VISKORES_ANARI_EXPORT ANARIMapper
46 {
48  anari_cpp::Device device,
49  const ANARIActor& actor = {},
50  const std::string& name = "<noname>",
52  virtual ~ANARIMapper() = default;
53 
54  anari_cpp::Device GetDevice() const;
55  const ANARIActor& GetActor() const;
56  const char* GetName() const;
57  const viskores::cont::ColorTable& GetColorTable() const;
58 
59  void SetName(const char* name);
60  void SetColorTable(const viskores::cont::ColorTable& colorTable);
61 
68  virtual void SetActor(const ANARIActor& actor);
69 
75  virtual void SetMapFieldAsAttribute(bool enabled);
76  bool GetMapFieldAsAttribute() const;
77 
82  virtual void SetANARIColorMap(anari_cpp::Array1D color,
83  anari_cpp::Array1D opacity,
84  bool releaseArrays = true);
85 
88  virtual void SetANARIColorMapValueRange(const viskores::Vec2f_32& valueRange);
89 
92  virtual void SetANARIColorMapOpacityScale(viskores::Float32 opacityScale);
93 
97  virtual anari_cpp::Geometry GetANARIGeometry();
98 
102  virtual anari_cpp::SpatialField GetANARISpatialField();
103 
107  virtual anari_cpp::Surface GetANARISurface();
108 
112  virtual anari_cpp::Volume GetANARIVolume();
113 
114  anari_cpp::Group GetANARIGroup();
115  anari_cpp::Instance GetANARIInstance();
116 
117  bool GroupIsEmpty() const;
118 
119 protected:
120  std::string MakeObjectName(const char* suffix) const;
121  void RefreshGroup();
122 
123  viskores::cont::ColorTable& GetColorTable();
124 
125  bool Valid{ false };
126  bool Current{ false };
127 
128 private:
130  {
131  anari_cpp::Device Device{ nullptr };
132  anari_cpp::Group Group{ nullptr };
133  anari_cpp::Instance Instance{ nullptr };
134  ~ANARIHandles();
135  };
136 
137  std::shared_ptr<ANARIHandles> Handles;
140  std::string Name;
141  bool MapFieldAsAttribute{ true };
142 };
143 
144 } // namespace anari
145 } // namespace interop
146 } // namespace viskores
147 
148 #endif
anari
Definition: ViskoresANARITypes.h:38
ANARIActor.h
viskores::interop::anari::ANARIMapper::Actor
ANARIActor Actor
Definition: ANARIMapper.h:138
viskores::cont::ColorTable::Preset::Default
@ Default
viskores::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:60
ColorTable.h
viskores::interop::anari::ANARIMapper::ANARIHandles
Definition: ANARIMapper.h:129
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:97
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::interop::anari::ANARIMapper::ColorTable
viskores::cont::ColorTable ColorTable
Definition: ANARIMapper.h:139
viskores::interop::anari::ANARIMapper
This is the base class used for all ANARI mappers.
Definition: ANARIMapper.h:45
viskores::interop::anari::ANARIMapper::Name
std::string Name
Definition: ANARIMapper.h:140
viskores::Vec< viskores::Float32, 2 >
viskores::interop::anari::NoopANARIDeleter
void NoopANARIDeleter(const void *, const void *)
Definition: ANARIMapper.h:35
viskores::interop::anari::ANARIMapper::Handles
std::shared_ptr< ANARIHandles > Handles
Definition: ANARIMapper.h:137