From e18d78bf774551960952d10677d4eb5ceaf3fe9d Mon Sep 17 00:00:00 2001 From: Joey Kleingers Date: Wed, 9 Oct 2024 12:20:27 -0400 Subject: [PATCH 1/2] Fixing bug that was renumbering data object parent ids incorrectly. Signed-off-by: Joey Kleingers --- .../SimplnxCore/test/DREAM3DFileTest.cpp | 53 +++++++++++++++++++ src/simplnx/DataStructure/BaseGroup.cpp | 4 +- src/simplnx/DataStructure/BaseGroup.hpp | 4 +- src/simplnx/DataStructure/DataMap.cpp | 2 +- src/simplnx/DataStructure/DataMap.hpp | 6 +-- src/simplnx/DataStructure/DataObject.cpp | 19 ++++--- src/simplnx/DataStructure/DataObject.hpp | 6 +-- src/simplnx/DataStructure/DataStructure.cpp | 9 ++-- .../DataStructure/Geometry/IGeometry.cpp | 6 +-- .../DataStructure/Geometry/IGeometry.hpp | 4 +- .../DataStructure/Geometry/IGridGeometry.cpp | 6 +-- .../DataStructure/Geometry/IGridGeometry.hpp | 4 +- .../Geometry/INodeGeometry0D.cpp | 6 +-- .../Geometry/INodeGeometry0D.hpp | 4 +- .../Geometry/INodeGeometry1D.cpp | 6 +-- .../Geometry/INodeGeometry1D.hpp | 4 +- .../Geometry/INodeGeometry2D.cpp | 6 +-- .../Geometry/INodeGeometry2D.hpp | 4 +- .../Geometry/INodeGeometry3D.cpp | 6 +-- .../Geometry/INodeGeometry3D.hpp | 4 +- .../DataStructure/Geometry/RectGridGeom.cpp | 6 +-- .../DataStructure/Geometry/RectGridGeom.hpp | 4 +- 22 files changed, 114 insertions(+), 59 deletions(-) diff --git a/src/Plugins/SimplnxCore/test/DREAM3DFileTest.cpp b/src/Plugins/SimplnxCore/test/DREAM3DFileTest.cpp index 87fdc875e0..494b5dbd03 100644 --- a/src/Plugins/SimplnxCore/test/DREAM3DFileTest.cpp +++ b/src/Plugins/SimplnxCore/test/DREAM3DFileTest.cpp @@ -1,3 +1,6 @@ +#include "SimplnxCore/Filters/CreateDataArrayFilter.hpp" +#include "SimplnxCore/Filters/CreateImageGeometryFilter.hpp" +#include "SimplnxCore/Filters/ReadDREAM3DFilter.hpp" #include "SimplnxCore/SimplnxCore_test_dirs.hpp" #include "simplnx/Core/Application.hpp" @@ -362,3 +365,53 @@ TEST_CASE("DREAM3DFileTest:Import/Export Multi-DREAM3D Filter Test") REQUIRE(importDataStructure.getData(DataPath({DataNames::k_Group1Name})) != nullptr); REQUIRE(importDataStructure.getData(DataPath({DataNames::k_Group2Name})) != nullptr); } + +TEST_CASE("DREAM3DFileTest: Existing Data Objects Test") +{ + DataStructure ds; + { + CreateImageGeometryFilter filter; + Arguments args; + args.insert(CreateImageGeometryFilter::k_GeometryDataPath_Key, std::make_any(DataPath({"New Geometry"}))); + args.insert(CreateImageGeometryFilter::k_CellDataName_Key, std::make_any("Cell Data")); + args.insert(CreateImageGeometryFilter::k_Dimensions_Key, std::make_any>(std::vector{480, 640, 1})); + args.insert(CreateImageGeometryFilter::k_Origin_Key, std::make_any>(std::vector{0, 0, 0})); + args.insert(CreateImageGeometryFilter::k_Spacing_Key, std::make_any>(std::vector{0.5, 0.5, 0.12})); + auto executeResult = filter.execute(ds, args); + REQUIRE(executeResult.result.valid()); + } + + { + CreateDataArrayFilter filter; + Arguments args; + args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::float32)); + args.insert(CreateDataArrayFilter::k_NumComps_Key, std::make_any(1)); + args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(DataPath({"New Geometry", "Cell Data", "Array 1"}))); + args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("0")); + auto executeResult = filter.execute(ds, args); + REQUIRE(executeResult.result.valid()); + } + + { + CreateDataArrayFilter filter; + Arguments args; + args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::float32)); + args.insert(CreateDataArrayFilter::k_NumComps_Key, std::make_any(1)); + args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(DataPath({"New Geometry", "Cell Data", "Array 2"}))); + args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("0")); + auto executeResult = filter.execute(ds, args); + REQUIRE(executeResult.result.valid()); + } + + { + const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_CMakeExecutable, nx::core::unit_test::k_TestFilesDir, "Small_IN100_dream3d_v2.tar.gz", "Small_IN100.dream3d"); + + ReadDREAM3DFilter filter; + Arguments args; + Dream3dImportParameter::ImportData importData; + importData.FilePath = fs::path(fmt::format("{}/Small_IN100.dream3d", unit_test::k_TestFilesDir)); + args.insert(ReadDREAM3DFilter::k_ImportFileData, importData); + auto executeResult = filter.execute(ds, args); + REQUIRE(executeResult.result.valid()); + } +} diff --git a/src/simplnx/DataStructure/BaseGroup.cpp b/src/simplnx/DataStructure/BaseGroup.cpp index 7da37c91f1..a19058b4db 100644 --- a/src/simplnx/DataStructure/BaseGroup.cpp +++ b/src/simplnx/DataStructure/BaseGroup.cpp @@ -247,9 +247,9 @@ std::vector BaseGroup::GetChildrenNames() return m_DataMap.getNames(); } -void BaseGroup::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void BaseGroup::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - m_DataMap.updateIds(updatedIds); + m_DataMap.updateIds(updatedIdsMap); } std::vector BaseGroup::GetChildrenIds() diff --git a/src/simplnx/DataStructure/BaseGroup.hpp b/src/simplnx/DataStructure/BaseGroup.hpp index efd24f5f6d..d676f1b7be 100644 --- a/src/simplnx/DataStructure/BaseGroup.hpp +++ b/src/simplnx/DataStructure/BaseGroup.hpp @@ -357,9 +357,9 @@ class SIMPLNX_EXPORT BaseGroup : public DataObject /** * @brief Updates the DataMap IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; /** * @brief Checks if the provided DataObject can be added to the container. diff --git a/src/simplnx/DataStructure/DataMap.cpp b/src/simplnx/DataStructure/DataMap.cpp index be0fed6187..5b782f1833 100644 --- a/src/simplnx/DataStructure/DataMap.cpp +++ b/src/simplnx/DataStructure/DataMap.cpp @@ -318,7 +318,7 @@ DataMap& DataMap::operator=(DataMap&& rhs) noexcept return *this; } -void DataMap::updateIds(const std::vector>& updatedIds) +void DataMap::updateIds(const std::unordered_map& updatedIds) { using UpdatedValueType = std::pair>; std::list movedValues; diff --git a/src/simplnx/DataStructure/DataMap.hpp b/src/simplnx/DataStructure/DataMap.hpp index 87a796dd9b..dc6279814f 100644 --- a/src/simplnx/DataStructure/DataMap.hpp +++ b/src/simplnx/DataStructure/DataMap.hpp @@ -285,10 +285,10 @@ class SIMPLNX_EXPORT DataMap DataMap& operator=(DataMap&& rhs) noexcept; /** - * @brief Updates the map IDs using a vector of updated IDs and their new values. - * @param updatedIds + * @brief Updates the map IDs using an unordered map of IDs and their new values. + * @param updatedIdsMap */ - void updateIds(const std::vector>& updatedIds); + void updateIds(const std::unordered_map& updatedIdsMap); private: MapType m_Map; diff --git a/src/simplnx/DataStructure/DataObject.cpp b/src/simplnx/DataStructure/DataObject.cpp index 415190a886..d52f530536 100644 --- a/src/simplnx/DataStructure/DataObject.cpp +++ b/src/simplnx/DataStructure/DataObject.cpp @@ -101,19 +101,22 @@ void DataObject::setId(IdType newId) m_Id = newId; } -void DataObject::checkUpdatedIds(const std::vector>& updatedIds) +void DataObject::checkUpdatedIds(const std::unordered_map& updatedIdsMap) { - for(const auto& updatedId : updatedIds) - { - // Update parent list - std::replace(m_ParentList.begin(), m_ParentList.end(), updatedId.first, updatedId.second); - } + // Use std::transform to map IDs + ParentCollectionType newParentList; + std::transform(m_ParentList.begin(), m_ParentList.end(), std::back_inserter(newParentList), [&updatedIdsMap](uint64 id) -> uint64 { + auto it = updatedIdsMap.find(id); + return (it != updatedIdsMap.end()) ? it->second : id; + }); + + m_ParentList = newParentList; // For derived classes - checkUpdatedIdsImpl(updatedIds); + checkUpdatedIdsImpl(updatedIdsMap); } -void DataObject::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void DataObject::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { } diff --git a/src/simplnx/DataStructure/DataObject.hpp b/src/simplnx/DataStructure/DataObject.hpp index 459dfa71f9..592a37c70d 100644 --- a/src/simplnx/DataStructure/DataObject.hpp +++ b/src/simplnx/DataStructure/DataObject.hpp @@ -288,15 +288,15 @@ class SIMPLNX_EXPORT DataObject /** * @brief Notifies the DataObject of DataObject IDs that have been changed by the DataStructure. - * @param updatedIds std::pair ordered as {old ID, new ID} + * @param updatedIdsMap std::unordered_map containing the mappings between the old IDs and the new IDs */ - void checkUpdatedIds(const std::vector>& updatedIds); + void checkUpdatedIds(const std::unordered_map& updatedIdsMap); /** * @brief Calls specialized checks for derived classes. Should only be called by checkUpdatedIds. * @param updatedIds */ - virtual void checkUpdatedIdsImpl(const std::vector>& updatedIds); + virtual void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap); /** * @brief Attempts to add the specified DataObject to the target DataStructure. diff --git a/src/simplnx/DataStructure/DataStructure.cpp b/src/simplnx/DataStructure/DataStructure.cpp index 60c6ffb12f..ab14b55a10 100644 --- a/src/simplnx/DataStructure/DataStructure.cpp +++ b/src/simplnx/DataStructure/DataStructure.cpp @@ -831,8 +831,7 @@ void DataStructure::resetIds(DataObject::IdType startingId) // Update DataObject IDs and track changes WeakCollectionType newCollection; - using UpdatedId = std::pair; - std::vector updatedIds; + std::unordered_map updatedIdsMap; for(auto& dataObjectIter : m_DataObjects) { auto dataObjectPtr = dataObjectIter.second.lock(); @@ -845,7 +844,7 @@ void DataStructure::resetIds(DataObject::IdType startingId) auto newId = generateId(); dataObjectPtr->setId(newId); - updatedIds.push_back({oldId, newId}); + updatedIdsMap[oldId] = newId; newCollection.insert({newId, dataObjectPtr}); } @@ -859,10 +858,10 @@ void DataStructure::resetIds(DataObject::IdType startingId) auto dataObjectPtr = dataObjectIter.second.lock(); if(dataObjectPtr != nullptr) { - dataObjectPtr->checkUpdatedIds(updatedIds); + dataObjectPtr->checkUpdatedIds(updatedIdsMap); } } - m_RootGroup.updateIds(updatedIds); + m_RootGroup.updateIds(updatedIdsMap); } void DataStructure::exportHierarchyAsGraphViz(std::ostream& outputStream) const diff --git a/src/simplnx/DataStructure/Geometry/IGeometry.cpp b/src/simplnx/DataStructure/Geometry/IGeometry.cpp index 6911701650..57441c9902 100644 --- a/src/simplnx/DataStructure/Geometry/IGeometry.cpp +++ b/src/simplnx/DataStructure/Geometry/IGeometry.cpp @@ -193,13 +193,13 @@ std::string IGeometry::LengthUnitToString(LengthUnit unit) return "Unknown"; } -void IGeometry::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void IGeometry::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - BaseGroup::checkUpdatedIdsImpl(updatedIds); + BaseGroup::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(1, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_ElementSizesId = nx::core::VisitDataStructureId(m_ElementSizesId, updatedId, visited, 0); } diff --git a/src/simplnx/DataStructure/Geometry/IGeometry.hpp b/src/simplnx/DataStructure/Geometry/IGeometry.hpp index 58ce9b5cbb..9699dcaf54 100644 --- a/src/simplnx/DataStructure/Geometry/IGeometry.hpp +++ b/src/simplnx/DataStructure/Geometry/IGeometry.hpp @@ -192,9 +192,9 @@ class SIMPLNX_EXPORT IGeometry : public BaseGroup /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; std::optional m_ElementSizesId; diff --git a/src/simplnx/DataStructure/Geometry/IGridGeometry.cpp b/src/simplnx/DataStructure/Geometry/IGridGeometry.cpp index 53c3d680bd..fcd9a44f80 100644 --- a/src/simplnx/DataStructure/Geometry/IGridGeometry.cpp +++ b/src/simplnx/DataStructure/Geometry/IGridGeometry.cpp @@ -74,13 +74,13 @@ void IGridGeometry::setCellData(OptionalId id) m_CellDataId = id; } -void IGridGeometry::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void IGridGeometry::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - IGeometry::checkUpdatedIdsImpl(updatedIds); + IGeometry::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(1, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_CellDataId = nx::core::VisitDataStructureId(m_CellDataId, updatedId, visited, 0); if(visited[0]) diff --git a/src/simplnx/DataStructure/Geometry/IGridGeometry.hpp b/src/simplnx/DataStructure/Geometry/IGridGeometry.hpp index 0d55fb01ae..eb5b188dbb 100644 --- a/src/simplnx/DataStructure/Geometry/IGridGeometry.hpp +++ b/src/simplnx/DataStructure/Geometry/IGridGeometry.hpp @@ -225,9 +225,9 @@ class SIMPLNX_EXPORT IGridGeometry : public IGeometry /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; std::optional m_CellDataId; }; diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry0D.cpp b/src/simplnx/DataStructure/Geometry/INodeGeometry0D.cpp index eb2eaaa30d..cb845f546c 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry0D.cpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry0D.cpp @@ -240,13 +240,13 @@ void INodeGeometry0D::setVertexAttributeMatrix(const AttributeMatrix& attributeM m_VertexAttributeMatrixId = attributeMatrix.getId(); } -void INodeGeometry0D::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void INodeGeometry0D::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - IGeometry::checkUpdatedIdsImpl(updatedIds); + IGeometry::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(2, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_VertexDataArrayId = nx::core::VisitDataStructureId(m_VertexDataArrayId, updatedId, visited, 0); m_VertexAttributeMatrixId = nx::core::VisitDataStructureId(m_VertexAttributeMatrixId, updatedId, visited, 1); diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry0D.hpp b/src/simplnx/DataStructure/Geometry/INodeGeometry0D.hpp index dda2f1dfe3..eaa43463e2 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry0D.hpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry0D.hpp @@ -186,9 +186,9 @@ class SIMPLNX_EXPORT INodeGeometry0D : public IGeometry /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; /* *************************************************************************** * These variables are the Ids of the arrays from the DataStructure object. diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry1D.cpp b/src/simplnx/DataStructure/Geometry/INodeGeometry1D.cpp index fed6e9f5e9..da7a87ab58 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry1D.cpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry1D.cpp @@ -258,13 +258,13 @@ void INodeGeometry1D::setElementSizesId(const std::optional& sizesId) m_ElementSizesId = sizesId; } -void INodeGeometry1D::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void INodeGeometry1D::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - INodeGeometry0D::checkUpdatedIdsImpl(updatedIds); + INodeGeometry0D::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(7, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_EdgeAttributeMatrixId = nx::core::VisitDataStructureId(m_EdgeAttributeMatrixId, updatedId, visited, 0); m_EdgeDataArrayId = nx::core::VisitDataStructureId(m_EdgeDataArrayId, updatedId, visited, 1); diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry1D.hpp b/src/simplnx/DataStructure/Geometry/INodeGeometry1D.hpp index 165a5533ad..e0611e25c7 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry1D.hpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry1D.hpp @@ -223,9 +223,9 @@ class SIMPLNX_EXPORT INodeGeometry1D : public INodeGeometry0D /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; /* *************************************************************************** * These variables are the Ids of the arrays from the DataStructure object. diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry2D.cpp b/src/simplnx/DataStructure/Geometry/INodeGeometry2D.cpp index 7793fca1cd..9653f35b66 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry2D.cpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry2D.cpp @@ -212,11 +212,11 @@ INodeGeometry2D::SharedEdgeList* INodeGeometry2D::createSharedEdgeList(usize num return edges; } -void INodeGeometry2D::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void INodeGeometry2D::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - INodeGeometry1D::checkUpdatedIdsImpl(updatedIds); + INodeGeometry1D::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(3, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_FaceListId = nx::core::VisitDataStructureId(m_FaceListId, updatedId, visited, 0); m_FaceAttributeMatrixId = nx::core::VisitDataStructureId(m_FaceAttributeMatrixId, updatedId, visited, 1); diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry2D.hpp b/src/simplnx/DataStructure/Geometry/INodeGeometry2D.hpp index f68283a8f9..3f39208fa4 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry2D.hpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry2D.hpp @@ -211,9 +211,9 @@ class SIMPLNX_EXPORT INodeGeometry2D : public INodeGeometry1D /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; /* *************************************************************************** * These variables are the Ids of the arrays from the DataStructure object. diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry3D.cpp b/src/simplnx/DataStructure/Geometry/INodeGeometry3D.cpp index 83eacfa810..cfb58309cb 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry3D.cpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry3D.cpp @@ -222,12 +222,12 @@ INodeGeometry3D::SharedTriList* INodeGeometry3D::createSharedTriList(usize numTr return triangles; } -void INodeGeometry3D::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void INodeGeometry3D::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - INodeGeometry2D::checkUpdatedIdsImpl(updatedIds); + INodeGeometry2D::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(3, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_PolyhedronListId = nx::core::VisitDataStructureId(m_PolyhedronListId, updatedId, visited, 0); m_PolyhedronAttributeMatrixId = nx::core::VisitDataStructureId(m_PolyhedronAttributeMatrixId, updatedId, visited, 1); diff --git a/src/simplnx/DataStructure/Geometry/INodeGeometry3D.hpp b/src/simplnx/DataStructure/Geometry/INodeGeometry3D.hpp index 0e04d3e4f1..d63b5c96b7 100644 --- a/src/simplnx/DataStructure/Geometry/INodeGeometry3D.hpp +++ b/src/simplnx/DataStructure/Geometry/INodeGeometry3D.hpp @@ -205,9 +205,9 @@ class SIMPLNX_EXPORT INodeGeometry3D : public INodeGeometry2D /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; /* *************************************************************************** * These variables are the Ids of the arrays from the DataStructure object. diff --git a/src/simplnx/DataStructure/Geometry/RectGridGeom.cpp b/src/simplnx/DataStructure/Geometry/RectGridGeom.cpp index 7e197bba24..1b6ad513d0 100644 --- a/src/simplnx/DataStructure/Geometry/RectGridGeom.cpp +++ b/src/simplnx/DataStructure/Geometry/RectGridGeom.cpp @@ -700,12 +700,12 @@ std::optional RectGridGeom::getIndex(float64 xCoord, float64 yCoord, floa return (ySize * xSize * z) + (xSize * y) + x; } -void RectGridGeom::checkUpdatedIdsImpl(const std::vector>& updatedIds) +void RectGridGeom::checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) { - IGridGeometry::checkUpdatedIdsImpl(updatedIds); + IGridGeometry::checkUpdatedIdsImpl(updatedIdsMap); std::vector visited(3, false); - for(const auto& updatedId : updatedIds) + for(const auto& updatedId : updatedIdsMap) { m_xBoundsId = nx::core::VisitDataStructureId(m_xBoundsId, updatedId, visited, 0); m_yBoundsId = nx::core::VisitDataStructureId(m_yBoundsId, updatedId, visited, 1); diff --git a/src/simplnx/DataStructure/Geometry/RectGridGeom.hpp b/src/simplnx/DataStructure/Geometry/RectGridGeom.hpp index 6f542be587..5ae32f8b22 100644 --- a/src/simplnx/DataStructure/Geometry/RectGridGeom.hpp +++ b/src/simplnx/DataStructure/Geometry/RectGridGeom.hpp @@ -385,9 +385,9 @@ class SIMPLNX_EXPORT RectGridGeom : public IGridGeometry /** * @brief Updates the array IDs. Should only be called by DataObject::checkUpdatedIds. - * @param updatedIds + * @param updatedIdsMap */ - void checkUpdatedIdsImpl(const std::vector>& updatedIds) override; + void checkUpdatedIdsImpl(const std::unordered_map& updatedIdsMap) override; private: std::optional m_xBoundsId; From b4e0e8c3ad9efb13d382c96140108129729ca398 Mon Sep 17 00:00:00 2001 From: Joey Kleingers Date: Wed, 9 Oct 2024 14:59:45 -0400 Subject: [PATCH 2/2] Fix compile errors. Signed-off-by: Joey Kleingers --- src/simplnx/DataStructure/DataMap.hpp | 1 + src/simplnx/DataStructure/DataObject.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/simplnx/DataStructure/DataMap.hpp b/src/simplnx/DataStructure/DataMap.hpp index dc6279814f..afdedf2239 100644 --- a/src/simplnx/DataStructure/DataMap.hpp +++ b/src/simplnx/DataStructure/DataMap.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace nx::core diff --git a/src/simplnx/DataStructure/DataObject.hpp b/src/simplnx/DataStructure/DataObject.hpp index 592a37c70d..c1405a3441 100644 --- a/src/simplnx/DataStructure/DataObject.hpp +++ b/src/simplnx/DataStructure/DataObject.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace nx::core