Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions src/SimplnxReview/Filters/Algorithms/ComputeGroupingDensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/NeighborList.hpp"
#include "simplnx/Utilities/MessageHelper.hpp"

using namespace nx::core;

Expand Down Expand Up @@ -66,30 +67,13 @@ class FindDensityGrouping
// Default value-initialized to zeroes: https://en.cppreference.com/w/cpp/named_req/DefaultInsertable
checkedFeatureVolumes.resize(numFeatures);
}
int32_t progInt = 0;
usize prevParentId = 1;
usize currentParentId = 1;
auto start = std::chrono::steady_clock::now();
MessageHelper messageHelper(m_MessageHandler);
ThrottledMessenger throttledMessenger = messageHelper.createThrottledMessenger();

for(usize parentIdx = 1; parentIdx < numParents; parentIdx++)
{
progInt = static_cast<float>(parentIdx) / static_cast<float>(numParents) * 100.0f;
auto now = std::chrono::steady_clock::now();
// Only send updates every 1 second
if(std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count() > 1000)
{
currentParentId = parentIdx;
auto totalParentIds = currentParentId - prevParentId;
auto rate = static_cast<float>(totalParentIds) / static_cast<float>(std::chrono::duration_cast<std::chrono::seconds>(now - start).count());

auto remainingParents = numParents - parentIdx;
auto minutesRemain = (remainingParents / rate) / 60; // Convert to minutes
throttledMessenger.sendThrottledMessage([&]() { return fmt::format("[{}%]", CalculatePercentComplete(parentIdx, numParents)); });

std::string message = fmt::format("{}/{} [{}%] at {} parents/sec. Time Remain: {:.2f} Minutes", parentIdx, numParents, progInt, rate, minutesRemain);
m_MessageHandler(nx::core::IFilter::ProgressMessage{nx::core::IFilter::Message::Type::Info, message, progInt});
start = std::chrono::steady_clock::now();
prevParentId = currentParentId;
}
if(m_ShouldCancel)
{
return {};
Expand Down
189 changes: 105 additions & 84 deletions src/SimplnxReview/Filters/Algorithms/GroupMicroTextureRegions.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "SimplnxReview/SimplnxReview_export.hpp"

#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/DataPath.hpp"
#include "simplnx/DataStructure/DataStructure.hpp"
#include "simplnx/Filter/IFilter.hpp"
Expand Down Expand Up @@ -70,5 +71,13 @@ class SIMPLNXREVIEW_EXPORT GroupMicroTextureRegions
std::array<float32, 3> m_AvgCAxes = {0.0f, 0.0f, 0.0f};
std::mt19937_64 m_Generator = {};
std::uniform_real_distribution<float32> m_Distribution = {};

// These are so that we don't have to keep getting the references while we are running

Int32Array& m_FeaturePhases;
Int32Array& m_FeatureParentIds;
UInt32Array& m_CrystalStructures;
Float32Array& m_AvgQuats;
Float32Array& m_Volumes;
};
} // namespace nx::core
1 change: 0 additions & 1 deletion src/SimplnxReview/Filters/ComputeGroupingDensityFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,4 @@ Result<Arguments> ComputeGroupingDensityFilter::FromSIMPLJson(const nlohmann::js

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,4 @@ Result<Arguments> ComputeLocalAverageCAxisMisalignmentsFilter::FromSIMPLJson(con

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,4 @@ Result<Arguments> ComputeMicroTextureRegionsFilter::FromSIMPLJson(const nlohmann

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
1 change: 0 additions & 1 deletion src/SimplnxReview/Filters/ComputeSaltykovSizesFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,4 @@ Result<Arguments> ComputeSaltykovSizesFilter::FromSIMPLJson(const nlohmann::json

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
15 changes: 8 additions & 7 deletions src/SimplnxReview/Filters/GroupMicroTextureRegionsFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,21 @@ Parameters GroupMicroTextureRegionsFilter::parameters() const

// Create the parameter descriptors that are needed for this filter
params.insertSeparator(Parameters::Separator{"Input Parameter(s)"});

params.insert(std::make_unique<BoolParameter>(k_UseRunningAverage_Key, "Group C-Axes With Running Average", "Group C-Axes With Running Average", true));
params.insert(std::make_unique<Float32Parameter>(k_CAxisTolerance_Key, "C-Axis Alignment Tolerance (Degrees)", "C-Axis Alignment Tolerance (Degrees)", 0.0f));
params.insert(std::make_unique<NeighborListSelectionParameter>(k_ContiguousNeighborListArrayPath_Key, "Contiguous Neighbor List", "List of contiguous neighbors for each Feature.", DataPath{},
NeighborListSelectionParameter::AllowedTypes{DataType::int32}));

params.insertSeparator(Parameters::Separator{"Non-Contiguous Neighborhood Option"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(k_UseNonContiguousNeighbors_Key, "Use Non-Contiguous Neighbors", "Use non-contiguous neighborhoods", false));
params.insert(std::make_unique<NeighborListSelectionParameter>(k_NonContiguousNeighborListArrayPath_Key, "Non-Contiguous Neighbor List", "List of non-contiguous neighbors for each Feature.",
DataPath{}, NeighborListSelectionParameter::AllowedTypes{DataType::int32}));
params.insert(std::make_unique<NeighborListSelectionParameter>(k_ContiguousNeighborListArrayPath_Key, "Contiguous Neighbor List", "List of contiguous neighbors for each Feature.", DataPath{},
NeighborListSelectionParameter::AllowedTypes{DataType::int32}));
params.insert(std::make_unique<BoolParameter>(k_UseRunningAverage_Key, "Group C-Axes With Running Average", "Group C-Axes With Running Average", true));
params.insert(std::make_unique<Float32Parameter>(k_CAxisTolerance_Key, "C-Axis Alignment Tolerance (Degrees)", "C-Axis Alignment Tolerance (Degrees)", 0.0f));

params.insertSeparator(Parameters::Separator{"Random Number Seed Parameters"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(k_UseSeed_Key, "Use Seed for Random Generation", "When true the user will be able to put in a seed for random generation", false));
params.insert(std::make_unique<NumberParameter<uint64>>(k_SeedValue_Key, "Seed", "The seed fed into the random generator", std::mt19937::default_seed));
params.insert(std::make_unique<DataObjectNameParameter>(k_SeedArrayName_Key, "Stored Seed Value Array Name", "Name of array holding the seed value", "_Group_MicroTexture_Regions_Seed_Value_"));

params.insertSeparator(Parameters::Separator{"Input Cell Data"});
params.insert(std::make_unique<ArraySelectionParameter>(k_FeatureIdsArrayPath_Key, "Cell Feature Ids", "Data Array that specifies to which Feature each Element belongs", DataPath{},
Expand All @@ -90,8 +94,6 @@ Parameters GroupMicroTextureRegionsFilter::parameters() const
params.insert(std::make_unique<DataGroupCreationParameter>(k_NewCellFeatureAttributeMatrixName_Key, "Created Microtexture Feature Attribute Matrix",
"Output Feature Attribute Matrix for Microtexture Regions", DataPath{}));
params.insert(std::make_unique<DataObjectNameParameter>(k_ActiveArrayName_Key, "Active Array Name", "Output Active Array", "Active"));
params.insert(std::make_unique<DataObjectNameParameter>(k_SeedArrayName_Key, "Stored Seed Value Array Name", "Output data array to store the random number seed value",
"_Group_MicroTexture_Regions_Seed_Value_"));

// Associate the Linkable Parameter(s) to the children parameters that they control
params.linkParameters(k_UseNonContiguousNeighbors_Key, k_NonContiguousNeighborListArrayPath_Key, true);
Expand Down Expand Up @@ -243,5 +245,4 @@ Result<Arguments> GroupMicroTextureRegionsFilter::FromSIMPLJson(const nlohmann::

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,4 @@ Result<Arguments> InterpolateValuesToUnstructuredGridFilter::FromSIMPLJson(const

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
1 change: 0 additions & 1 deletion src/SimplnxReview/Filters/MergeColoniesFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,4 @@ Result<Arguments> MergeColoniesFilter::FromSIMPLJson(const nlohmann::json& json)

return ConvertResultTo<Arguments>(std::move(conversionResult), std::move(args));
}

} // namespace nx::core
Loading