Viskores  1.0
ANARIMapperPoints.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_ANARIMapperPoints_h
20 #define viskores_interop_anari_ANARIMapperPoints_h
21 
24 
25 namespace viskores
26 {
27 namespace interop
28 {
29 namespace anari
30 {
31 
35 {
36  struct VertexData
37  {
38  anari_cpp::Array1D Position{ nullptr };
39  anari_cpp::Array1D Radius{ nullptr };
40  std::array<anari_cpp::Array1D, 4> Attribute;
41  std::array<std::string, 4> AttributeName;
42  } Vertex{};
43 
44  unsigned int NumPrimitives{ 0 };
45 };
46 
50 {
53  std::shared_ptr<viskores::cont::Token> Token{ new viskores::cont::Token };
54 };
55 
59 {
62  std::string Field1Name;
65  std::string Field2Name;
68  std::string Field3Name;
71  std::string Field4Name;
72  std::shared_ptr<viskores::cont::Token> Token{ new viskores::cont::Token };
73 };
74 
79 struct VISKORES_ANARI_EXPORT ANARIMapperPoints : public ANARIMapper
80 {
84  anari_cpp::Device device,
85  const ANARIActor& actor = {},
86  const std::string& name = "<points>",
88 
91  ~ANARIMapperPoints() override;
92 
96  void SetActor(const ANARIActor& actor) override;
97 
101  void SetMapFieldAsAttribute(bool enabled) override;
102 
106  void SetANARIColorMap(anari_cpp::Array1D color,
107  anari_cpp::Array1D opacity,
108  bool releaseArrays = true) override;
109 
112  void SetANARIColorMapValueRange(const viskores::Vec2f_32& valueRange) override;
113 
114  anari_cpp::Geometry GetANARIGeometry() override;
115  anari_cpp::Surface GetANARISurface() override;
116 
117 private:
121  void ConstructArrays(bool regenerate = false);
123  void UpdateGeometry();
125  void UpdateMaterial();
126 
129  {
130  anari_cpp::Device Device{ nullptr };
131  anari_cpp::Geometry Geometry{ nullptr };
132  anari_cpp::Sampler Sampler{ nullptr };
133  anari_cpp::Material Material{ nullptr };
134  anari_cpp::Surface Surface{ nullptr };
136  ~ANARIHandles();
137  void ReleaseArrays();
138  };
139 
140  std::shared_ptr<ANARIHandles> Handles;
141  viskores::IdComponent PrimaryField{ 0 };
144 };
145 
146 } // namespace anari
147 } // namespace interop
148 } // namespace viskores
149 
150 #endif
viskores::interop::anari::PointsFieldArrays::Field3
viskores::cont::ArrayHandleRuntimeVec< viskores::Float32 > Field3
Definition: ANARIMapperPoints.h:66
viskores::interop::anari::PointsParameters::Vertex
struct viskores::interop::anari::PointsParameters::VertexData Vertex
anari
Definition: ViskoresANARITypes.h:38
viskores::interop::anari::PointsFieldArrays::NumberOfField1Components
int NumberOfField1Components
Definition: ANARIMapperPoints.h:61
ANARIMapper.h
viskores::interop::anari::PointsParameters::VertexData::Position
anari_cpp::Array1D Position
Definition: ANARIMapperPoints.h:38
viskores::interop::anari::PointsParameters::NumPrimitives
unsigned int NumPrimitives
Definition: ANARIMapperPoints.h:44
viskores::interop::anari::PointsFieldArrays::Token
std::shared_ptr< viskores::cont::Token > Token
Definition: ANARIMapperPoints.h:72
viskores::interop::anari::PointsFieldArrays
Viskores data arrays underlying the ANARIArray handles created by the mapper for field attributes.
Definition: ANARIMapperPoints.h:58
viskores::cont::ArrayHandleRuntimeVec< viskores::Float32 >
viskores::interop::anari::PointsParameters
Raw ANARI arrays and parameter values set on the ANARIGeometry.
Definition: ANARIMapperPoints.h:34
viskores::cont::ColorTable::Preset::Default
@ Default
viskores::interop::anari::PointsFieldArrays::NumberOfField3Components
int NumberOfField3Components
Definition: ANARIMapperPoints.h:67
viskores::interop::anari::PointsFieldArrays::Field2
viskores::cont::ArrayHandleRuntimeVec< viskores::Float32 > Field2
Definition: ANARIMapperPoints.h:63
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::interop::anari::PointsFieldArrays::Field4Name
std::string Field4Name
Definition: ANARIMapperPoints.h:71
viskores::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:60
viskores::interop::anari::PointsFieldArrays::Field3Name
std::string Field3Name
Definition: ANARIMapperPoints.h:68
viskores::interop::anari::PointsParameters::VertexData
Definition: ANARIMapperPoints.h:36
viskores::interop::anari::PointsParameters::VertexData::Attribute
std::array< anari_cpp::Array1D, 4 > Attribute
Definition: ANARIMapperPoints.h:40
viskores::interop::anari::PointsFieldArrays::Field1Name
std::string Field1Name
Definition: ANARIMapperPoints.h:62
viskores::interop::anari::PointsParameters::VertexData::Radius
anari_cpp::Array1D Radius
Definition: ANARIMapperPoints.h:39
viskores::interop::anari::PointsFieldArrays::NumberOfField2Components
int NumberOfField2Components
Definition: ANARIMapperPoints.h:64
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::interop::anari::PointsFieldArrays::NumberOfField4Components
int NumberOfField4Components
Definition: ANARIMapperPoints.h:70
viskores::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:97
viskores::interop::anari::PointsArrays::Token
std::shared_ptr< viskores::cont::Token > Token
Definition: ANARIMapperPoints.h:53
viskores::interop::anari::ANARIMapperPoints::ANARIHandles
Container of all relevant ANARI scene object handles.
Definition: ANARIMapperPoints.h:128
viskores::interop::anari::PointsArrays::Radii
viskores::cont::ArrayHandle< viskores::Float32 > Radii
Definition: ANARIMapperPoints.h:52
viskores::interop::anari::PointsArrays
Viskores data arrays underlying the ANARIArray handles created by the mapper.
Definition: ANARIMapperPoints.h:49
viskores::interop::anari::ANARIMapperPoints::FieldArrays
PointsFieldArrays FieldArrays
Definition: ANARIMapperPoints.h:143
viskores::interop::anari::PointsParameters::VertexData::AttributeName
std::array< std::string, 4 > AttributeName
Definition: ANARIMapperPoints.h:41
viskores::interop::anari::PointsFieldArrays::Field2Name
std::string Field2Name
Definition: ANARIMapperPoints.h:65
viskores::interop::anari::ANARIMapper
This is the base class used for all ANARI mappers.
Definition: ANARIMapper.h:45
ArrayHandleRuntimeVec.h
viskores::interop::anari::PointsArrays::Vertices
viskores::cont::ArrayHandle< viskores::Vec3f_32 > Vertices
Definition: ANARIMapperPoints.h:51
viskores::interop::anari::PointsFieldArrays::Field1
viskores::cont::ArrayHandleRuntimeVec< viskores::Float32 > Field1
Definition: ANARIMapperPoints.h:60
viskores::interop::anari::ANARIMapperPoints::ANARIHandles::Parameters
PointsParameters Parameters
Definition: ANARIMapperPoints.h:135
viskores::interop::anari::PointsFieldArrays::Field4
viskores::cont::ArrayHandleRuntimeVec< viskores::Float32 > Field4
Definition: ANARIMapperPoints.h:69
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::ANARIMapperPoints
Mapper which turns each point into ANARI sphere geometry.
Definition: ANARIMapperPoints.h:79
viskores::interop::anari::ANARIMapperPoints::Handles
std::shared_ptr< ANARIHandles > Handles
Definition: ANARIMapperPoints.h:140
viskores::interop::anari::ANARIMapperPoints::Arrays
PointsArrays Arrays
Definition: ANARIMapperPoints.h:142