本文整理汇总了C++中idataarray::Pointer::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetSize方法的具体用法?C++ Pointer::GetSize怎么用?C++ Pointer::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetName
/**
* @brief
* @param parentId
* @return
*/
virtual int readH5Data(hid_t parentId)
{
int err = 0;
this->Resize(0);
IDataArray::Pointer p = H5DataArrayReader::readIDataArray(parentId, GetName());
if (p.get() == NULL)
{
return -1;
}
this->NumberOfComponents = p->GetNumberOfComponents();
this->Size = p->GetSize();
this->MaxId = (Size == 0) ? 0 : Size -1;
this->Array = reinterpret_cast<T*>(p->GetVoidPointer(0));
p->releaseOwnership();
return err;
}
示例2: writeFieldData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeFieldData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
#if WRITE_FIELD_XDMF
// 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_FIELD_DATA_GROUP_NAME;
#endif
int64_t volDims[3] = { 0,0,0 };
// Write the Field Data
err = H5Utilities::createGroupsFromPath(H5_FIELD_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
std::cout << "Error creating HDF Group " << H5_FIELD_DATA_GROUP_NAME << std::endl;
return err;
}
err = H5Lite::writeStringAttribute(dcGid, H5_FIELD_DATA_GROUP_NAME, H5_NAME, H5_FIELD_DATA_DEFAULT);
if(err < 0)
{
return err;
}
hid_t fieldGroupId = H5Gopen(dcGid, H5_FIELD_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error opening field Group " << H5_FIELD_DATA_GROUP_NAME << std::endl;
setErrorCondition(-65);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
size_t total = 0;
typedef std::vector<IDataArray*> VectorOfIDataArrays_t;
VectorOfIDataArrays_t neighborListArrays;
NameListType names = m->getFieldArrayNameList();
if (names.size() > 0)
{
IDataArray::Pointer array = m->getFieldData(names.front());
total = array->GetSize();
volDims[0] = total;
volDims[1] = 1;
volDims[2] = 1;
#if WRITE_FIELD_XDMF
ss.str("");
ss << "Field Data (" << total << ")";
writeFieldXdmfGridHeader(total, ss.str());
#endif
}
// Now loop over all the field data and write it out, possibly wrapping it with XDMF code also.
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
IDataArray::Pointer array = m->getFieldData(*iter);
if (array->getTypeAsString().compare(NeighborList<int>::ClassName()) == 0)
{
neighborListArrays.push_back(array.get());
}
else if (NULL != array.get())
{
err = array->writeH5Data(fieldGroupId);
if(err < 0)
{
ss.str("");
ss << "Error writing field array '" << (*iter).c_str() << "' to the HDF5 File";
notifyErrorMessage( ss.str(), err);
setErrorCondition(err);
H5Gclose(fieldGroupId); // Close the Cell Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
#if WRITE_FIELD_XDMF
array->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Field)");
#endif
}
}
#if WRITE_FIELD_XDMF
if (names.size() > 0)
{
writeXdmfGridFooter("Field Data");
}
#endif
//.........这里部分代码省略.........