Skip to content

Commit 08fb0c4

Browse files
authored
BUG: Compute Feature Phases Warnings Consolidated (#1455)
Compute Feature Phases warnings consolidated
1 parent b34409d commit 08fb0c4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/Plugins/SimplnxCore/src/SimplnxCore/Filters/ComputeFeaturePhasesFilter.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
#include "simplnx/Parameters/AttributeMatrixSelectionParameter.hpp"
88
#include "simplnx/Parameters/DataGroupCreationParameter.hpp"
99
#include "simplnx/Parameters/DataObjectNameParameter.hpp"
10-
11-
#include "simplnx/Utilities/SIMPLConversion.hpp"
12-
1310
#include "simplnx/Utilities/DataArrayUtilities.hpp"
11+
#include "simplnx/Utilities/SIMPLConversion.hpp"
1412

1513
using namespace nx::core;
1614

@@ -134,7 +132,7 @@ Result<> ComputeFeaturePhasesFilter::executeImpl(DataStructure& dataStructure, c
134132

135133
usize totalPoints = featureIds.getNumberOfTuples();
136134
std::map<int32, int32> featureMap;
137-
std::map<int32, int32> warningMap;
135+
std::set<int32> warnFeatures;
138136

139137
for(usize i = 0; i < totalPoints; i++)
140138
{
@@ -149,23 +147,25 @@ Result<> ComputeFeaturePhasesFilter::executeImpl(DataStructure& dataStructure, c
149147
int32 curPhaseVal = featureMap[gnum];
150148
if(curPhaseVal != cellPhases[i])
151149
{
152-
auto [iter, insertSuccess] = warningMap.insert({gnum, 1});
153-
if(!insertSuccess)
154-
{
155-
iter->second += 1;
156-
}
150+
warnFeatures.insert(gnum);
157151
}
158152
featurePhases[gnum] = cellPhases[i];
159153
}
160154

161155
Result<> result;
162-
if(!warningMap.empty())
156+
if(!warnFeatures.empty())
163157
{
164-
result.warnings().push_back(Warning{-500, "Elements from some features did not all have the same phase ID. The last phase ID copied into each feature will be used."});
165-
for(auto&& [key, value] : warningMap)
158+
std::string warnStr = "Elements from some features did not all have the same phase ID. The last phase ID copied into each feature will be used. Effected Phase Features: ";
159+
usize position = 0;
160+
for(auto value : warnFeatures)
166161
{
167-
result.warnings().push_back(Warning{-500, fmt::format("Phase Feature {} created {} warnings.", key, value)});
162+
warnStr.append(std::to_string(value));
163+
if(++position != warnFeatures.size())
164+
{
165+
warnStr.append(", ");
166+
}
168167
}
168+
result.warnings().push_back(Warning{-500, std::move(warnStr)});
169169
}
170170

171171
return result;

0 commit comments

Comments
 (0)