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

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

@ -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/Field.h>
#include <vtkm/rendering/internal/RunTriangulator.h> #include <vtkm/rendering/internal/RunTriangulator.h>
#include <vtkm/rendering/raytracing/TriangleExtractor.h> #include <vtkm/rendering/raytracing/TriangleExtractor.h>

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