add default empty ghost field for compatibility

This commit is contained in:
Roxana Bujack 2023-11-07 10:29:16 -07:00
parent bc83184e70
commit f8c9af4f11
4 changed files with 21 additions and 14 deletions

@ -644,7 +644,7 @@ public:
void Run(const vtkm::cont::UnknownCellSet& cellset,
vtkm::cont::ArrayHandle<vtkm::Id4>& outputIndices,
vtkm::Id& outputTriangles,
const vtkm::cont::Field& ghostField)
const vtkm::cont::Field& ghostField = vtkm::cont::Field())
{
bool fastPath = false;
if (cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
@ -704,21 +704,24 @@ public:
}
// removed blanked triangles
vtkm::cont::ArrayHandle<vtkm::Id4> nonGhostTriangles;
nonGhostTriangles.Allocate(outputTriangles);
vtkm::Id counter = 0;
for (vtkm::Id i = 0; i < outputTriangles; ++i)
if (ghostField.GetNumberOfValues() > 0)
{
if (int(ghostField.GetData().ExtractComponent<vtkm::UInt8>(0).ReadPortal().Get(
outputIndices.ReadPortal().Get(i)[0])) == 0)
vtkm::cont::ArrayHandle<vtkm::Id4> nonGhostTriangles;
nonGhostTriangles.Allocate(outputTriangles);
vtkm::Id counter = 0;
for (vtkm::Id i = 0; i < outputTriangles; ++i)
{
nonGhostTriangles.WritePortal().Set(counter, outputIndices.ReadPortal().Get(i));
counter++;
if (int(ghostField.GetData().ExtractComponent<vtkm::UInt8>(0).ReadPortal().Get(
outputIndices.ReadPortal().Get(i)[0])) == 0)
{
nonGhostTriangles.WritePortal().Set(counter, outputIndices.ReadPortal().Get(i));
counter++;
}
}
nonGhostTriangles.Allocate(counter, vtkm::CopyFlag::On);
outputIndices = nonGhostTriangles;
outputTriangles = counter;
}
nonGhostTriangles.Allocate(counter, vtkm::CopyFlag::On);
outputIndices = nonGhostTriangles;
outputTriangles = counter;
//get rid of any triagles we cannot see
if (!fastPath)

@ -13,6 +13,7 @@
#include <vtkm/rendering/vtkm_rendering_export.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/Field.h>
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/UnknownCellSet.h>
@ -32,7 +33,7 @@ VTKM_RENDERING_EXPORT
void RunTriangulator(const vtkm::cont::UnknownCellSet& cellSet,
vtkm::cont::ArrayHandle<vtkm::Id4>& indices,
vtkm::Id& numberOfTriangles,
const vtkm::cont::Field& ghostField);
const vtkm::cont::Field& ghostField = vtkm::cont::Field());
}
}
} // namespace vtkm::rendering::internal

@ -8,6 +8,7 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/Field.h>
#include <vtkm/rendering/internal/RunTriangulator.h>
#include <vtkm/rendering/raytracing/TriangleExtractor.h>

@ -11,6 +11,7 @@
#define vtk_m_rendering_raytracing_Triangle_Extractor_h
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/Field.h>
#include <vtkm/rendering/vtkm_rendering_export.h>
namespace vtkm
@ -25,7 +26,8 @@ class VTKM_RENDERING_EXPORT TriangleExtractor
protected:
vtkm::cont::ArrayHandle<vtkm::Id4> Triangles; // (cellid, v0, v1, v2)
public:
void ExtractCells(const vtkm::cont::UnknownCellSet& cells, const vtkm::cont::Field& ghostField);
void ExtractCells(const vtkm::cont::UnknownCellSet& cells,
const vtkm::cont::Field& ghostField = vtkm::cont::Field());
vtkm::cont::ArrayHandle<vtkm::Id4> GetTriangles();
vtkm::Id GetNumberOfTriangles() const;