Skip to content

Commit

Permalink
algorithm almost complete - randomness pending
Browse files Browse the repository at this point in the history
  • Loading branch information
nyoungbq authored and imikejackson committed Jul 3, 2023
1 parent 472f921 commit f5aca08
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ MergeColonies::MergeColonies(DataStructure& dataStructure, const IFilter::Messag
, m_ShouldCancel(shouldCancel)
, m_MessageHandler(mesgHandler)
, m_OrientationOps(LaueOps::GetAllOrientationOps())
, m_FeatureParentIds(dataStructure.getDataRefAs<Int32Array>(inputValues->FeatureParentIdsPath))
, m_FeaturePhases(dataStructure.getDataRefAs<Int32Array>(inputValues->FeaturePhasesPath))
, m_AvgQuats(dataStructure.getDataRefAs<Float32Array>(inputValues->AvgQuatsPath))
, m_CrystalStructures(dataStructure.getDataRefAs<UInt32Array>(inputValues->CrystalStructuresPath))
, m_AxisToleranceRad(inputValues->AxisTolerance * Constants::k_PiF / 180.0f)
, m_AngleTolerance(inputValues->AngleTolerance)
{
}

Expand All @@ -153,14 +159,6 @@ const std::atomic_bool& MergeColonies::getCancel()
// -----------------------------------------------------------------------------
Result<> MergeColonies::operator()()
{
m_FeatureParentIds = m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->FeatureParentIdsPath);
m_FeaturePhases = m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->FeaturePhasesPath);
m_AvgQuats = m_DataStructure.getDataRefAs<Float32Array>(m_InputValues->AvgQuatsPath);
m_CrystalStructures = m_DataStructure.getDataRefAs<UInt32Array>(m_InputValues->CrystalStructuresPath);

m_AxisToleranceRad = m_InputValues->AxisTolerance * Constants::k_PiF / 180.0f;
m_AngleTolerance = m_InputValues->AngleTolerance;

GroupFeatures::execute();

auto active = m_DataStructure.getDataRefAs<BoolArray>(m_InputValues->ActivePath);
Expand All @@ -187,6 +185,10 @@ Result<> MergeColonies::operator()()
}
numParents += 1;

m_MessageHandler({IFilter::Message::Type::Info, "Characterizing Colonies Starting"});
characterize_colonies();
m_MessageHandler({IFilter::Message::Type::Info, "Characterizing Colonies Complete"});

if(m_InputValues->RandomizeParentIds)
{
m_MessageHandler({IFilter::Message::Type::Info, "Randomizing Parent Ids...."});
Expand Down Expand Up @@ -355,3 +357,10 @@ bool MergeColonies::determineGrouping(int32 referenceFeature, int32 neighborFeat
}
return false;
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void MergeColonies::characterize_colonies()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ namespace complex
{
struct ORIENTATIONANALYSIS_EXPORT MergeColoniesInputValues
{
bool UseNonContiguousNeighbors;
DataPath NonContiguousNLPath;
DataPath ContiguousNLPath;
float32 AxisTolerance;
float32 AngleTolerance;
DataPath FeaturePhasesPath;
Expand All @@ -47,7 +44,8 @@ class ORIENTATIONANALYSIS_EXPORT MergeColonies : public GroupFeatures
using LaueOpsContainer = std::vector<LaueOpsShPtrType>;

public:
MergeColonies(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, MergeColoniesInputValues* inputValues);
MergeColonies(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, MergeColoniesInputValues* inputValues,
GroupFeaturesInputValues* groupInputValues);
~MergeColonies() noexcept;

MergeColonies(const MergeColonies&) = delete;
Expand All @@ -61,6 +59,7 @@ class ORIENTATIONANALYSIS_EXPORT MergeColonies : public GroupFeatures

int getSeed(int32 newFid) override;
bool determineGrouping(int32 referenceFeature, int32 neighborFeature, int32 newFid) override;
void characterize_colonies();

private:
DataStructure& m_DataStructure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ IFilter::UniquePointer MergeColoniesFilter::clone() const
IFilter::PreflightResult MergeColoniesFilter::preflightImpl(const DataStructure& dataStructure, const Arguments& filterArgs, const MessageHandler& messageHandler,
const std::atomic_bool& shouldCancel) const
{
auto pUseNonContiguousNeighborsValue = filterArgs.value<bool>(k_UseNonContiguousNeighbors_Key);
auto pNonContiguousNeighborListArrayPathValue = filterArgs.value<DataPath>(k_NonContiguousNeighborListArrayPath_Key);
auto pContiguousNeighborListArrayPathValue = filterArgs.value<DataPath>(k_ContiguousNeighborListArrayPath_Key);
auto pAxisToleranceValue = filterArgs.value<float32>(k_AxisTolerance_Key);
auto pAngleToleranceValue = filterArgs.value<float32>(k_AngleTolerance_Key);
auto pFeaturePhasesArrayPathValue = filterArgs.value<DataPath>(k_FeaturePhasesArrayPath_Key);
auto pAvgQuatsArrayPathValue = filterArgs.value<DataPath>(k_AvgQuatsArrayPath_Key);
auto pFeatureIdsArrayPathValue = filterArgs.value<DataPath>(k_FeatureIdsArrayPath_Key);
Expand All @@ -128,21 +123,24 @@ Result<> MergeColoniesFilter::executeImpl(DataStructure& dataStructure, const Ar
{
MergeColoniesInputValues inputValues;

inputValues.UseNonContiguousNeighbors = filterArgs.value<bool>(k_UseNonContiguousNeighbors_Key);
inputValues.NonContiguousNeighborListArrayPath = filterArgs.value<DataPath>(k_NonContiguousNeighborListArrayPath_Key);
inputValues.ContiguousNeighborListArrayPath = filterArgs.value<DataPath>(k_ContiguousNeighborListArrayPath_Key);
inputValues.AxisTolerance = filterArgs.value<float32>(k_AxisTolerance_Key);
inputValues.AngleTolerance = filterArgs.value<float32>(k_AngleTolerance_Key);
inputValues.FeaturePhasesArrayPath = filterArgs.value<DataPath>(k_FeaturePhasesArrayPath_Key);
inputValues.AvgQuatsArrayPath = filterArgs.value<DataPath>(k_AvgQuatsArrayPath_Key);
inputValues.FeatureIdsArrayPath = filterArgs.value<DataPath>(k_FeatureIdsArrayPath_Key);
inputValues.CellPhasesArrayPath = filterArgs.value<DataPath>(k_CellPhasesArrayPath_Key);
inputValues.CrystalStructuresArrayPath = filterArgs.value<DataPath>(k_CrystalStructuresArrayPath_Key);
inputValues.CellParentIdsArrayName = filterArgs.value<DataPath>(k_CellParentIdsArrayName_Key);
inputValues.NewCellFeatureAttributeMatrixName = filterArgs.value<DataPath>(k_NewCellFeatureAttributeMatrixName_Key);
inputValues.FeatureParentIdsArrayName = filterArgs.value<DataPath>(k_FeatureParentIdsArrayName_Key);
inputValues.ActiveArrayName = filterArgs.value<DataPath>(k_ActiveArrayName_Key);

return MergeColonies(dataStructure, messageHandler, shouldCancel, &inputValues)();
inputValues.FeaturePhasesPath = filterArgs.value<DataPath>(k_FeaturePhasesArrayPath_Key);
inputValues.AvgQuatsPath = filterArgs.value<DataPath>(k_AvgQuatsArrayPath_Key);
inputValues.FeatureIdsPath = filterArgs.value<DataPath>(k_FeatureIdsArrayPath_Key);
inputValues.CellPhasesPath = filterArgs.value<DataPath>(k_CellPhasesArrayPath_Key);
inputValues.CrystalStructuresPath = filterArgs.value<DataPath>(k_CrystalStructuresArrayPath_Key);
inputValues.CellParentIdsPath = filterArgs.value<DataPath>(k_CellParentIdsArrayName_Key);
inputValues.CellFeatureAMPath = filterArgs.value<DataPath>(k_NewCellFeatureAttributeMatrixName_Key);
inputValues.FeatureParentIdsPath = filterArgs.value<DataPath>(k_FeatureParentIdsArrayName_Key);
inputValues.ActivePath = filterArgs.value<DataPath>(k_ActiveArrayName_Key);

GroupFeaturesInputValues gpInputValues;

gpInputValues.UseNonContiguousNeighbors = filterArgs.value<bool>(k_UseNonContiguousNeighbors_Key);
gpInputValues.NonContiguousNeighborListArrayPath = filterArgs.value<DataPath>(k_NonContiguousNeighborListArrayPath_Key);
gpInputValues.ContiguousNeighborListArrayPath = filterArgs.value<DataPath>(k_ContiguousNeighborListArrayPath_Key);

return MergeColonies(dataStructure, messageHandler, shouldCancel, &inputValues, &gpInputValues)();
}
} // namespace complex

0 comments on commit f5aca08

Please sign in to comment.