本文整理汇总了C++中trianglegeom::Pointer类的典型用法代码示例。如果您正苦于以下问题:C++ Pointer类的具体用法?C++ Pointer怎么用?C++ Pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AbaqusSurfaceMeshWriter::dataCheck()
{
setErrorCondition(0);
if (m_OutputFile.isEmpty() == true)
{
setErrorCondition(-1003);
notifyErrorMessage(getHumanLabel(), "The output file must be set", getErrorCondition());
}
QFileInfo fi(m_OutputFile);
QDir parentPath = fi.path();
if (parentPath.exists() == false)
{
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);
}
QVector<IDataArray::Pointer> dataArrays;
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
if(getErrorCondition() >= 0) { dataArrays.push_back(triangles->getTriangles()); }
QVector<size_t> cDims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, dataArrays);
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:34,代码来源:AbaqusSurfaceMeshWriter.cpp
示例2: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void LaplacianSmoothing::dataCheck()
{
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
QVector<IDataArray::Pointer> faceDataArrays;
QVector<IDataArray::Pointer> nodeDataArrays;
if(getErrorCondition() >= 0) { faceDataArrays.push_back(triangles->getTriangles()); nodeDataArrays.push_back(triangles->getVertices()); }
QVector<size_t> cDims(1, 1);
m_SurfaceMeshNodeTypePtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int8_t>, AbstractFilter>(this, getSurfaceMeshNodeTypeArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshNodeTypePtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshNodeType = m_SurfaceMeshNodeTypePtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { nodeDataArrays.push_back(m_SurfaceMeshNodeTypePtr.lock()); }
cDims[0] = 2;
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { faceDataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, faceDataArrays);
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, nodeDataArrays);
setSurfaceDataContainerName(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:29,代码来源:LaplacianSmoothing.cpp
示例3: dataCheckSurfaceMesh
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void GenerateFaceMisorientationColoring::dataCheckSurfaceMesh()
{
setErrorCondition(0);
DataArrayPath tempPath;
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, m_SurfaceMeshFaceLabelsArrayPath.getDataContainerName());
QVector<IDataArray::Pointer> dataArrays;
if(getErrorCondition() >= 0) { dataArrays.push_back(triangles->getTriangles()); }
QVector<size_t> cDims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
cDims[0] = 3;
tempPath.update(m_SurfaceMeshFaceLabelsArrayPath.getDataContainerName(), m_SurfaceMeshFaceLabelsArrayPath.getAttributeMatrixName(), getSurfaceMeshFaceMisorientationColorsArrayName() );
m_SurfaceMeshFaceMisorientationColorsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, tempPath, 0, cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceMisorientationColorsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceMisorientationColors = m_SurfaceMeshFaceMisorientationColorsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, dataArrays);
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:28,代码来源:GenerateFaceMisorientationColoring.cpp
示例4: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void WriteStlFile::dataCheck()
{
setErrorCondition(0);
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
QVector<IDataArray::Pointer> dataArrays;
if(getErrorCondition() >= 0) { dataArrays.push_back(triangles->getTriangles()); }
if (m_OutputStlDirectory.isEmpty() == true)
{
setErrorCondition(-1003);
notifyErrorMessage(getHumanLabel(), "The output directory must be set", -1003);
}
QVector<size_t> cDims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
if (m_GroupByPhase == true)
{
m_SurfaceMeshFacePhasesPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFacePhasesArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFacePhasesPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFacePhases = m_SurfaceMeshFacePhasesPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFacePhasesPtr.lock()); }
}
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, dataArrays);
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:35,代码来源:WriteStlFile.cpp
示例5: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ReverseTriangleWinding::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) {
return;
}
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceDataContainerName());
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
bool doParallel = true;
#endif
TriangleGeom::Pointer triangleGeom = sm->getGeometryAs<TriangleGeom>();
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, triangleGeom->getNumberOfTris()),
ReverseWindingImpl(triangleGeom->getTriangles()), tbb::auto_partitioner());
}
else
#endif
{
ReverseWindingImpl serial(triangleGeom->getTriangles());
serial.generate(0, triangleGeom->getNumberOfTris());
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage(getHumanLabel(), "Complete");
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:36,代码来源:ReverseTriangleWinding.cpp
示例6: writeCellScalarData
void writeCellScalarData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, FILE* vtkFile, QMap<int32_t, int32_t>& featureIds, int32_t* m_SurfaceMeshFaceLabels)
{
TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();
int64_t numTriangles = triangleGeom->getNumberOfTris();
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString ss;
if (NULL != data.get())
{
int32_t totalCellsWritten = 0;
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "SCALARS %s %s 1\n", dataName.toLatin1().data(), dataType.toLatin1().data());
fprintf(vtkFile, "LOOKUP_TABLE default\n");
// Loop over all the features
for(QMap<int32_t, int32_t>::iterator featureIter = featureIds.begin(); featureIter != featureIds.end(); ++featureIter)
{
int32_t gid = featureIter.key(); // The current Feature Id
size_t size = featureIter.value(); // The number of triangles for this feature id
std::vector<T> buffer(size, 0);
totalCellsWritten += size;
size_t index = 0;
for (int j = 0; j < numTriangles; j++)
{
if (m_SurfaceMeshFaceLabels[j * 2] != gid && m_SurfaceMeshFaceLabels[j * 2 + 1] != gid) { continue; }
// Get the data
T s0 = static_cast<T>(m[j]);
if (m_SurfaceMeshFaceLabels[j * 2 + 1] == gid)
{ s0 = s0 * -1; }
// Write the values to the buffer after an Endian swap.
if(writeBinaryData == true)
{
SIMPLib::Endian::FromSystemToBig::convert(s0);
buffer[index] = s0;
++index;
}
else
{
ss = QString::number(s0);
fprintf(vtkFile, "%s\n", ss.toLatin1().data());
}
}
// Write the Buffer
if(writeBinaryData == true)
{
fwrite(&(buffer.front()), sizeof(T), size, vtkFile);
}
}
}
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:59,代码来源:SurfaceMeshToNonconformalVtk.cpp
示例7: writeNodes
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int32_t AbaqusSurfaceMeshWriter::writeNodes(FILE* f)
{
TriangleGeom::Pointer triangleGeom = getDataContainerArray()->getDataContainer(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName())->getGeometryAs<TriangleGeom>();
float* nodes = triangleGeom->getVertexPointer(0);
int64_t numNodes = triangleGeom->getNumberOfVertices();
int32_t err = 0;
fprintf(f, "*Node,NSET=NALL\n");
//1, 72.520433763730, 70.306420652241, 100.000000000000
// Abaqus Starts number at 1 NOT 0(Zero).
for (int64_t i = 1; i <= numNodes; ++i)
{
fprintf(f, "%lld, %0.6f, %0.6f, %0.6f\n", (long long int)i, nodes[(i - 1) * 3], nodes[(i - 1) * 3 + 1], nodes[(i - 1) * 3 + 2]);
}
return err;
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:20,代码来源:AbaqusSurfaceMeshWriter.cpp
示例8: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SampleSurfaceMesh::dataCheck()
{
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
if(getErrorCondition() < 0) { return; }
QVector<IDataArray::Pointer> dataArrays;
if(getErrorCondition() >= 0) { dataArrays.push_back(triangles->getTriangles()); }
QVector<size_t> cDims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, dataArrays);
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:20,代码来源:SampleSurfaceMesh.cpp
示例9: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TriangleCentroidFilter::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceMeshTriangleCentroidsArrayPath().getDataContainerName());
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
// No check because datacheck() made sure we can do the next line.
TriangleGeom::Pointer triangleGeom = sm->getGeometryAs<TriangleGeom>();
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, triangleGeom->getNumberOfTris()),
CalculateCentroidsImpl(triangleGeom->getVertices(), triangleGeom->getTriangles(), m_SurfaceMeshTriangleCentroids), tbb::auto_partitioner());
}
else
#endif
{
CalculateCentroidsImpl serial(triangleGeom->getVertices(), triangleGeom->getTriangles(), m_SurfaceMeshTriangleCentroids);
serial.generate(0, triangleGeom->getNumberOfTris());
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage(getHumanLabel(), "Complete");
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:35,代码来源:TriangleCentroidFilter.cpp
示例10: writeTriangles
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int32_t AbaqusSurfaceMeshWriter::writeTriangles(FILE* f)
{
int32_t err = 0;
TriangleGeom::Pointer triangleGeom = getDataContainerArray()->getDataContainer(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName())->getGeometryAs<TriangleGeom>();
int64_t numTri = triangleGeom->getNumberOfTris();
int64_t* triangles = triangleGeom->getTriPointer(0);
fprintf(f, "*ELEMENT, TYPE=%s\n", TRI_ELEMENT_TYPE);
for (int64_t i = 1; i <= numTri; ++i)
{
// When we get the node index, add 1 to it because Abaqus number is 1 based.
int64_t nId0 = triangles[(i - 1) * 3] + 1;
int64_t nId1 = triangles[(i - 1) * 3 + 1] + 1;
int64_t nId2 = triangles[(i - 1) * 3 + 2] + 1;
fprintf(f, "%lld, %lld, %lld, %lld\n", (long long int)i, (long long int)nId0, (long long int)nId1, (long long int)nId2);
}
return err;
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:21,代码来源:AbaqusSurfaceMeshWriter.cpp
示例11: writeCellVectorData
void writeCellVectorData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, const QString& vtkAttributeType,
FILE* vtkFile, QMap<int32_t, int32_t>& featureIds)
{
TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();
int64_t numTriangles = triangleGeom->getNumberOfTris();
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString ss;
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 < numTriangles; ++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);
}
else
{
ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";
fprintf(vtkFile, "%s ", ss.toLatin1().data());
if (i % 25 == 0) { fprintf(vtkFile, "\n"); }
}
}
}
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:44,代码来源:SurfaceMeshToNonconformalVtk.cpp
示例12: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void InsertAtoms::dataCheck()
{
setErrorCondition(0);
DataArrayPath tempPath;
TriangleGeom::Pointer triangles = getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
QVector<IDataArray::Pointer> dataArrays;
if(getErrorCondition() >= 0) { dataArrays.push_back(triangles->getTriangles()); }
DataContainer::Pointer v = getDataContainerArray()->createNonPrereqDataContainer<AbstractFilter>(this, getVertexDataContainerName());
if(getErrorCondition() < 0) { return; }
VertexGeom::Pointer vertices = VertexGeom::CreateGeometry(0, DREAM3D::Geometry::VertexGeometry);
v->setGeometry(vertices);
QVector<size_t> tDims(1, 0);
AttributeMatrix::Pointer vertexAttrMat = v->createNonPrereqAttributeMatrix<AbstractFilter>(this, getVertexAttributeMatrixName(), tDims, DREAM3D::AttributeMatrixType::Vertex);
if(getErrorCondition() < 0 || NULL == vertexAttrMat.get()) { return; }
QVector<size_t> cDims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
if(getErrorCondition() >= 0) { dataArrays.push_back(m_SurfaceMeshFaceLabelsPtr.lock()); }
cDims[0] = 4;
m_AvgQuatsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<float>, AbstractFilter>(this, getAvgQuatsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_AvgQuatsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_AvgQuats = m_AvgQuatsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
cDims[0] = 1;
tempPath.update(getVertexDataContainerName(), getVertexAttributeMatrixName(), getAtomFeatureLabelsArrayName() );
m_AtomFeatureLabelsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter, int32_t>(this, tempPath, -301, cDims); /* Assigns the shared_ptr<>(this, tempPath, -301, dims); Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_AtomFeatureLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_AtomFeatureLabels = m_AtomFeatureLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, dataArrays);
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:43,代码来源:InsertAtoms.cpp
示例13: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SurfaceMeshToNonconformalVtk::dataCheck()
{
setErrorCondition(0);
QString ss;
if (m_OutputVtkFile.isEmpty() == true)
{
setErrorCondition(-1003);
notifyErrorMessage(getHumanLabel(), "Vtk Output file is Not set correctly", -1003);
}
DataContainer::Pointer sm = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, m_SurfaceMeshFaceLabelsArrayPath.getDataContainerName(), false);
if(getErrorCondition() < 0) { return; }
TriangleGeom::Pointer triangles = sm->getPrereqGeometry<TriangleGeom, AbstractFilter>(this);
if(getErrorCondition() < 0) { return; }
// We MUST have Nodes
if (NULL == triangles->getVertices().get())
{
setErrorCondition(-386);
notifyErrorMessage(getHumanLabel(), "DataContainer Geometry missing Vertices", getErrorCondition());
}
// We MUST have Triangles defined also.
if (NULL == triangles->getTriangles().get())
{
setErrorCondition(-387);
notifyErrorMessage(getHumanLabel(), "DataContainer Geometry missing Triangles", getErrorCondition());
}
QVector<size_t> dims(1, 2);
m_SurfaceMeshFaceLabelsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSurfaceMeshFaceLabelsArrayPath(), dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshFaceLabelsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshFaceLabels = m_SurfaceMeshFaceLabelsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
dims[0] = 1;
m_SurfaceMeshNodeTypePtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int8_t>, AbstractFilter>(this, getSurfaceMeshNodeTypeArrayPath(), dims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_SurfaceMeshNodeTypePtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_SurfaceMeshNodeType = m_SurfaceMeshNodeTypePtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:41,代码来源:SurfaceMeshToNonconformalVtk.cpp
示例14: deepCopy
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IGeometry::Pointer TriangleGeom::deepCopy()
{
TriangleGeom::Pointer triCopy = TriangleGeom::CreateGeometry(getTriangles(), getVertices(), getName());
triCopy->setEdges(getEdges());
triCopy->setUnsharedEdges(getUnsharedEdges());
triCopy->setElementsContainingVert(getElementsContainingVert());
triCopy->setElementNeighbors(getElementNeighbors());
triCopy->setElementCentroids(getElementCentroids());
triCopy->setSpatialDimensionality(getSpatialDimensionality());
return triCopy;
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:16,代码来源:TriangleGeom.cpp
示例15: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void WriteTriangleGeometry::dataCheck()
{
setErrorCondition(0);
if(true == m_OutputNodesFile.isEmpty())
{
setErrorCondition(-380);
notifyErrorMessage(getHumanLabel(), "The output Nodes file needs to be set", getErrorCondition());
}
if(true == m_OutputTrianglesFile.isEmpty())
{
setErrorCondition(-382);
notifyErrorMessage(getHumanLabel(), "The output Triangles file needs to be set", getErrorCondition());
}
DataContainer::Pointer dataContainer = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, getDataContainerSelection());
if(getErrorCondition() < 0) { return; }
TriangleGeom::Pointer triangles = dataContainer->getPrereqGeometry<TriangleGeom, AbstractFilter>(this);
if(getErrorCondition() < 0) { return; }
// We MUST have Nodes
if (NULL == triangles->getVertices().get())
{
setErrorCondition(-386);
notifyErrorMessage(getHumanLabel(), "DataContainer Geometry missing Vertices", getErrorCondition());
}
// We MUST have Triangles defined also.
if (NULL == triangles->getTriangles().get())
{
setErrorCondition(-387);
notifyErrorMessage(getHumanLabel(), "DataContainer Geometry missing Triangles", getErrorCondition());
}
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:39,代码来源:WriteTriangleGeometry.cpp
示例16: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SurfaceMeshToVtk::execute()
{
int err = 0;
setErrorCondition(err);
dataCheck();
if(getErrorCondition() < 0) { return; }
setErrorCondition(0);
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(m_SurfaceMeshFaceLabelsArrayPath.getDataContainerName()); /* Place all your code to execute your filter here. */
TriangleGeom::Pointer triangleGeom = getDataContainerArray()->getDataContainer(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName())->getGeometryAs<TriangleGeom>();
float* nodes = triangleGeom->getVertexPointer(0);
int64_t* triangles = triangleGeom->getTriPointer(0);
qint64 numNodes = triangleGeom->getNumberOfVertices();
int64_t numTriangles = triangleGeom->getNumberOfTris();
// Make sure any directory path is also available as the user may have just typed
// in a path without actually creating the full path
QFileInfo fi(getOutputVtkFile());
QDir parentPath = fi.path();
if(!parentPath.mkpath("."))
{
QString ss = QObject::tr("Error creating parent path '%1'").arg(parentPath.absolutePath());
notifyErrorMessage(getHumanLabel(), ss, -1);
setErrorCondition(-1);
return;
}
// Open the output VTK File for writing
FILE* vtkFile = NULL;
vtkFile = fopen(getOutputVtkFile().toLatin1().data(), "wb");
if (NULL == vtkFile)
{
QString ss = QObject::tr("Error creating file '%1'").arg(getOutputVtkFile());
notifyErrorMessage(getHumanLabel(), ss, -18542);
setErrorCondition(-18542);
return;
}
ScopedFileMonitor vtkFileMonitor(vtkFile);
fprintf(vtkFile, "# vtk DataFile Version 2.0\n");
fprintf(vtkFile, "Data set from DREAM.3D Surface Meshing Module\n");
if (m_WriteBinaryFile)
{
fprintf(vtkFile, "BINARY\n");
}
else
{
fprintf(vtkFile, "ASCII\n");
}
fprintf(vtkFile, "DATASET POLYDATA\n");
int numberWrittenumNodes = 0;
for (int i = 0; i < numNodes; i++)
{
// Node& n = nodes[i]; // Get the current Node
if (m_SurfaceMeshNodeType[i] > 0) { ++numberWrittenumNodes; }
}
fprintf(vtkFile, "POINTS %d float\n", numberWrittenumNodes);
float pos[3] = {0.0f, 0.0f, 0.0f};
size_t totalWritten = 0;
// Write the POINTS data (Vertex)
for (int i = 0; i < numNodes; i++)
{
if (m_SurfaceMeshNodeType[i] > 0)
{
pos[0] = static_cast<float>(nodes[i * 3]);
pos[1] = static_cast<float>(nodes[i * 3 + 1]);
pos[2] = static_cast<float>(nodes[i * 3 + 2]);
if (m_WriteBinaryFile == true)
{
SIMPLib::Endian::FromSystemToBig::convert(pos[0]);
SIMPLib::Endian::FromSystemToBig::convert(pos[1]);
SIMPLib::Endian::FromSystemToBig::convert(pos[2]);
totalWritten = fwrite(pos, sizeof(float), 3, vtkFile);
if (totalWritten != sizeof(float) * 3)
{
}
}
else
{
fprintf(vtkFile, "%f %f %f\n", pos[0], pos[1], pos[2]); // Write the positions to the output file
}
}
}
int tData[4];
int triangleCount = numTriangles;
//.........这里部分代码省略.........
开发者ID:kglowins,项目名称:DREAM3D,代码行数:101,代码来源:SurfaceMeshToVtk.cpp
示例17: writeCellNormalData
void writeCellNormalData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, FILE* vtkFile, QMap<int32_t, int32_t>& featureIds, int32_t* m_SurfaceMeshFaceLabels)
{
TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();
int64_t numTriangles = triangleGeom->getNumberOfTris();
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString buf;
QTextStream ss(&buf);
if (NULL != data.get())
{
int32_t totalCellsWritten = 0;
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "NORMALS %s %s\n", dataName.toLatin1().data(), dataType.toLatin1().data());
// Loop over all the features
for(QMap<int32_t, int32_t>::iterator featureIter = featureIds.begin(); featureIter != featureIds.end(); ++featureIter)
{
int32_t gid = featureIter.key(); // The current Feature Id
size_t size = featureIter.value(); // The number of triangles for this feature id
std::vector<T> buffer(size * 3, 0);
totalCellsWritten += size * 3;
size_t index = 0;
for (int j = 0; j < numTriangles; j++)
{
if (m_SurfaceMeshFaceLabels[j * 2] != gid && m_SurfaceMeshFaceLabels[j * 2 + 1] != gid) { continue; }
// Get the data
T s0 = static_cast<T>(m[j * 3 + 0]);
T s1 = static_cast<T>(m[j * 3 + 1]);
T s2 = static_cast<T>(m[j * 3 + 2]);
// Flip the normal if needed because the current feature id is assigned to the triangle.labels[1]
if (m_SurfaceMeshFaceLabels[j * 2 + 1] == gid )
{
s0 *= -1.0;
s1 *= -1.0;
s2 *= -1.0;
}
// Write the values to the buffer after an Endian swap.
if(writeBinaryData == true)
{
SIMPLib::Endian::FromSystemToBig::convert(s0);
buffer[index] = s0;
++index;
SIMPLib::Endian::FromSystemToBig::convert(s1);
buffer[index] = s1;
++index;
SIMPLib::Endian::FromSystemToBig::convert(s2);
buffer[index] = s2;
++index;
}
else
{
ss << s0 << " " << s1 << " " << s2;
fprintf(vtkFile, "%s\n", buf.toLatin1().data());
buf.clear();
}
}
// Write the Buffer
if(writeBinaryData == true)
{
fwrite(&(buffer.front()), sizeof(T), size * 3, vtkFile);
}
}
}
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:71,代码来源:SurfaceMeshToNonconformalVtk.cpp
示例18: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FeatureFaceCurvatureFilter::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName());
// Get our Reference counted Array of Face Structures
TriangleGeom::Pointer triangleGeom = sm->getGeometryAs<TriangleGeom>();
// Just to double check we have everything.
int64_t numTriangles = triangleGeom->getNumberOfTris();
// Make sure the Face Connectivity is created because the FindNRing algorithm needs this and will
// assert if the data is NOT in the SurfaceMesh Data Container
ElementDynamicList::Pointer vertLinks = triangleGeom->getElementsContainingVert();
if (NULL == vertLinks.get())
{
triangleGeom->findElementsContainingVert();
}
// get the QMap from the SharedFeatureFaces filter
SharedFeatureFaces_t sharedFeatureFaces;
int32_t maxFaceId = 0;
for (int64_t t = 0; t < numTriangles; ++t)
{
if (m_SurfaceMeshFeatureFaceIds[t] > maxFaceId) { maxFaceId = m_SurfaceMeshFeatureFaceIds[t]; }
}
std::vector<int32_t> faceSizes(maxFaceId + 1, 0);
// Loop through all the Triangles and assign each one to a unique Feature Face Id.
for (int64_t t = 0; t < numTriangles; ++t)
{
faceSizes[m_SurfaceMeshFeatureFaceIds[t]]++;
}
// Allocate all the vectors that we need
for (size_t iter = 0; iter < faceSizes.size(); ++iter)
{
FaceIds_t v;
v.reserve(faceSizes[iter]);
sharedFeatureFaces[iter] = v;
}
// Loop through all the Triangles and assign each one to a unique Feature Face Id.
for(int64_t t = 0; t < numTriangles; ++t)
{
sharedFeatureFaces[m_SurfaceMeshFeatureFaceIds[t]].push_back(t);
}
m_TotalFeatureFaces = sharedFeatureFaces.size();
m_CompletedFeatureFaces = 0;
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
tbb::task_group* g = new tbb::task_group;
#else
#endif
// typedef here for conveneince
typedef SharedFeatureFaces_t::iterator SharedFeatureFaceIterator_t;
for(SharedFeatureFaceIterator_t iter = sharedFeatureFaces.begin(); iter != sharedFeatureFaces.end(); ++iter)
{
QString ss = QObject::tr("Working on Face Id %1/%2").arg((*iter).first).arg(maxFaceId);
notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss);
FaceIds_t& triangleIds = (*iter).second;
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
g->run(CalculateTriangleGroupCurvatures(m_NRing, triangleIds, m_UseNormalsForCurveFitting,
m_SurfaceMeshPrincipalCurvature1sPtr.lock(), m_SurfaceMeshPrincipalCurvature2sPtr.lock(),
m_SurfaceMeshPrincipalDirection1sPtr.lock(), m_SurfaceMeshPrincipalDirection2sPtr.lock(),
m_SurfaceMeshGaussianCurvaturesPtr.lock(), m_SurfaceMeshMeanCurvaturesPtr.lock(), triangleGeom,
m_SurfaceMeshFaceLabelsPtr.lock(),
m_SurfaceMeshFaceNormalsPtr.lock(),
m_SurfaceMeshTriangleCentroidsPtr.lock(),
this ) );
}
else
#endif
{
CalculateTriangleGroupCurvatures curvature(m_NRing, triangleIds, m_UseNormalsForCurveFitting,
m_SurfaceMeshPrincipalCurvature1sPtr.lock(), m_SurfaceMeshPrincipalCurvature2sPtr.lock(),
m_SurfaceMeshPrincipalDirection1sPtr.lock(), m_SurfaceMeshPrincipalDirection2sPtr.lock(),
m_SurfaceMeshGaussianCurvaturesPtr.lock(), m_SurfaceMeshMeanCurvaturesPtr.lock(), triangleGeom,
m_SurfaceMeshFaceLabelsPtr.lock(),
m_SurfaceMeshFaceNormalsPtr.lock(),
m_SurfaceMeshTriangleCentroidsPtr.lock(),
this );
//.........这里部分代码省略.........
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:101,代码来源:FeatureFaceCurvatureFilter.cpp
示例19: writePointData
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int SurfaceMeshToNonconformalVtk::writePointData(FILE* vtkFile)
{
int err = 0;
if (NULL == vtkFile)
{
return -1;
}
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(m_SurfaceMeshNodeTypeArrayPath.getDataContainerName());
TriangleGeom::Pointer triangleGeom = getDataContainerArray()->getDataContainer(getSurfaceMeshFaceLabelsArrayPath().getDataContainerName())->getGeometryAs<TriangleGeom>();
//Get the Number of Vertex points in the mesh with a valid node type
qint64 numNodes = triangleGeom->getNumberOfVertices();
int nNodes = 0;
// int swapped;
for (int i = 0; i < numNodes; i++)
{
if (m_SurfaceMeshNodeType[i] > 0) { ++nNodes; }
else { qDebug() << "Node Type Invalid: &quo
|
请发表评论