Skip to content

Commit

Permalink
Updates BlueQuartzSoftware#175 Changes to be able to read/write jsons…
Browse files Browse the repository at this point in the history
… for GPD
  • Loading branch information
EXPONENT\jtucker committed May 5, 2018
1 parent ba606eb commit f441405
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Source/SIMPLib/StatsData/PrecipitateStatsData.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class SIMPLib_EXPORT PrecipitateStatsData : public StatsData
SIMPL_INSTANCE_PROPERTY(VectorOfFloatArray, FeatureSizeDistribution)
SIMPL_INSTANCE_PROPERTY(uint32_t, FeatureSize_DistType)
SIMPL_INSTANCE_PROPERTY(RdfData::Pointer, RadialDistFunction)
SIMPL_INSTANCE_PROPERTY(QString, DistributionTypeCombo)

SIMPL_INSTANCE_PROPERTY(FloatArrayType::Pointer, BinNumbers)

Expand Down
4 changes: 4 additions & 0 deletions Source/SIMPLib/StatsData/PrimaryStatsData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void PrimaryStatsData::writeJson(QJsonObject& json)
avgSizeDist.insert(m_FeatureSizeDistribution[i]->getName(), m_FeatureSizeDistribution[i]->getValue(0));
}
json.insert(SIMPL::StringConstants::Feature_Size_Distribution, avgSizeDist);
json.insert(SIMPL::StringConstants::DistributionType, decodeDistributionType(getFeatureSize_DistType()));

// Write the Bin Numbers
if(nullptr == getBinNumbers().get())
Expand Down Expand Up @@ -280,6 +281,9 @@ void PrimaryStatsData::readJson(const QJsonObject& json)
setPhaseFraction(jsonValue.toDouble(0.0));
}
// Read the Feature Diameter Info
jsonValue = json[SIMPL::StringConstants::DistributionType];
setDistributionTypeCombo(jsonValue.toString());

float fVec3[3] = {0.0f, 0.0f, 0.0f};
if(ParseFloat3Vec(json, SIMPL::StringConstants::Feature_Diameter_Info, fVec3, 0.0) == -1)
{
Expand Down
2 changes: 2 additions & 0 deletions Source/SIMPLib/StatsData/PrimaryStatsData.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class SIMPLib_EXPORT PrimaryStatsData : public StatsData
*/
SIMPL_INSTANCE_PROPERTY(VectorOfFloatArray, FeatureSizeDistribution)
SIMPL_INSTANCE_PROPERTY(uint32_t, FeatureSize_DistType)
SIMPL_INSTANCE_PROPERTY(QString, DistributionTypeCombo)


SIMPL_INSTANCE_PROPERTY(FloatArrayType::Pointer, BinNumbers)

Expand Down
8 changes: 8 additions & 0 deletions Source/SIMPLib/StatsData/StatsData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ QString StatsData::decodeDistributionType(int disType)
case SIMPL::DistributionType::Beta:
disTypeStr = SIMPL::StringConstants::BetaDistribution;
break;
case SIMPL::DistributionType::Pareto:
disTypeStr = SIMPL::StringConstants::ParetoDistribution;
break;
case SIMPL::DistributionType::LogNormal:
disTypeStr = SIMPL::StringConstants::LogNormalDistribution;
break;
Expand Down Expand Up @@ -260,6 +263,11 @@ int StatsData::EncodeDistributionType(QString distTypeName)
{
distType = SIMPL::DistributionType::LogNormal;
}
else if(distTypeName == SIMPL::StringConstants::ParetoDistribution)
{
distType = SIMPL::DistributionType::Pareto;
}

else if(distTypeName == SIMPL::StringConstants::UnknownDistribution)
{
distType = SIMPL::DistributionType::UnknownDistributionType;
Expand Down

0 comments on commit f441405

Please sign in to comment.