Permalink
Browse files

Rewrite EnsembleInfo and supporting classes.

  • Loading branch information...
imikejackson committed Dec 1, 2017
1 parent fa2371b commit 06a99a92428edffd4237492667bf48f403916d7f
@@ -393,16 +393,16 @@ void EnsembleInfoTableModel::getTableData(QVector<int>& crystalStructures, QVect
QVector<int> phases;
QVector<QString> names;
int count = m_EnsembleInfo.size();
EnsembleInfo::CrystalStructureType* crystalStructurePtr = m_EnsembleInfo.getCrystalStructureArray()->getPointer(0);
PhaseType::EnumType* phaseTypePtr = m_EnsembleInfo.getPhaseTypeArray()->getPointer(0);
StringDataArray::Pointer phaseNamePtr = m_EnsembleInfo.getPhaseNameArray();
size_t count = m_EnsembleInfo.size();
std::vector<EnsembleInfo::CrystalStructure> srcXtals = m_EnsembleInfo.getCrystalStructureArray();
std::vector<PhaseType::Type> srcPhaseTypes = m_EnsembleInfo.getPhaseTypeArray();
std::vector<QString> srcPhaseNames = m_EnsembleInfo.getPhaseNameArray();
for(int i = 0; i < count; i++)
for(size_t i = 0; i < count; i++)
{
structures.push_back(static_cast<int>(crystalStructurePtr[i]));
phases.push_back(static_cast<int>(phaseTypePtr[i]));
names.push_back(phaseNamePtr->getValue(i));
structures.push_back(static_cast<int>(srcXtals[i]));
phases.push_back(static_cast<int>(srcPhaseTypes[i]));
names.push_back(srcPhaseNames[i]);
}
crystalStructures = structures;
@@ -100,8 +100,8 @@ void EnsembleInfoFilterParameter::readJson(const QJsonObject& json)
if(ensembleObj["CrystalStructure"].isDouble() && ensembleObj["PhaseType"].isDouble() && ensembleObj["PhaseName"].isString())
{
EnsembleInfo::CrystalStructureType crystalStructure = ensembleObj["CrystalStructure"].toInt();
PhaseType::EnumType phaseType = ensembleObj["PhaseType"].toInt();
EnsembleInfo::CrystalStructure crystalStructure = static_cast<EnsembleInfo::CrystalStructure>(ensembleObj["CrystalStructure"].toInt());
PhaseType::Type phaseType = static_cast<PhaseType::Type>(ensembleObj["PhaseType"].toInt());
QString phaseName = ensembleObj["PhaseName"].toString();
inputs.addValues(static_cast<EnsembleInfo::CrystalStructure>(crystalStructure), static_cast<PhaseType::Type>(phaseType), phaseName);
@@ -38,7 +38,7 @@
#include "SIMPLib/Common/Constants.h"
#include "SIMPLib/FilterParameters/AbstractFilterParametersReader.h"
#include "SIMPLib/FilterParameters/DataArraySelectionFilterParameter.h"
#include "SIMPLib/FilterParameters/DoubleFilterParameter.h"
#include "SIMPLib/FilterParameters/FloatFilterParameter.h"
#include "SIMPLib/FilterParameters/IntFilterParameter.h"
#include "SIMPLib/FilterParameters/SeparatorFilterParameter.h"
#include "SIMPLib/Geometry/ImageGeom.h"
@@ -82,7 +82,7 @@ BadDataNeighborOrientationCheck::~BadDataNeighborOrientationCheck()
void BadDataNeighborOrientationCheck::setupFilterParameters()
{
FilterParameterVector parameters;
parameters.push_back(SIMPL_NEW_DOUBLE_FP("Misorientation Tolerance (Degrees)", MisorientationTolerance, FilterParameter::Parameter, BadDataNeighborOrientationCheck));
parameters.push_back(SIMPL_NEW_FLOAT_FP("Misorientation Tolerance (Degrees)", MisorientationTolerance, FilterParameter::Parameter, BadDataNeighborOrientationCheck));
parameters.push_back(SIMPL_NEW_INTEGER_FP("Required Number of Neighbors", NumberOfNeighbors, FilterParameter::Parameter, BadDataNeighborOrientationCheck));
parameters.push_back(SeparatorFilterParameter::New("Cell Data", FilterParameter::RequiredArray));
{
@@ -164,7 +164,7 @@ void CreateEnsembleInfo::dataCheck()
} /* Now assign the raw pointer to data from the DataArray<T> object */
tempPath.update(getDataContainerName(), getCellEnsembleAttributeMatrixName(), getPhaseTypesArrayName());
m_PhaseTypesPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<uint32_t>, AbstractFilter, uint32_t>(
m_PhaseTypesPtr = getDataContainerArray()->createNonPrereqArrayFromPath<UInt32ArrayType, AbstractFilter, uint32_t>(
this, tempPath, static_cast<PhaseType::EnumType>(PhaseType::Type::Unknown), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if(nullptr != m_PhaseTypesPtr.lock().get()) /* Validate the Weak Pointer wraps a non-nullptr pointer to a DataArray<T> object */
{
@@ -205,7 +205,7 @@ void CreateEnsembleInfo::execute()
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
AttributeMatrix::Pointer cellensembleAttrMat = m->getAttributeMatrix(getCellEnsembleAttributeMatrixName());
int32_t numPhases = m_Ensemble.size();
size_t numPhases = m_Ensemble.size();
if(0 == numPhases) // Either the group name "EnsembleInfo" is incorrect or 0 was entered as the Number_Phases
{
@@ -215,14 +215,14 @@ void CreateEnsembleInfo::execute()
return;
}
DataArray<EnsembleInfo::CrystalStructureType>::Pointer crystalStructures = m_Ensemble.getCrystalStructureArray();
DataArray<PhaseType::EnumType>::Pointer phaseTypes = m_Ensemble.getPhaseTypeArray();
StringDataArray::Pointer phaseNames = m_Ensemble.getPhaseNameArray();
std::vector<EnsembleInfo::CrystalStructure> crystalStructures = m_Ensemble.getCrystalStructureArray();
std::vector<PhaseType::Type> phaseTypes = m_Ensemble.getPhaseTypeArray();
std::vector<QString> phaseNames = m_Ensemble.getPhaseNameArray();
for(int i = 0; i < numPhases; i++)
{
// Crystal Structure
uint32_t crystalStructure = crystalStructures->getValue(i);
uint32_t crystalStructure = static_cast<uint32_t>(crystalStructures[i]);
if(crystalStructure == Ebsd::CrystalStructure::UnknownCrystalStructure)
{
QString ss = QObject::tr("Incorrect crystal structure name '%1'").arg(crystalStructure);
@@ -234,7 +234,7 @@ void CreateEnsembleInfo::execute()
m_CrystalStructures[i + 1] = crystalStructure;
// Phase Type
uint32_t phaseType = phaseTypes->getValue(i);
uint32_t phaseType = static_cast<uint32_t>(phaseTypes[i]);
if(static_cast<PhaseType::Type>(phaseType) == PhaseType::Type::Unknown)
{
QString ss = QObject::tr("Incorrect phase type '%1'").arg(phaseType); // The phase type name was not found in the lookup table
@@ -246,7 +246,7 @@ void CreateEnsembleInfo::execute()
m_PhaseTypes[i + 1] = phaseType;
// Phase Name
QString phaseName = phaseNames->getValue(i);
QString phaseName = phaseNames[i];
if(phaseName.isEmpty())
{
QString ss = QObject::tr("Phase name cannot be empty'"); // The phase name was not found
@@ -40,7 +40,7 @@
#include "SIMPLib/FilterParameters/AbstractFilterParametersReader.h"
#include "SIMPLib/FilterParameters/ChoiceFilterParameter.h"
#include "SIMPLib/FilterParameters/DataArraySelectionFilterParameter.h"
#include "SIMPLib/FilterParameters/DoubleFilterParameter.h"
#include "SIMPLib/FilterParameters/FloatFilterParameter.h"
#include "SIMPLib/FilterParameters/LinkedBooleanFilterParameter.h"
#include "SIMPLib/FilterParameters/PhaseTypeSelectionFilterParameter.h"
#include "SIMPLib/FilterParameters/SeparatorFilterParameter.h"
@@ -158,7 +158,7 @@ void GenerateEnsembleStatistics::setupFilterParameters()
SIMPL_BIND_GETTER(GenerateEnsembleStatistics, this, PhaseTypeData),
"PhaseTypeArray", "PhaseCount", "CellEnsembleAttributeMatrixPath", phaseTypeStrings);
parameters.push_back(phaseType_parameter);
parameters.push_back(SIMPL_NEW_DOUBLE_FP("Size Correlation Resolution", SizeCorrelationResolution, FilterParameter::Parameter, GenerateEnsembleStatistics));
parameters.push_back(SIMPL_NEW_FLOAT_FP("Size Correlation Resolution", SizeCorrelationResolution, FilterParameter::Parameter, GenerateEnsembleStatistics));
parameters.push_back(SeparatorFilterParameter::New("Cell Feature Data", FilterParameter::RequiredArray));
{
DataArraySelectionFilterParameter::RequirementType req = DataArraySelectionFilterParameter::CreateCategoryRequirement(SIMPL::TypeNames::Int32, 1, AttributeMatrix::Category::Feature);

0 comments on commit 06a99a9

Please sign in to comment.