Skip to content

Commit

Permalink
BUG: Fixes bug where CreateDataArrayAdvanced initializes the arrays t…
Browse files Browse the repository at this point in the history
…wice (#1202)

* BUG: Fixes bug where CreateDataArrayAdvanced initializes the arrays twice.

Signed-off-by: Michael Jackson <[email protected]>

---------

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Feb 19, 2025
1 parent 5d2e649 commit c0067c7
Showing 1 changed file with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@

using namespace nx::core;

namespace
{
struct CreateAndInitArrayFunctor
{
template <class T>
void operator()(IDataArray* iDataArray, const std::string& initValue)
{
Result<T> result = ConvertTo<T>::convert(initValue);

auto* dataStore = iDataArray->template getIDataStoreAs<AbstractDataStore<T>>();
dataStore->fill(result.value());
}
};
} // namespace

namespace nx::core
{
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -314,9 +299,6 @@ Result<> CreateDataArrayAdvancedFilter::executeImpl(DataStructure& dataStructure
const std::atomic_bool& shouldCancel) const
{
auto path = filterArgs.value<DataPath>(k_DataPath_Key);

ExecuteNeighborFunction(CreateAndInitArrayFunctor{}, ConvertNumericTypeToDataType(filterArgs.value<NumericType>(k_NumericType_Key)), dataStructure.getDataAs<IDataArray>(path), "0");

auto initType = static_cast<InitializeType>(filterArgs.value<uint64>(k_InitType_Key));

auto seed = filterArgs.value<std::mt19937_64::result_type>(k_SeedValue_Key);
Expand Down

0 comments on commit c0067c7

Please sign in to comment.