本文整理汇总了C++中VoxelDataContainer::getEnsembleData方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::getEnsembleData方法的具体用法?C++ VoxelDataContainer::getEnsembleData怎么用?C++ VoxelDataContainer::getEnsembleData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::getEnsembleData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeEnsembleData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeEnsembleData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
// Write the Ensemble data
err = H5Utilities::createGroupsFromPath(H5_ENSEMBLE_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << H5_ENSEMBLE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-66);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
err = H5Lite::writeStringAttribute(dcGid, H5_ENSEMBLE_DATA_GROUP_NAME, H5_NAME, H5_ENSEMBLE_DATA_DEFAULT);
hid_t ensembleGid = H5Gopen(dcGid, H5_ENSEMBLE_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error opening ensemble Group " << H5_ENSEMBLE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-67);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
NameListType names = m->getEnsembleArrayNameList();
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
IDataArray::Pointer array = m->getEnsembleData(*iter);
err = array->writeH5Data(ensembleGid);
if(err < 0)
{
ss.str("");
ss << "Error writing Ensemble array '" << *iter << "' to the HDF5 File";
notifyErrorMessage( ss.str(), err);
setErrorCondition(err);
H5Gclose(ensembleGid); // Close the Cell Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
}
H5Gclose(ensembleGid);
return err;
}
示例2: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindAxisODF::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
int err = 0;
GET_PREREQ_DATA(m, DREAM3D, FieldData, AxisEulerAngles, ss, -301, float, FloatArrayType, fields, 3)
TEST_PREREQ_DATA(m, DREAM3D, FieldData, SurfaceFields, err, -302, bool, BoolArrayType, fields, 1)
if(err == -302)
{
setErrorCondition(0);
FindSurfaceGrains::Pointer find_surfacefields = FindSurfaceGrains::New();
find_surfacefields->setObservers(this->getObservers());
find_surfacefields->setVoxelDataContainer(getVoxelDataContainer());
if(preflight == true) find_surfacefields->preflight();
if(preflight == false) find_surfacefields->execute();
}
GET_PREREQ_DATA(m, DREAM3D, FieldData, SurfaceFields, ss, -302, bool, BoolArrayType, fields, 1)
err = 0;
TEST_PREREQ_DATA(m, DREAM3D, FieldData, FieldPhases, err, -303, int32_t, Int32ArrayType, fields, 1)
if(err == -303)
{
setErrorCondition(0);
FindGrainPhases::Pointer find_grainphases = FindGrainPhases::New();
find_grainphases->setObservers(this->getObservers());
find_grainphases->setVoxelDataContainer(getVoxelDataContainer());
if(preflight == true) find_grainphases->preflight();
if(preflight == false) find_grainphases->execute();
}
GET_PREREQ_DATA(m, DREAM3D, FieldData, FieldPhases, ss, -303, int32_t, Int32ArrayType, fields, 1)
typedef DataArray<unsigned int> PhaseTypeArrayType;
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, PhaseTypes, ss, -307, unsigned int, PhaseTypeArrayType, ensembles, 1)
m_StatsDataArray = StatsDataArray::SafeObjectDownCast<IDataArray*, StatsDataArray*>(m->getEnsembleData(DREAM3D::EnsembleData::Statistics).get());
if(m_StatsDataArray == NULL)
{
StatsDataArray::Pointer p = StatsDataArray::New();
m_StatsDataArray = p.get();
m_StatsDataArray->fillArrayWithNewStatsData(ensembles, m_PhaseTypes);
m->addEnsembleData(DREAM3D::EnsembleData::Statistics, p);
}
}
示例3: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindAxisODF::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
dataCheck(false, m->getTotalPoints(), m->getNumFieldTuples(), m->getNumEnsembleTuples());
if(getErrorCondition() < 0)
{
return;
}
StatsDataArray& statsDataArray = *m_StatsDataArray;
typedef DataArray<unsigned int> XTalType;
XTalType* crystruct = XTalType::SafeObjectDownCast<IDataArray*, XTalType*>(m->getEnsembleData(DREAM3D::EnsembleData::CrystalStructures).get());
float r1, r2, r3;
int bin;
std::vector<FloatArrayType::Pointer> axisodf;
std::vector<float> totalaxes;
size_t numXTals = crystruct->GetNumberOfTuples();
axisodf.resize(numXTals);
totalaxes.resize(numXTals);
for (size_t i = 1; i < numXTals; i++)
{
totalaxes[i] = 0.0;
axisodf[i] = FloatArrayType::CreateArray((36 * 36 * 36), DREAM3D::HDF5::AxisOrientation);
for (int j = 0; j < (36 * 36 * 36); j++)
{
axisodf[i]->SetValue(j, 0.0);
}
}
size_t numgrains = m->getNumFieldTuples();
for (size_t i = 0; i < numgrains; i++)
{
if(m_SurfaceFields[i] == false)
{
totalaxes[m_FieldPhases[i]]++;
}
}
for (size_t i = 1; i < numgrains; i++)
{
float ea1 = m_AxisEulerAngles[3 * i];
float ea2 = m_AxisEulerAngles[3 * i + 1];
float ea3 = m_AxisEulerAngles[3 * i + 2];
if(m_SurfaceFields[i] == 0)
{
OrientationMath::EulerToRod( ea1, ea2, ea3, r1, r2, r3);
m_OrientationOps[Ebsd::CrystalStructure::OrthoRhombic]->getODFFZRod(r1, r2, r3);
bin = m_OrientationOps[Ebsd::CrystalStructure::OrthoRhombic]->getOdfBin(r1, r2, r3);
axisodf[m_FieldPhases[i]]->SetValue(bin, (axisodf[m_FieldPhases[i]]->GetValue(bin) + static_cast<float>((1.0 / totalaxes[m_FieldPhases[i]]))));
}
}
// int err;
for (size_t i = 1; i < numXTals; i++)
{
if(m_PhaseTypes[i] == DREAM3D::PhaseType::PrimaryPhase)
{
PrimaryStatsData* pp = PrimaryStatsData::SafePointerDownCast(statsDataArray[i].get());
pp->setAxisOrientation(axisodf[i]);
}
if(m_PhaseTypes[i] == DREAM3D::PhaseType::PrecipitatePhase)
{
PrecipitateStatsData* pp = PrecipitateStatsData::SafePointerDownCast(statsDataArray[i].get());
pp->setAxisOrientation(axisodf[i]);
}
if(m_PhaseTypes[i] == DREAM3D::PhaseType::TransformationPhase)
{
TransformationStatsData* tp = TransformationStatsData::SafePointerDownCast(statsDataArray[i].get());
tp->setAxisOrientation(axisodf[i]);
}
}
notifyStatusMessage("Completed");
}