Skip to content

BUG: Partition Geometry reads unavailable coordinates during preflight #1798

Open

Description

@jmarquisbq

Problem

Partition Geometry reads unavailable vertex coordinates during whole-pipeline preflight. It throws EmptyDataStore::getValue() is not implemented, including when Bounding Box (2) supplies explicit bounds.

This path remains on develop 2eb6b878f6ff408d1454754d4c0e63edd676d7e0. Expected behavior is metadata validation without reading absent values. Invalid geometry should produce an actionable Result error.

Steps to Reproduce

  1. Start an empty pipeline. Use Create Geometry (Image) with dimensions [2,2,2], origin [0,0,0], and spacing [1,1,1].
  2. Append Extract Vertex Geometry. Select the generated image and disable Use Mask Array.
  3. Append Partition Geometry. Select the generated vertex geometry and its matching Input Geometry Cell Attribute Matrix.
  4. Set Select the partitioning mode to Bounding Box (2) and Number Of Cells Per Axis to [2,2,2].
  5. Set Minimum Grid Coordinate to [0,0,0] and Maximum Grid Coordinate to [2,2,2].
  6. Use Starting Feature ID 1, Out-Of-Bounds Feature ID 0, and disable Use Vertex Mask (Node Geometries Only).
  7. Preflight the whole pipeline. Alternatively, save it as partition-generated-vertices.d3dpipeline and run nxrunner --preflight partition-generated-vertices.d3dpipeline. Repeat separately with Basic (0).

Preflight should succeed before any vertex values exist. Execution should then assign the eight extracted cell centers to partitions 1 through 8.

Cause

generateNodeBasedPSInfo calls dimensionality validation before selecting the partition mode:

Result<> dimensionalityResult = DataCheckDimensionality(geometry);

DataCheckDimensionality calls all three plane checks, beginning with:

Result<bool> yzPlaneResult = geometry.isYZPlane();

INodeGeometry0D::isPlane reads every vertex through the store:

for(usize tuple = 0; tuple < vertexListStore.getNumberOfTuples(); tuple++)
{
  pointSet.insert(vertexListStore.getComponentValue(tuple, dimensionIndex));
}

The helper catches std::bad_cast, not the runtime error thrown by EmptyDataStore:

value_type getValue(usize index) const override
{
  throw std::runtime_error("EmptyDataStore::getValue() is not implemented");
}

Whole-pipeline preflight creates placeholder stores, so these coordinate reads have no values to access. The focused test confirms this exception during whole-pipeline preflight in both Basic and Bounding Box modes.

Bounding Box mode computes its bounds from explicit parameters, so those preliminary coordinate reads are unnecessary. Advanced and Existing Partition Grid also supply their partition definition. Basic mode additionally needs data-dependent bounds; it requires separate deferred calculation.

Verification Unit Test

Append this complete test to src/Plugins/SimplnxCore/test/PartitionGeometryTest.cpp. Build target: SimplnxCoreUnitTest.

The fixture creates all inputs through a pipeline. Preflight sees metadata-only extracted vertices. Execution creates real cell-center coordinates. Basic and Bounding Box are separate generated cases.

ctest -R "^SimplnxCore::PartitionGeometry: Generated vertices preflight regression 1798$" --output-on-failure --timeout 600
#include "SimplnxCore/Filters/CreateImageGeometryFilter.hpp"
#include "SimplnxCore/Filters/ExtractVertexGeometryFilter.hpp"
#include "SimplnxCore/Filters/PartitionGeometryFilter.hpp"
#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/Geometry/VertexGeom.hpp"
#include "simplnx/Parameters/ChoicesParameter.hpp"
#include "simplnx/Pipeline/Pipeline.hpp"
#include "simplnx/UnitTest/UnitTestCommon.hpp"
#include <atomic>
#include <catch2/catch.hpp>
#include <memory>
#include <vector>

using namespace nx::core;

TEST_CASE("SimplnxCore::PartitionGeometry: Generated vertices preflight regression 1798", "[SimplnxCore][PartitionGeometry][Issue1798]")
{
  UnitTest::LoadPlugins();
  const auto mode = GENERATE(ChoicesParameter::ValueType{0}, ChoicesParameter::ValueType{2});
  CAPTURE(mode);
  Pipeline pipeline;
  auto create = std::make_unique<CreateImageGeometryFilter>();
  auto createArgs = create->getDefaultArguments();
  createArgs.insertOrAssign(CreateImageGeometryFilter::k_GeometryDataPath_Key, std::make_any<DataPath>(DataPath({"Image"})));
  createArgs.insertOrAssign(CreateImageGeometryFilter::k_Dimensions_Key, std::make_any<std::vector<uint64>>(std::vector<uint64>{2, 2, 2}));
  createArgs.insertOrAssign(CreateImageGeometryFilter::k_Origin_Key, std::make_any<std::vector<float32>>(std::vector<float32>{0, 0, 0}));
  createArgs.insertOrAssign(CreateImageGeometryFilter::k_Spacing_Key, std::make_any<std::vector<float32>>(std::vector<float32>{1, 1, 1}));
  createArgs.insertOrAssign(CreateImageGeometryFilter::k_CellDataName_Key, std::make_any<std::string>("Cell Data"));
  REQUIRE(pipeline.push_back(std::move(create), createArgs));

  auto extract = std::make_unique<ExtractVertexGeometryFilter>();
  auto extractArgs = extract->getDefaultArguments();
  extractArgs.insertOrAssign(ExtractVertexGeometryFilter::k_InputGeometryPath_Key, std::make_any<DataPath>(DataPath({"Image"})));
  extractArgs.insertOrAssign(ExtractVertexGeometryFilter::k_UseMask_Key, std::make_any<bool>(false));
  extractArgs.insertOrAssign(ExtractVertexGeometryFilter::k_VertexGeometryPath_Key, std::make_any<DataPath>(DataPath({"Vertices"})));
  extractArgs.insertOrAssign(ExtractVertexGeometryFilter::k_VertexAttrMatrixName_Key, std::make_any<std::string>("Vertex Data"));
  extractArgs.insertOrAssign(ExtractVertexGeometryFilter::k_SharedVertexListName_Key, std::make_any<std::string>("Shared Vertex List"));
  REQUIRE(pipeline.push_back(std::move(extract), extractArgs));

  auto partition = std::make_unique<PartitionGeometryFilter>();
  auto args = partition->getDefaultArguments();
  args.insertOrAssign(PartitionGeometryFilter::k_InputGeometryToPartition_Key, std::make_any<DataPath>(DataPath({"Vertices"})));
  args.insertOrAssign(PartitionGeometryFilter::k_InputGeometryCellAttributeMatrixPath_Key, std::make_any<DataPath>(DataPath({"Vertices", "Vertex Data"})));
  args.insertOrAssign(PartitionGeometryFilter::k_PartitioningMode_Key, std::make_any<ChoicesParameter::ValueType>(mode));
  args.insertOrAssign(PartitionGeometryFilter::k_NumberOfCellsPerAxis_Key, std::make_any<std::vector<int32>>(std::vector<int32>{2, 2, 2}));
  args.insertOrAssign(PartitionGeometryFilter::k_MinGridCoord_Key, std::make_any<std::vector<float32>>(std::vector<float32>{0, 0, 0}));
  args.insertOrAssign(PartitionGeometryFilter::k_MaxGridCoord_Key, std::make_any<std::vector<float32>>(std::vector<float32>{2, 2, 2}));
  args.insertOrAssign(PartitionGeometryFilter::k_StartingFeatureID_Key, std::make_any<int32>(1));
  args.insertOrAssign(PartitionGeometryFilter::k_OutOfBoundsFeatureID_Key, std::make_any<int32>(0));
  args.insertOrAssign(PartitionGeometryFilter::k_UseVertexMask_Key, std::make_any<bool>(false));
  args.insertOrAssign(PartitionGeometryFilter::k_PartitionIdsArrayName_Key, std::make_any<std::string>("Ids"));
  args.insertOrAssign(PartitionGeometryFilter::k_FeatureAttrMatrixName_Key, std::make_any<std::string>("Partitions"));
  args.insertOrAssign(PartitionGeometryFilter::k_PartitionGridGeometry_Key, std::make_any<DataPath>(DataPath({"Partition Grid"})));
  REQUIRE(pipeline.push_back(std::move(partition), args));

  std::atomic_bool cancel = false;
  DataStructure preview;
  bool preflighted = false;
  REQUIRE_NOTHROW(preflighted = pipeline.preflight(preview, cancel));
  REQUIRE(preflighted);
  DataStructure executed;
  bool completed = false;
  REQUIRE_NOTHROW(completed = pipeline.execute(executed, cancel));
  REQUIRE(completed);
  const auto& geometry = executed.getDataRefAs<VertexGeom>(DataPath({"Vertices"}));
  REQUIRE(geometry.getNumberOfVertices() == 8);
  const auto& ids = executed.getDataRefAs<Int32Array>(DataPath({"Vertices", "Vertex Data", "Ids"}));
  REQUIRE(ids.getNumberOfTuples() == 8);
  for(usize i = 0; i < 8; ++i)
  {
    CHECK(ids[i] == static_cast<int32>(i + 1));
  }
  UnitTest::CheckArraysInheritTupleDims(executed);
}

The test was built and run on the pinned commit. Both modes fail during preflight; the subsequent execution assertions are not reached.

src/Plugins/SimplnxCore/test/PartitionGeometryTest.cpp:830: FAILED:
  REQUIRE_NOTHROW( preflighted = pipeline.preflight(preview, cancel) )
due to unexpected exception with messages:
  mode := 0
  EmptyDataStore::getValue() is not implemented

src/Plugins/SimplnxCore/test/PartitionGeometryTest.cpp:830: FAILED:
  REQUIRE_NOTHROW( preflighted = pipeline.preflight(preview, cancel) )
due to unexpected exception with messages:
  mode := 2
  EmptyDataStore::getValue() is not implemented

test cases: 1 | 1 failed
assertions: 9 | 7 passed | 2 failed

Proposed Fix

Change PartitionGeometryFilter.cpp so node preflight does not read unavailable values. Review generateNodeBasedPSInfo, DataCheckDimensionality, and GeneratePartitioningSchemeInfo together.

Keep tuple-count, type, and explicit-bound validation in preflight. Construct explicit Advanced, Bounding Box, and Existing Partition Grid schemes without coordinate-dependent checks.

Defer coordinate-dependent validation and Basic bounds calculation until execution. Ensure execution updates the partition geometry consistently once values exist. Return contextual Result errors for invalid inputs.

Keep full-pipeline preflight and execution coverage. A test that only preflights a populated DataStructure does not reproduce this lifecycle.

Notes

  • The original native Windows Release example uses 170 cell-center points from SmallIN100 grain 2205. It runs Extract Vertex Geometry, then Create Geometry with explicit Micrometer units.
  • Its bounds are [24,25,14] to [26.5,28,17], with counts [5,6,6]. The report states these enclose the points. It records nxrunner --preflight exiting with the exception rather than a structured diagnostic.
  • The same example reportedly preflights when this filter is disabled. Source Image Geometry partitioning succeeds with explicit bounds and supplies the interim workaround.
  • The reported source snapshot is fe6c4a15e5a5bffef2523f52cec01be33b1e62a9, with filter blob d5d338ba272493b139cf594f19a288f0aba34953. Native evidence comes from example branch commit b00d777683e69c3de76dbf961f1ca9775ddb070d. It is not a fresh upstream build result.
  • These historical runtime details are retained from the issue. The new inline fixture avoids that dataset and does not claim to repeat its runtime evidence.
  • The original report notes that preflight displays the node geometry's space as unknown. That reinforces the need to separate metadata from values.
  • Michael Jackson links PR #1771 as the same type of bug. He proposes a sweep of filters that accept Rectilinear Grids. That broader audit remains a related follow-up, not proof that every such filter fails.
  • No library fix accompanies the example branch. The example uses source-image partitioning in the meantime.

Activity

  1. imikejackson commented on Oct 14, 2026

    @imikejackson
    Contributor

    @jmarquisbq This is the same bug from #1771

    This might be a systemic programming issue and we should do a sweep of all filters that take RectilinearGrids as inputs.

  2. changed the title [-]PartitionGeometry reads unavailable node coordinates during preflight[/-] [+]BUG: Partition Geometry reads unavailable coordinates during preflight[/+] on Oct 21, 2026
  3. joeykleingers commented on Nov 19, 2026

    @joeykleingers
    Contributor

    Two more details for this issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions