support more volume types via array element conversion + ensure scalar data
This commit is contained in:
parent
92e7425b8d
commit
2de1a462a0
@ -8,6 +8,7 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <vtkm/cont/ArrayCopy.h>
|
||||||
#include <vtkm/interop/anari/ANARIMapperVolume.h>
|
#include <vtkm/interop/anari/ANARIMapperVolume.h>
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
@ -130,11 +131,11 @@ void ANARIMapperVolume::ConstructArrays(bool regenerate)
|
|||||||
const auto& fieldArray = actor.GetField().GetData();
|
const auto& fieldArray = actor.GetField().GetData();
|
||||||
|
|
||||||
const bool isStructured = cells.CanConvert<vtkm::cont::CellSetStructured<3>>();
|
const bool isStructured = cells.CanConvert<vtkm::cont::CellSetStructured<3>>();
|
||||||
const bool isFloat = fieldArray.CanConvert<vtkm::cont::ArrayHandle<vtkm::Float32>>();
|
const bool isScalar = fieldArray.GetNumberOfComponentsFlat() == 1;
|
||||||
|
|
||||||
this->Handles->ReleaseArrays();
|
this->Handles->ReleaseArrays();
|
||||||
|
|
||||||
if (isStructured && isFloat)
|
if (isStructured && isScalar)
|
||||||
{
|
{
|
||||||
auto structuredCells = cells.AsCellSet<vtkm::cont::CellSetStructured<3>>();
|
auto structuredCells = cells.AsCellSet<vtkm::cont::CellSetStructured<3>>();
|
||||||
auto pdims = structuredCells.GetPointDimensions();
|
auto pdims = structuredCells.GetPointDimensions();
|
||||||
@ -143,8 +144,7 @@ void ANARIMapperVolume::ConstructArrays(bool regenerate)
|
|||||||
|
|
||||||
auto d = this->GetDevice();
|
auto d = this->GetDevice();
|
||||||
|
|
||||||
arrays.Data = fieldArray.AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::Float32>>();
|
vtkm::cont::ArrayCopyShallowIfPossible(fieldArray, arrays.Data);
|
||||||
|
|
||||||
auto* ptr = (float*)arrays.Data.GetBuffers()[0].ReadPointerHost(*arrays.Token);
|
auto* ptr = (float*)arrays.Data.GetBuffers()[0].ReadPointerHost(*arrays.Token);
|
||||||
|
|
||||||
auto bounds = coords.GetBounds();
|
auto bounds = coords.GetBounds();
|
||||||
|
Loading…
Reference in New Issue
Block a user