本文整理汇总了C++中VoxelDataContainer::addEnsembleData方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::addEnsembleData方法的具体用法?C++ VoxelDataContainer::addEnsembleData怎么用?C++ VoxelDataContainer::addEnsembleData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::addEnsembleData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: if
//.........这里部分代码省略.........
addErrorMessage(getHumanLabel(), ss.str(), -1);
return;
}
int64_t dims[3];
float res[3];
reader->getDimsAndResolution(dims[0], dims[1], dims[2], res[0], res[1], res[2]);
/* Sanity check what we are trying to load to make sure it can fit in our address space.
* Note that this does not guarantee the user has enough left, just that the
* size of the volume can fit in the address space of the program
*/
#if (CMP_SIZEOF_SSIZE_T==4)
int64_t max = std::numeric_limits<size_t>::max();
#else
int64_t max = std::numeric_limits<int64_t>::max();
#endif
if(dims[0] * dims[1] * dims[2] > max)
{
err = -1;
std::stringstream s;
s << "The total number of elements '" << (dims[0] * dims[1] * dims[2]) << "' is greater than this program can hold. Try the 64 bit version.";
setErrorCondition(err);
addErrorMessage(getHumanLabel(), s.str(), -1);
return;
}
if(dims[0] > max || dims[1] > max || dims[2] > max)
{
err = -1;
std::stringstream s;
s << "One of the dimensions is greater than the max index for this sysem. Try the 64 bit version.";
s << " dim[0]=" << dims[0] << " dim[1]=" << dims[1] << " dim[2]=" << dims[2];
setErrorCondition(err);
addErrorMessage(getHumanLabel(), s.str(), -1);
return;
}
/* ************ End Sanity Check *************************** */
size_t dcDims[3] =
{ dims[0], dims[1], dims[2] };
m->setDimensions(dcDims);
m->setResolution(res);
m->setOrigin(0.0f, 0.0f, 0.0f);
}
H5EbsdVolumeReader::Pointer reader;
std::vector<std::string> names;
if (m_Manufacturer == Ebsd::TSL)
{
AngFields fields;
reader = H5AngVolumeReader::New();
names = fields.getFilterFields<std::vector<std::string> > ();
}
else if (m_Manufacturer == Ebsd::HKL)
{
CtfFields fields;
reader = H5CtfVolumeReader::New();
names = fields.getFilterFields<std::vector<std::string> > ();
}
else if (m_Manufacturer == Ebsd::HEDM)
{
MicFields fields;
reader = H5MicVolumeReader::New();
names = fields.getFilterFields<std::vector<std::string> > ();
}
else
{
ss << getHumanLabel() << ": Original Data source could not be determined. It should be TSL or HKL";
setErrorCondition(-1);
addErrorMessage(getHumanLabel(), ss.str(), -1);
return;
}
for (size_t i = 0; i < names.size(); ++i)
{
if (reader->getPointerType(names[i]) == Ebsd::Int32)
{
Int32ArrayType::Pointer array = Int32ArrayType::CreateArray(voxels, names[i]);
m->addCellData(names[i], array);
}
else if (reader->getPointerType(names[i]) == Ebsd::Float)
{
FloatArrayType::Pointer array = FloatArrayType::CreateArray(voxels, names[i]);
m->addCellData(names[i], array);
}
}
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, CellEulerAngles, ss, float, FloatArrayType, 0, voxels, 3)
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, CellPhases, ss, int32_t, Int32ArrayType, 0, voxels, 1)
typedef DataArray<unsigned int> XTalStructArrayType;
CREATE_NON_PREREQ_DATA(m, DREAM3D, EnsembleData, CrystalStructures, ss, unsigned int, XTalStructArrayType, Ebsd::CrystalStructure::UnknownCrystalStructure, ensembles, 1)
CREATE_NON_PREREQ_DATA(m, DREAM3D, EnsembleData, LatticeConstants, ss, float, FloatArrayType, 0.0, ensembles, 6)
StringDataArray::Pointer materialNames = StringDataArray::CreateArray(1, DREAM3D::EnsembleData::MaterialName);
m->addEnsembleData( DREAM3D::EnsembleData::MaterialName, materialNames);
ADD_HELP_INDEX_ENTRY(EnsembleData, MaterialName, XTalStructArrayType, 1);
}