本文整理汇总了C++中idataarray::Pointer类的典型用法代码示例。如果您正苦于以下问题:C++ Pointer类的具体用法?C++ Pointer怎么用?C++ Pointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addEdgeData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VoxelDataContainer::addEdgeData(const std::string &name, IDataArray::Pointer data)
{
if (data->GetName().compare(name) != 0)
{
std::cout << "Adding Edge array with different array name than key name" << std::endl;
std::cout << "Key name: " << name << std::endl;
std::cout << "Array Name:" << data->GetName() << std::endl;
data->SetName(name);
}
m_EdgeData[name] = data;
m_NumEdgeTuples = data->GetNumberOfTuples();
}
示例2: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ClearData::execute()
{
int err = 0;
setErrorCondition(err);
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;
}
size_t udims[3] =
{ 0, 0, 0 };
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] =
{ static_cast<DimType>(udims[0]), static_cast<DimType>(udims[1]), static_cast<DimType>(udims[2]), };
int index;
std::list<std::string> voxelArrayNames = m->getCellArrayNameList();
for (int k = m_ZMin; k < m_ZMax+1; k++)
{
for (int j = m_YMin; j < m_YMax+1; j++)
{
for (int i = m_XMin; i < m_XMax+1; i++)
{
index = (k * dims[0] * dims[1]) + (j * dims[0]) + i;
for (std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
std::string name = *iter;
IDataArray::Pointer p = m->getCellData(*iter);
p->InitializeTuple(index,0);
}
}
}
}
notifyStatusMessage("Completed");
}
示例3: deepCopy
/**
* @brief deepCopy
* @param forceNoAllocate
* @return
*/
virtual IDataArray::Pointer deepCopy(bool forceNoAllocate = false)
{
IDataArray::Pointer daCopy = createNewArray(getNumberOfTuples(), getComponentDimensions(), getName(), m_IsAllocated);
if(m_IsAllocated == true && forceNoAllocate == false)
{
T* src = getPointer(0);
void* dest = daCopy->getVoidPointer(0);
size_t totalBytes = (getNumberOfTuples() * getNumberOfComponents() * sizeof(T));
::memcpy(dest, src, totalBytes);
}
return daCopy;
}
示例4: addFieldData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SurfaceMeshDataContainer::addFieldData(const std::string &name, IDataArray::Pointer data)
{
if (data->GetName().compare(name) != 0)
{
std::cout << "Adding Field array with different array name than key name" << std::endl;
std::cout << "Key name: " << name << std::endl;
std::cout << "Array Name:" << data->GetName() << std::endl;
data->SetName(name);
}
m_FieldData[name] = data;
m_NumFieldTuples = data->GetNumberOfTuples();
}
示例5: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VisualizeGBCDPoleFigure::dataCheck()
{
setErrorCondition(0);
getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getGBCDArrayPath().getDataContainerName());
if (getOutputFile().isEmpty() == true)
{
QString ss = QObject::tr( "The output file must be set");
setErrorCondition(-1000);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
QFileInfo fi(getOutputFile());
QDir parentPath = fi.path();
if (parentPath.exists() == false && getInPreflight())
{
QString ss = QObject::tr( "The directory path for the output file does not exist. DREAM.3D will attempt to create this path during execution of the filter");
notifyWarningMessage(getHumanLabel(), ss, -1);
}
if (fi.suffix().compare("") == 0)
{
setOutputFile(getOutputFile().append(".vtk"));
}
QVector<size_t> cDims(1, 1);
m_CrystalStructuresPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<unsigned int>, AbstractFilter>(this, getCrystalStructuresArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_CrystalStructuresPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{
m_CrystalStructures = m_CrystalStructuresPtr.lock()->getPointer(0);
} /* Now assign the raw pointer to data from the DataArray<T> object */
IDataArray::Pointer tmpGBCDPtr = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, getGBCDArrayPath());
if(getErrorCondition() < 0) { return; }
if (NULL != tmpGBCDPtr.get())
{
QVector<size_t> cDims = tmpGBCDPtr->getComponentDimensions();
m_GBCDPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<double>, AbstractFilter>(this, getGBCDArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_GBCDPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_GBCD = m_GBCDPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
if (NULL != m_GBCDPtr.lock().get() && getPhaseOfInterest() >= m_GBCDPtr.lock()->getNumberOfTuples())
{
QString ss = QObject::tr("The phase index is larger than the number of Ensembles").arg(ClassName());
setErrorCondition(-1);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
}
示例6:
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int AttributeMatrix::writeAttributeArraysToHDF5(hid_t parentId)
{
int err;
for(QMap<QString, IDataArray::Pointer>::iterator iter = m_AttributeArrays.begin(); iter != m_AttributeArrays.end(); ++iter)
{
IDataArray::Pointer d = iter.value();
err = d->writeH5Data(parentId, m_TupleDims);
if(err < 0)
{
return err;
}
}
return 0;
}
示例7: 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;
}
示例8: renameFieldData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
bool VoxelDataContainer::renameFieldData(const std::string &oldname, const std::string &newname)
{
std::map<std::string, IDataArray::Pointer>::iterator it;
it = m_FieldData.find(oldname);
if ( it == m_FieldData.end() )
{
return false;
}
IDataArray::Pointer p = (*it).second;
p->SetName(newname);
removeFieldData(oldname);
addFieldData(newname, p);
return true;
}
示例9: writeFaceData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeFaceData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
// Write the Voxel Data
err = H5Utilities::createGroupsFromPath(H5_FACE_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << H5_FACE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-63);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
hid_t FaceGroupId = H5Gopen(dcGid, H5_FACE_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error writing string attribute to HDF Group " << H5_FACE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-64);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
NameListType names = m->getFaceArrayNameList();
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
ss.str("");
ss << "Writing Face Data '" << *iter << "' to HDF5 File" << std::endl;
notifyStatusMessage(ss.str());
IDataArray::Pointer array = m->getFaceData(*iter);
err = array->writeH5Data(FaceGroupId);
if(err < 0)
{
ss.str("");
ss << "Error writing array '" << *iter << "' to the HDF5 File";
notifyErrorMessage( ss.str(), err);
setErrorCondition(err);
H5Gclose(FaceGroupId); // Close the Face Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
}
H5Gclose(FaceGroupId); // Close the Face Group
return err;
}
示例10: writeCellVectorData
void writeCellVectorData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, bool writeConformalMesh, const QString& vtkAttributeType,
FILE* vtkFile, int nT)
{
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString buf;
QTextStream ss(&buf);
if (NULL != data.get())
{
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "%s %s %s\n", vtkAttributeType.toLatin1().data(), dataName.toLatin1().data(), dataType.toLatin1().data());
for(int i = 0; i < nT; ++i)
{
T s0 = 0x00;
T s1 = 0x00;
T s2 = 0x00;
if(writeBinaryData == true)
{
s0 = static_cast<T>(m[i * 3 + 0]);
s1 = static_cast<T>(m[i * 3 + 1]);
s2 = static_cast<T>(m[i * 3 + 2]);
SIMPLib::Endian::FromSystemToBig::convert(s0);
SIMPLib::Endian::FromSystemToBig::convert(s1);
SIMPLib::Endian::FromSystemToBig::convert(s2);
fwrite(&s0, sizeof(T), 1, vtkFile);
fwrite(&s1, sizeof(T), 1, vtkFile);
fwrite(&s2, sizeof(T), 1, vtkFile);
if(false == writeConformalMesh)
{
fwrite(&s0, sizeof(T), 1, vtkFile);
fwrite(&s1, sizeof(T), 1, vtkFile);
fwrite(&s2, sizeof(T), 1, vtkFile);
}
}
else
{
ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";
if(false == writeConformalMesh)
{
ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";
}
fprintf(vtkFile, "%s ", buf.toLatin1().data());
buf.clear();
if (i % 25 == 0) { fprintf(vtkFile, "\n"); }
}
}
}
}
示例11: validateAttributeArraySizes
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
bool AttributeMatrix::validateAttributeArraySizes()
{
int64_t arraySize = 0;
int64_t matrixSize = getNumTuples();
for(QMap<QString, IDataArray::Pointer>::iterator iter = m_AttributeArrays.begin(); iter != m_AttributeArrays.end(); ++iter)
{
IDataArray::Pointer d = iter.value();
arraySize = d->getNumberOfTuples();
if(arraySize != matrixSize)
{
return false;
}
}
return true;
}
示例12: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void WriteImages::dataCheck()
{
setErrorCondition(0);
getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getColorsArrayPath().getDataContainerName());
QDir dir(getOutputPath());
if (getOutputPath().isEmpty() == true)
{
setErrorCondition(-1003);
notifyErrorMessage(getHumanLabel(), "The output directory must be set", getErrorCondition());
}
else if (dir.exists() == false)
{
QString ss = QObject::tr("The output directory path does not exist. DREAM.3D will attempt to create this path during execution");
notifyWarningMessage(getHumanLabel(), ss, -1);
}
IDataArray::Pointer iDa = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, getColorsArrayPath());
if (getErrorCondition() < 0) { return; }
QVector<size_t> cDims = iDa->getComponentDimensions();
if (cDims[0] == 1)
{
m_ColorsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<uint8_t>, AbstractFilter>(this, getColorsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_ColorsPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_Colors = m_ColorsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
else if (cDims[0] == 3)
{
m_ColorsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<uint8_t>, AbstractFilter>(this, getColorsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_ColorsPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_Colors = m_ColorsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
else if (cDims[0] == 4)
{
m_ColorsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<uint8_t>, AbstractFilter>(this, getColorsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_ColorsPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_Colors = m_ColorsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
else
{
setErrorCondition(-1006);
notifyErrorMessage(getHumanLabel(), "Number of components must be 1 (grayscale), 3 (RGB) or 4 (ARGB) arrays", getErrorCondition());
}
}
示例13: if
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::vector<int32_t> TriangleOps::findAdjacentTriangles(SurfaceMeshDataContainer* sm,
int32_t triangleIndex,
int32_t label)
{
std::vector<int32_t> adjacentTris;
// Get the master list of triangles for the mesh
DREAM3D::SurfaceMesh::FaceList_t::Pointer facesPtr = sm->getFaces();
// DREAM3D::SurfaceMesh::Face_t* faces = facesPtr->GetPointer(0);
IDataArray::Pointer flPtr = sm->getFaceData(DREAM3D::FaceData::SurfaceMeshFaceLabels);
DataArray<int32_t>* faceLabelsPtr = DataArray<int32_t>::SafePointerDownCast(flPtr.get());
int32_t* faceLabels = faceLabelsPtr->GetPointer(0);
// Get the Triangle Neighbor Structure
MeshFaceNeighbors::Pointer triNeighbors = sm->getMeshFaceNeighborLists();
// For the specific triangle that was passed, get its neighbor list
uint16_t count = triNeighbors->getNumberOfFaces(triangleIndex);
int32_t* nList = triNeighbors->getNeighborListPointer(triangleIndex);
if (count < 3)
{
std::cout << "Triangle Neighbor List had only " << count << " neighbors. Must be at least 3." << std::endl;
BOOST_ASSERT(false);
}
else if (count == 3) // This triangle only has 3 neighbors so we are assuming all three have the same label set.
{
for (uint16_t n = 0; n < count; ++n)
{
adjacentTris.push_back(nList[n]);
}
}
else
{
// Iterate over the indices to find triangles that match the label and are NOT the current triangle index
for (uint16_t n = 0; n < count; ++n)
{
int32_t fl_0 = faceLabels[nList[n]*2];
int32_t fl_1 = faceLabels[nList[n]*2 + 1];
if ( (fl_0 == label || fl_1 == label) && (nList[n] != triangleIndex) )
{
// std::cout << " Found Adjacent Triangle: " << t->tIndex << std::endl;
adjacentTris.push_back(nList[n]);
// ++index;
}
}
}
return adjacentTris;
}
示例14: copyData
/**
* @brief copyData This method copies all data from the <b>sourceArray</b> into
* the current array starting at the target destination tuple offset value.
*
* For example if the DataArray has 10 tuples and the destTupleOffset = 5 then
* then source data will be copied into the destination array starting at
* destination tuple 5. In psuedo code it would be the following:
* @code
* destArray[5] = sourceArray[0];
* destArray[6] = sourceArray[1];
* .....
* @endcode
* @param destTupleOffset
* @param sourceArray
* @return
*/
bool copyData(size_t destTupleOffset, IDataArray::Pointer sourceArray)
{
if(destTupleOffset >= m_Array.size()) { return false; }
if(!sourceArray->isAllocated()) { return false; }
if(sourceArray->getNumberOfComponents() != getNumberOfComponents()) { return false; }
Self* source = dynamic_cast<Self*>(sourceArray.get());
size_t sourceNTuples = source->getNumberOfTuples();
for(size_t i = 0; i < sourceNTuples; i++)
{
m_Array[destTupleOffset + i] = source->getValue(i);
}
return true;
}
示例15: extractStatsData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void BoundaryPhaseWidget::extractStatsData(AttributeMatrix::Pointer attrMat, int index)
{
setPhaseIndex(index);
IDataArray::Pointer iDataArray = attrMat->getAttributeArray(DREAM3D::EnsembleData::CrystalStructures);
unsigned int* attributeArray = boost::dynamic_pointer_cast< UInt32ArrayType >(iDataArray)->getPointer(0);
m_CrystalStructure = attributeArray[index];
iDataArray = attrMat->getAttributeArray(DREAM3D::EnsembleData::PhaseTypes);
attributeArray = boost::dynamic_pointer_cast< UInt32ArrayType >(iDataArray)->getPointer(0);
m_PhaseType = attributeArray[index];
iDataArray = attrMat->getAttributeArray(DREAM3D::EnsembleData::Statistics);
StatsDataArray* statsDataArray = StatsDataArray::SafeObjectDownCast<IDataArray*, StatsDataArray*>(iDataArray.get());
if (statsDataArray == NULL)
{
return;
}
StatsData::Pointer statsData = statsDataArray->getStatsData(index);
BoundaryStatsData* boundaryStatsData = BoundaryStatsData::SafePointerDownCast(statsData.get());
m_PhaseFraction = boundaryStatsData->getPhaseFraction();
}