Skip to content

Commit

Permalink
Add sanity check and error message to Calculate Ensemble Statistics.
Browse files Browse the repository at this point in the history
Calculate Crystallographic Stats only works with Cubic High and Hexagonal High Laue classes.
Added sanity check and verbose error message if this situation occurs.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information
imikejackson committed Jan 11, 2022
1 parent 5186185 commit 10c5c2f
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,8 @@ void GenerateEnsembleStatistics::gatherODFStats()
for(size_t i = 1; i < numensembles; i++)
{
totalvol[i] = 0;
if(m_CrystalStructures[i] == EbsdLib::CrystalStructure::Hexagonal_High)
uint32_t laueClass = m_CrystalStructures[i];
if(laueClass == EbsdLib::CrystalStructure::Hexagonal_High)
{
dims = 36 * 36 * 12;
eulerodf[i] = FloatArrayType::CreateArray(dims, SIMPL::StringConstants::ODF, true);
Expand All @@ -995,7 +996,7 @@ void GenerateEnsembleStatistics::gatherODFStats()
eulerodf[i]->setValue(j, 0.0);
}
}
else if(m_CrystalStructures[i] == EbsdLib::CrystalStructure::Cubic_High)
else if(laueClass == EbsdLib::CrystalStructure::Cubic_High)
{
dims = 18 * 18 * 18;
eulerodf[i] = FloatArrayType::CreateArray(dims, SIMPL::StringConstants::ODF, true);
Expand All @@ -1004,6 +1005,25 @@ void GenerateEnsembleStatistics::gatherODFStats()
eulerodf[i]->setValue(j, 0.0);
}
}
else
{
QString errorMessage;
QTextStream out(&errorMessage);
out << "The option 'Calculate Crystallographic Statistics' only works with Laue classes [Cubic m3m] and [Hexagonal 6/mmm]. ";
out << "The offending phase was " << i << " with a value of " << QString::fromStdString(m_OrientationOps[laueClass]->getSymmetryName());
out << ".\nThe following Laue classes were also found [Phase #] Laue Class:\n";
for(size_t e = 1; e < numensembles; e++)
{
uint32_t lc = m_CrystalStructures[e];
out << " [" << QString::number(e) << "] " << QString::fromStdString(m_OrientationOps[lc]->getSymmetryName());
if(e < numensembles - 1)
{
out << "\n";
}
}
setErrorCondition(-3015, errorMessage);
return;
}
}
for(size_t i = 1; i < numfeatures; i++)
{
Expand Down Expand Up @@ -1402,6 +1422,10 @@ void GenerateEnsembleStatistics::execute()
{
gatherODFStats();
}
if(getErrorCode() < 0)
{
return;
}
if(m_CalculateMDF)
{
gatherMDFStats();
Expand Down

0 comments on commit 10c5c2f

Please sign in to comment.