diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.cpp index 18c901b565..61fff67350 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.cpp @@ -74,7 +74,7 @@ Result<> SliceTriangleGeometry::operator()() float zStart = m_InputValues->Zstart; float zEnd = m_InputValues->Zend; - if(m_InputValues->SliceRange == 0) + if(m_InputValues->SliceRange == slice_triangle_geometry::constants::k_FullRange) { auto boundingBox = triangle.getBoundingBox(); zStart = boundingBox.getMinPoint()[2]; diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.hpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.hpp index 7896d8f020..46e27cbce7 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.hpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SliceTriangleGeometry.hpp @@ -14,6 +14,12 @@ namespace nx::core { +namespace slice_triangle_geometry::constants +{ + constexpr ChoicesParameter::ValueType k_FullRange = 0; + constexpr ChoicesParameter::ValueType k_UserDefinedRange = 1; +} + struct SIMPLNXCORE_EXPORT SliceTriangleGeometryInputValues { // VectorFloat32Parameter::ValueType SliceDirection; diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RegularGridSampleSurfaceMeshFilter.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RegularGridSampleSurfaceMeshFilter.cpp index 6e215c2e3d..2e4a4bdb0f 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RegularGridSampleSurfaceMeshFilter.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RegularGridSampleSurfaceMeshFilter.cpp @@ -7,6 +7,7 @@ #include "simplnx/Filter/Actions/CreateAttributeMatrixAction.hpp" #include "simplnx/Filter/Actions/CreateGeometry1DAction.hpp" #include "simplnx/Filter/Actions/CreateImageGeometryAction.hpp" +#include "simplnx/Filter/Actions/DeleteDataAction.hpp" #include "simplnx/Parameters/ArraySelectionParameter.hpp" #include "simplnx/Parameters/BoolParameter.hpp" #include "simplnx/Parameters/ChoicesParameter.hpp" @@ -143,17 +144,17 @@ IFilter::PreflightResult RegularGridSampleSurfaceMeshFilter::preflightImpl(const float32 vol = (pDimensionsValue[0] * pSpacingValue[0]) * (pDimensionsValue[1] * pSpacingValue[1]) * (pDimensionsValue[2] * pSpacingValue[2]); - boxDimensions << "Volume: " << std::setprecision(8) << std::noshowpoint << vol << " " << lengthUnit << "s ^3" - << "\n"; + boxDimensions << "Volume: " << std::setprecision(8) << std::noshowpoint << vol << " " << lengthUnit << "s ^3" << "\n"; preflightUpdatedValues.push_back({"BoxDimensions", boxDimensions.str()}); + ///////////////////////////////////////////////////////////////////////////// // CREATE THE EDGE GEOMETRY THAT WILL BE USED FOR THE POLYGONS + // This Geometry will be deleted after the filter is completed { DataPath pSliceDataContainerNameValue({fmt::format(".{}_sliced", triangleGeometryPath.getTargetName())}); std::string pEdgeAttributeMatrixNameValue("EdgeAttributeMatrix"); std::string pSliceIdArrayNameValue("SliceIds"); - // bool pHaveRegionIdsValue = false; DataPath pRegionIdArrayPathValue({"NOT USED"}); std::string pSliceAttributeMatrixNameValue("SliceAttributeMatrix"); // create the edge geometry @@ -171,19 +172,16 @@ IFilter::PreflightResult RegularGridSampleSurfaceMeshFilter::preflightImpl(const resultOutputActions.value().appendAction(std::move(createArray)); } - // if(pHaveRegionIdsValue) - // { - // DataPath path = pSliceDataContainerNameValue.createChildPath(pEdgeAttributeMatrixNameValue).createChildPath(pRegionIdArrayPathValue.getTargetName()); - // auto createArray = std::make_unique(DataType::int32, tDims, compDims, path); - // resultOutputActions.value().appendAction(std::move(createArray)); - // } - DataPath featureSliceAttrMatPath = pSliceDataContainerNameValue.createChildPath(pSliceAttributeMatrixNameValue); { auto createAttributeMatrixAction = std::make_unique(featureSliceAttrMatPath, tDims); resultOutputActions.value().appendAction(std::move(createAttributeMatrixAction)); } + + auto deferredDeleteGeometryAction = std::make_unique(pSliceDataContainerNameValue); + resultOutputActions.value().appendDeferredAction(std::move(deferredDeleteGeometryAction)); } + ///////////////////////////////////////////////////////////////////////////// // Return both the resultOutputActions and the preflightUpdatedValues via std::move() return {std::move(resultOutputActions), std::move(preflightUpdatedValues)}; diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/SliceTriangleGeometryFilter.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/SliceTriangleGeometryFilter.cpp index acd6095520..5219616fbf 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/SliceTriangleGeometryFilter.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/SliceTriangleGeometryFilter.cpp @@ -19,7 +19,7 @@ using namespace nx::core; namespace { -constexpr ChoicesParameter::ValueType k_UserDefinedRange = 1; + } // namespace namespace nx::core @@ -51,7 +51,7 @@ std::string SliceTriangleGeometryFilter::humanName() const //------------------------------------------------------------------------------ std::vector SliceTriangleGeometryFilter::defaultTags() const { - return {className(), "Sampling", "Geometry"}; + return {className(), "Sampling", "Geometry", "Slice", "Scan Vectors"}; } //------------------------------------------------------------------------------ @@ -88,8 +88,8 @@ Parameters SliceTriangleGeometryFilter::parameters() const // Associate the Linkable Parameter(s) to the children parameters that they control params.linkParameters(k_HaveRegionIds_Key, k_RegionIdArrayPath_Key, true); - params.linkParameters(k_SliceRange_Key, k_Zstart_Key, k_UserDefinedRange); - params.linkParameters(k_SliceRange_Key, k_Zend_Key, k_UserDefinedRange); + params.linkParameters(k_SliceRange_Key, k_Zstart_Key, slice_triangle_geometry::constants::k_FullRange); + params.linkParameters(k_SliceRange_Key, k_Zend_Key, slice_triangle_geometry::constants::k_UserDefinedRange); return params; } @@ -122,11 +122,11 @@ IFilter::PreflightResult SliceTriangleGeometryFilter::preflightImpl(const DataSt Result resultOutputActions; - if(pSliceRangeValue == k_UserDefinedRange) + if(pSliceRangeValue == slice_triangle_geometry::constants::k_UserDefinedRange) { if(pZStartValue >= pZEndValue) { - return MakePreflightErrorResult(-62100, "Z end must be larger than Z start."); + return MakePreflightErrorResult(-62100, "Z end range must be larger than Z start range."); } } diff --git a/src/Plugins/SimplnxCore/test/SliceTriangleGeometryTest.cpp b/src/Plugins/SimplnxCore/test/SliceTriangleGeometryTest.cpp index 96cdb382c0..ef6dea79d4 100644 --- a/src/Plugins/SimplnxCore/test/SliceTriangleGeometryTest.cpp +++ b/src/Plugins/SimplnxCore/test/SliceTriangleGeometryTest.cpp @@ -61,7 +61,9 @@ TEST_CASE("SimplnxCore::SliceTriangleGeometryFilter: Valid Filter Execution", "[ // Write the DataStructure out to the file system // #ifdef SIMPLNX_WRITE_TEST_OUTPUT - UnitTest::WriteTestDataStructure(dataStructure, fs::path(fmt::format("{}/slice_triangle_geometry.dream3d", unit_test::k_BinaryTestOutputDir))); + fs::path testFileOutputPath(fmt::format("{}/slice_triangle_geometry.dream3d", unit_test::k_BinaryTestOutputDir)); + std::cout << "Writing Output file: " << testFileOutputPath << std::endl; + UnitTest::WriteTestDataStructure(dataStructure, testFileOutputPath); // #endif // Compare the exemplar and the computed outputs diff --git a/test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp b/test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp index aaca3b8825..b3a58bb62d 100644 --- a/test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp +++ b/test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp @@ -408,9 +408,14 @@ inline void CompareImageGeometry(const ImageGeom* exemplarGeom, const ImageGeom* */ inline bool CompareIGeometry(const IGeometry* geom1, const IGeometry* geom2) { - return (geom1->getGeomType() == geom2->getGeomType()) && (geom1->getSpatialDimensionality() == geom2->getSpatialDimensionality()) && - (geom1->getUnitDimensionality() == geom2->getUnitDimensionality()) && (geom1->getNumberOfCells() == geom2->getNumberOfCells()) && - (geom1->findAllChildrenOfType().size() == geom2->findAllChildrenOfType().size()) && (geom1->getParametricCenter() == geom2->getParametricCenter()); + REQUIRE(geom1->getGeomType() == geom2->getGeomType()); + REQUIRE(geom1->getSpatialDimensionality() == geom2->getSpatialDimensionality()); + REQUIRE(geom1->getUnitDimensionality() == geom2->getUnitDimensionality()); + REQUIRE(geom1->getNumberOfCells() == geom2->getNumberOfCells()); + REQUIRE(geom1->findAllChildrenOfType().size() == geom2->findAllChildrenOfType().size()); + REQUIRE(geom1->getParametricCenter() == geom2->getParametricCenter()); + + return true; } /**