本文整理汇总了C++中VoxelDataContainer::getOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::getOrigin方法的具体用法?C++ VoxelDataContainer::getOrigin怎么用?C++ VoxelDataContainer::getOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::getOrigin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeCellData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeCellData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
int64_t volDims[3] =
{ m->getXPoints(), m->getYPoints(), m->getZPoints() };
float spacing[3] =
{ m->getXRes(), m->getYRes(), m->getZRes() };
float origin[3] =
{ 0.0f, 0.0f, 0.0f };
m->getOrigin(origin);
writeCellXdmfGridHeader(origin, spacing, volDims);
// Get the name of the .dream3d file that we are writing to:
ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
std::vector<char> nameBuffer(nameSize, 0);
nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);
std::string hdfFileName(&(nameBuffer.front()), nameSize);
hdfFileName = MXAFileInfo::filename(hdfFileName);
std::string xdmfGroupPath = std::string(":/") + VoxelDataContainer::ClassName() + std::string("/") + H5_CELL_DATA_GROUP_NAME;
// Write the Voxel Data
err = H5Utilities::createGroupsFromPath(H5_CELL_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
setErrorCondition(-63);
notifyErrorMessage(ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
hid_t cellGroupId = H5Gopen(dcGid, H5_CELL_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error writing string attribute to HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
setErrorCondition(-64);
notifyErrorMessage(ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
NameListType names = m->getCellArrayNameList();
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
ss.str("");
ss << "Writing Cell Data '" << *iter << "' to HDF5 File" << std::endl;
notifyStatusMessage(ss.str());
IDataArray::Pointer array = m->getCellData(*iter);
err = array->writeH5Data(cellGroupId);
if(err < 0)
{
ss.str("");
ss << "Error writing array '" << *iter << "' to the HDF5 File";
notifyErrorMessage(ss.str(), err);
setErrorCondition(err);
H5Gclose(cellGroupId); // Close the Cell Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
array->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Cell)");
}
H5Gclose(cellGroupId); // Close the Cell Group
writeXdmfGridFooter("Cell Data");
return err;
}
示例2: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VoxelDataContainerWriter::execute()
{
int err = 0;
std::stringstream ss;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The Voxel DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
dataCheck(false, 1, 1, 1);
hid_t dcGid = -1;
// Create the HDF5 Group for the Data Container
err = H5Utilities::createGroupsFromPath(DREAM3D::HDF5::VoxelDataContainerName.c_str(), m_HdfFileId);
if (err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << DREAM3D::HDF5::VoxelDataContainerName << std::endl;
setErrorCondition(-60);
notifyErrorMessage( ss.str(), err);
return;
}
dcGid = H5Gopen(m_HdfFileId, DREAM3D::HDF5::VoxelDataContainerName.c_str(), H5P_DEFAULT );
if (dcGid < 0)
{
ss.str("");
ss << "Error opening Group " << DREAM3D::HDF5::VoxelDataContainerName << std::endl;
setErrorCondition(-61);
notifyErrorMessage( ss.str(), err);
return;
}
// This just writes the header information
int64_t volDims[3] =
{ m->getXPoints(), m->getYPoints(), m->getZPoints() };
float spacing[3] =
{ m->getXRes(), m->getYRes(), m->getZRes() };
float origin[3] =
{ 0.0f, 0.0f, 0.0f };
m->getOrigin(origin);
err = writeMetaInfo(DREAM3D::HDF5::VoxelDataContainerName, volDims, spacing, origin);
if (err < 0)
{
ss.str("");
ss << ":Error Writing header information to output file" << std::endl;
setErrorCondition(-62);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeVertexData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeEdgeData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeFaceData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeCellData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeFieldData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
}
err = writeEnsembleData(dcGid);
if (err < 0)
{
H5Gclose(dcGid); // Close the Data Container Group
return;
//.........这里部分代码省略.........