Viskores  1.0
ANARIMapperVolume.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_ANARIMapperVolume_h
20 #define viskores_interop_anari_ANARIMapperVolume_h
21 
23 
24 namespace viskores
25 {
26 namespace interop
27 {
28 namespace anari
29 {
30 
34 {
35  anari_cpp::Array3D Data{ nullptr };
36  int Dims[3];
37  float Origin[3];
38  float Spacing[3];
39 };
40 
42 {
43  anari_cpp::Array1D VertexPosition{ nullptr };
44  anari_cpp::Array1D VertexData{ nullptr };
45  anari_cpp::Array1D Index{ nullptr };
46  anari_cpp::Array1D CellIndex{ nullptr };
47  anari_cpp::Array1D CellData{ nullptr };
48  anari_cpp::Array1D CellType{ nullptr };
49  bool IndexPrefixed{ false };
50 };
51 
55 {
57  std::shared_ptr<viskores::cont::Token> Token{ new viskores::cont::Token };
58 };
59 
61 {
68  std::shared_ptr<viskores::cont::Token> Token{ new viskores::cont::Token };
69 };
70 
75 struct VISKORES_ANARI_EXPORT ANARIMapperVolume : public ANARIMapper
76 {
80  anari_cpp::Device device,
81  const ANARIActor& actor = {},
82  const std::string& name = "<volume>",
84 
87  ~ANARIMapperVolume() override;
88 
92  void SetActor(const ANARIActor& actor) override;
93 
97  void SetANARIColorMap(anari_cpp::Array1D color,
98  anari_cpp::Array1D opacity,
99  bool releaseArrays = true) override;
102  void SetANARIColorMapValueRange(const viskores::Vec2f_32& valueRange) override;
103 
106  void SetANARIColorMapOpacityScale(viskores::Float32 opacityScale) override;
107 
108  anari_cpp::SpatialField GetANARISpatialField() override;
109  anari_cpp::Volume GetANARIVolume() override;
110 
111 private:
115  void ConstructArrays(bool regenerate = false);
117  void UpdateSpatialField();
118 
121  {
122  anari_cpp::Device Device{ nullptr };
123  anari_cpp::SpatialField SpatialField{ nullptr };
124  anari_cpp::Volume Volume{ nullptr };
127  ~ANARIHandles();
128  void ReleaseArrays();
129  };
130 
131  std::shared_ptr<ANARIHandles> Handles;
134 };
135 
136 } // namespace anari
137 } // namespace interop
138 } // namespace viskores
139 
140 #endif
viskores::interop::anari::UnstructuredVolumeParameters::Index
anari_cpp::Array1D Index
Definition: ANARIMapperVolume.h:45
anari
Definition: ViskoresANARITypes.h:38
ANARIMapper.h
viskores::interop::anari::UnstructuredVolumeParameters::CellIndex
anari_cpp::Array1D CellIndex
Definition: ANARIMapperVolume.h:46
viskores::interop::anari::ANARIMapperVolume::StructuredArrays
StructuredVolumeArrays StructuredArrays
Definition: ANARIMapperVolume.h:132
viskores::interop::anari::ANARIMapperVolume
Mapper which turns structured volumes into a single ANARI transferFunction1D volume.
Definition: ANARIMapperVolume.h:75
viskores::interop::anari::ANARIMapperVolume::Handles
std::shared_ptr< ANARIHandles > Handles
Definition: ANARIMapperVolume.h:131
viskores::interop::anari::ANARIMapperVolume::ANARIHandles::StructuredParameters
StructuredVolumeParameters StructuredParameters
Definition: ANARIMapperVolume.h:125
viskores::interop::anari::UnstructuredVolumeParameters::CellType
anari_cpp::Array1D CellType
Definition: ANARIMapperVolume.h:48
viskores::interop::anari::ANARIMapperVolume::UnstructuredArrays
UntructuredVolumeArrays UnstructuredArrays
Definition: ANARIMapperVolume.h:133
viskores::interop::anari::UntructuredVolumeArrays::Index
viskores::cont::ArrayHandle< viskores::UInt64 > Index
Definition: ANARIMapperVolume.h:64
viskores::interop::anari::StructuredVolumeArrays
Viskores data arrays underlying the ANARIArray handles created by the mapper.
Definition: ANARIMapperVolume.h:54
viskores::cont::ColorTable::Preset::Default
@ Default
viskores::cont::ArrayHandle< viskores::Float32 >
viskores::interop::anari::UntructuredVolumeArrays::VertexData
viskores::cont::ArrayHandle< viskores::Float32 > VertexData
Definition: ANARIMapperVolume.h:63
viskores::interop::anari::UntructuredVolumeArrays::CellData
viskores::cont::ArrayHandle< viskores::Float32 > CellData
Definition: ANARIMapperVolume.h:66
viskores::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:60
viskores::interop::anari::UnstructuredVolumeParameters
Definition: ANARIMapperVolume.h:41
viskores::interop::anari::UnstructuredVolumeParameters::CellData
anari_cpp::Array1D CellData
Definition: ANARIMapperVolume.h:47
viskores::interop::anari::UntructuredVolumeArrays::CellType
viskores::cont::ArrayHandle< viskores::UInt8 > CellType
Definition: ANARIMapperVolume.h:67
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::interop::anari::ANARIMapperVolume::ANARIHandles::UnstructuredParameters
UnstructuredVolumeParameters UnstructuredParameters
Definition: ANARIMapperVolume.h:126
viskores::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:97
viskores::interop::anari::StructuredVolumeParameters::Dims
int Dims[3]
Definition: ANARIMapperVolume.h:36
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::interop::anari::UntructuredVolumeArrays::Token
std::shared_ptr< viskores::cont::Token > Token
Definition: ANARIMapperVolume.h:68
viskores::interop::anari::UnstructuredVolumeParameters::IndexPrefixed
bool IndexPrefixed
Definition: ANARIMapperVolume.h:49
viskores::interop::anari::ANARIMapperVolume::ANARIHandles
Container of all relevant ANARI scene object handles.
Definition: ANARIMapperVolume.h:120
viskores::interop::anari::UntructuredVolumeArrays::VertexPosition
viskores::cont::ArrayHandle< viskores::Vec3f_32 > VertexPosition
Definition: ANARIMapperVolume.h:62
viskores::interop::anari::StructuredVolumeArrays::Token
std::shared_ptr< viskores::cont::Token > Token
Definition: ANARIMapperVolume.h:57
viskores::interop::anari::UnstructuredVolumeParameters::VertexData
anari_cpp::Array1D VertexData
Definition: ANARIMapperVolume.h:44
viskores::interop::anari::ANARIMapper
This is the base class used for all ANARI mappers.
Definition: ANARIMapper.h:45
viskores::interop::anari::UnstructuredVolumeParameters::VertexPosition
anari_cpp::Array1D VertexPosition
Definition: ANARIMapperVolume.h:43
viskores::interop::anari::StructuredVolumeParameters::Spacing
float Spacing[3]
Definition: ANARIMapperVolume.h:38
viskores::interop::anari::UntructuredVolumeArrays
Definition: ANARIMapperVolume.h:60
viskores::interop::anari::StructuredVolumeParameters::Origin
float Origin[3]
Definition: ANARIMapperVolume.h:37
viskores::interop::anari::StructuredVolumeParameters::Data
anari_cpp::Array3D Data
Definition: ANARIMapperVolume.h:35
viskores::interop::anari::StructuredVolumeArrays::Data
viskores::cont::ArrayHandle< viskores::Float32 > Data
Definition: ANARIMapperVolume.h:56
viskores::interop::anari::StructuredVolumeParameters
Raw ANARI arrays and parameter values set on the ANARISpatialField.
Definition: ANARIMapperVolume.h:33
viskores::Vec< viskores::Float32, 2 >
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::interop::anari::UntructuredVolumeArrays::CellIndex
viskores::cont::ArrayHandle< viskores::UInt64 > CellIndex
Definition: ANARIMapperVolume.h:65