diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp index 09875f9fea..0e1747af32 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp @@ -271,7 +271,7 @@ class ComputeArrayStatisticsByIndexImpl histogram[m_NumBins - 1]++; } } // end of numTuples loop - } // end of increment else + } // end of increment else if(m_ModalBinRanges) { diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.cpp index c8befaa456..5545a09a9f 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.cpp @@ -2,11 +2,11 @@ #include "InitializeData.hpp" -#include "simplnx/Utilities/DataArrayUtilities.hpp" -#include "simplnx/Utilities/FilterUtilities.hpp" #include "simplnx/Common/TypeTraits.hpp" -#include "simplnx/DataStructure/IDataArray.hpp" #include "simplnx/DataStructure/AbstractDataStore.hpp" +#include "simplnx/DataStructure/IDataArray.hpp" +#include "simplnx/Utilities/DataArrayUtilities.hpp" +#include "simplnx/Utilities/FilterUtilities.hpp" #include #include diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.hpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.hpp index 3b2a620d23..7403460ab6 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.hpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/InitializeData.hpp @@ -3,9 +3,8 @@ #include "SimplnxCore/SimplnxCore_export.hpp" #include "simplnx/Filter/IFilter.hpp" -#include "simplnx/Utilities/StringUtilities.hpp" #include "simplnx/Utilities/DataArrayUtilities.hpp" - +#include "simplnx/Utilities/StringUtilities.hpp" namespace nx::core { @@ -40,7 +39,6 @@ struct SIMPLNXCORE_EXPORT InitializeDataInputValues bool standardizeSeed; }; - struct SIMPLNXCORE_EXPORT ValidateMultiInputFunctor { // The single comp size validation defaults to off as size 0 is checked earlier in the function @@ -92,13 +90,12 @@ struct SIMPLNXCORE_EXPORT ValidateMultiInputFunctor } }; - class InitializeData { public: InitializeData(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, InitializeDataInputValues* inputValues); ~InitializeData() noexcept; - + InitializeData(const InitializeData&) = delete; InitializeData(InitializeData&&) noexcept = delete; InitializeData& operator=(const InitializeData&) = delete; @@ -113,7 +110,6 @@ class InitializeData const InitializeDataInputValues* m_InputValues = nullptr; const std::atomic_bool& m_ShouldCancel; const IFilter::MessageHandler& m_MessageHandler; - }; -} +} // namespace nx::core diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.cpp index b21912158d..3144c8e93d 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.cpp @@ -163,16 +163,16 @@ IFilter::PreflightResult CreateDataArrayFilter::preflightImpl(const DataStructur nx::core::Result resultOutputActions; -// if(initValue.empty()) -// { -// return MakePreflightErrorResult(k_EmptyParameterError, fmt::format("{}: Init Value cannot be empty.{}({})", humanName(), __FILE__, __LINE__)); -// } -// // Sanity check that what the user entered for an init value can be converted safely to the final numeric type -// Result<> result = CheckValueConverts(initValue, numericType); -// if(result.invalid()) -// { -// return {ConvertResultTo(std::move(result), {})}; -// } + // if(initValue.empty()) + // { + // return MakePreflightErrorResult(k_EmptyParameterError, fmt::format("{}: Init Value cannot be empty.{}({})", humanName(), __FILE__, __LINE__)); + // } + // // Sanity check that what the user entered for an init value can be converted safely to the final numeric type + // Result<> result = CheckValueConverts(initValue, numericType); + // if(result.invalid()) + // { + // return {ConvertResultTo(std::move(result), {})}; + // } std::vector compDims = std::vector{numComponents}; std::vector tupleDims = {}; @@ -220,10 +220,10 @@ IFilter::PreflightResult CreateDataArrayFilter::preflightImpl(const DataStructur auto seedArrayNameValue = filterArgs.value(k_SeedArrayName_Key); auto initializeTypeValue = static_cast(filterArgs.value(k_InitType_Key)); -// nx::core::Result resultOutputActions; + // nx::core::Result resultOutputActions; std::vector preflightUpdatedValues; -// auto& iDataArray = dataStructure.getDataRefAs(filterArgs.value(k_ArrayPath_Key)); + // auto& iDataArray = dataStructure.getDataRefAs(filterArgs.value(k_ArrayPath_Key)); if(arrayDataType == DataType::boolean) { @@ -406,10 +406,9 @@ Result<> CreateDataArrayFilter::executeImpl(DataStructure& dataStructure, const const std::atomic_bool& shouldCancel) const { auto path = filterArgs.value(k_DataPath_Key); - auto initValue = filterArgs.value(k_InitializationValue_Key); - - ExecuteNeighborFunction(CreateAndInitArrayFunctor{}, ConvertNumericTypeToDataType(filterArgs.value(k_NumericType_Key)), dataStructure.getDataAs(path), initValue); + // auto initValue = filterArgs.value(k_InitializationValue_Key); + ExecuteNeighborFunction(CreateAndInitArrayFunctor{}, ConvertNumericTypeToDataType(filterArgs.value(k_NumericType_Key)), dataStructure.getDataAs(path), "0"); auto initType = static_cast(filterArgs.value(k_InitType_Key)); @@ -462,7 +461,7 @@ Result CreateDataArrayFilter::FromSIMPLJson(const nlohmann::json& jso results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_ScalarTypeKey, k_NumericType_Key)); results.push_back(SIMPLConversion::ConvertParameter>(args, json, SIMPL::k_NumberOfComponentsKey, k_NumComps_Key)); // Initialize Type parameter is not applicable in NX - results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_InitializationValueKey, k_InitializationValue_Key)); + results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_InitializationValueKey, k_InitValue_Key)); // Initialization Range parameter is not applicable in NX // Starting Index value parameter is not applicable in NX results.push_back(SIMPLConversion::ConvertParameter(args, json, SIMPL::k_NewArrayKey, k_DataPath_Key)); diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.hpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.hpp index 6b2ac76a08..997c7e3c6a 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.hpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/CreateDataArrayFilter.hpp @@ -26,7 +26,6 @@ class SIMPLNXCORE_EXPORT CreateDataArrayFilter : public IFilter static inline constexpr StringLiteral k_NumComps_Key = "component_count"; static inline constexpr StringLiteral k_TupleDims_Key = "tuple_dimensions"; static inline constexpr StringLiteral k_DataPath_Key = "output_array_path"; - static inline constexpr StringLiteral k_InitializationValue_Key = "initialization_value_str"; static inline constexpr StringLiteral k_DataFormat_Key = "data_format"; static inline constexpr StringLiteral k_InitType_Key = "init_type_index"; static inline constexpr StringLiteral k_InitValue_Key = "init_value"; diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/InitializeDataFilter.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/InitializeDataFilter.cpp index 3451cf87b6..4e6d307880 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/InitializeDataFilter.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/InitializeDataFilter.cpp @@ -15,7 +15,6 @@ #include - #include #include #include diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/utils/nanoflann.hpp b/src/Plugins/SimplnxCore/src/SimplnxCore/utils/nanoflann.hpp index 42fc0372fe..1d462f1c34 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/utils/nanoflann.hpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/utils/nanoflann.hpp @@ -2205,7 +2205,7 @@ struct KDTreeEigenMatrixAdaptor /** @} */ }; // end of KDTreeEigenMatrixAdaptor - /** @} */ +/** @} */ /** @} */ // end of grouping } // namespace nanoflann diff --git a/src/Plugins/SimplnxCore/test/CreateDataArrayTest.cpp b/src/Plugins/SimplnxCore/test/CreateDataArrayTest.cpp index 41aa318dd4..700a88befc 100644 --- a/src/Plugins/SimplnxCore/test/CreateDataArrayTest.cpp +++ b/src/Plugins/SimplnxCore/test/CreateDataArrayTest.cpp @@ -46,7 +46,7 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor args.insert(CreateDataArrayFilter::k_NumComps_Key, std::make_any(k_NComp)); args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(k_TupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("-1")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("-1")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); @@ -57,7 +57,7 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor args.insert(CreateDataArrayFilter::k_NumComps_Key, std::make_any(k_NComp)); args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(k_TupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("1024")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("1024")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); @@ -68,7 +68,7 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor args.insert(CreateDataArrayFilter::k_NumComps_Key, std::make_any(0)); args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(k_TupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("1")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("1")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); @@ -81,7 +81,7 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor DynamicTableInfo::TableDataType tupleDims = {{static_cast(0.0)}}; args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(tupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("1")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("1")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); @@ -93,7 +93,7 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor DynamicTableInfo::TableDataType tupleDims = {{static_cast(1.0)}}; args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(tupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); @@ -105,33 +105,33 @@ TEST_CASE("SimplnxCore::CreateDataArrayFilter(Invalid Parameters)", "[SimplnxCor DynamicTableInfo::TableDataType tupleDims = {{static_cast(1.0)}}; args.insert(CreateDataArrayFilter::k_TupleDims_Key, std::make_any(tupleDims)); args.insert(CreateDataArrayFilter::k_DataPath_Key, std::make_any(k_DataPath)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("1000")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("1000")); auto result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::uint8)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("-1")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("-1")); result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::int16)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("70000")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("70000")); result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::uint16)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("-1")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("-1")); result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::int32)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("4294967297")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("4294967297")); result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); args.insert(CreateDataArrayFilter::k_NumericType_Key, std::make_any(NumericType::int32)); - args.insert(CreateDataArrayFilter::k_InitializationValue_Key, std::make_any("-4294967297")); + args.insert(CreateDataArrayFilter::k_InitValue_Key, std::make_any("-4294967297")); result = filter.execute(dataStructure, args); SIMPLNX_RESULT_REQUIRE_INVALID(result.result); } diff --git a/src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp b/src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp index 6821e4a83b..7f196cfbd2 100644 --- a/src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp +++ b/src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp @@ -584,8 +584,7 @@ PYBIND11_MODULE(simplnx, mod) parameters.def("insert_linkable_parameter", &PyInsertLinkableParameter); parameters.def("link_parameters", [](Parameters& self, std::string groupKey, std::string childKey, BoolParameter::ValueType value) { self.linkParameters(groupKey, childKey, value); }); parameters.def("link_parameters", [](Parameters& self, std::string groupKey, std::string childKey, ChoicesParameter::ValueType value) { self.linkParameters(groupKey, childKey, value); }); - parameters.def( - "__getitem__", [](Parameters& self, std::string_view key) { return self.at(key).get(); }, py::return_value_policy::reference_internal); + parameters.def("__getitem__", [](Parameters& self, std::string_view key) { return self.at(key).get(); }, py::return_value_policy::reference_internal); py::class_> iArrayThreshold(mod, "IArrayThreshold"); @@ -1422,12 +1421,10 @@ PYBIND11_MODULE(simplnx, mod) "path"_a); pipeline.def_property("name", &Pipeline::getName, &Pipeline::setName); pipeline.def("execute", &ExecutePipeline); - pipeline.def( - "__getitem__", [](Pipeline& self, Pipeline::index_type index) { return self.at(index); }, py::return_value_policy::reference_internal); + pipeline.def("__getitem__", [](Pipeline& self, Pipeline::index_type index) { return self.at(index); }, py::return_value_policy::reference_internal); pipeline.def("__len__", &Pipeline::size); pipeline.def("size", &Pipeline::size); - pipeline.def( - "__iter__", [](Pipeline& self) { return py::make_iterator(self.begin(), self.end()); }, py::keep_alive<0, 1>()); + pipeline.def("__iter__", [](Pipeline& self) { return py::make_iterator(self.begin(), self.end()); }, py::keep_alive<0, 1>()); pipeline.def( "insert", [internals](Pipeline& self, Pipeline::index_type index, const IFilter& filter, const py::dict& args) { @@ -1441,10 +1438,8 @@ PYBIND11_MODULE(simplnx, mod) pipeline.def("remove", &Pipeline::removeAt, "index"_a); pipelineFilter.def("get_args", [internals](PipelineFilter& self) { return ConvertArgsToDict(*internals, self.getParameters(), self.getArguments()); }); - pipelineFilter.def( - "set_args", [internals](PipelineFilter& self, py::dict& args) { self.setArguments(ConvertDictToArgs(*internals, self.getParameters(), args)); }, "args"_a); - pipelineFilter.def( - "get_filter", [](PipelineFilter& self) { return self.getFilter(); }, py::return_value_policy::reference_internal); + pipelineFilter.def("set_args", [internals](PipelineFilter& self, py::dict& args) { self.setArguments(ConvertDictToArgs(*internals, self.getParameters(), args)); }, "args"_a); + pipelineFilter.def("get_filter", [](PipelineFilter& self) { return self.getFilter(); }, py::return_value_policy::reference_internal); pipelineFilter.def( "name", [](const PipelineFilter& self) {