Hello,
I`m trying to save my 3 million triangle polydata with 2 scalar fields in a std::vector with SMPtools. But I get an error in the
vtkDataArrayTupleRange_AOS. I tryed to print the begin and end tuples to check what was happening.
Thank you in advance,
Rafael Scatena
std::vector<Triangle> h_triangles(numTriangles);
/////// SPM
std::cerr << "PRISMAMESH: No of Triangles: " << trianglePolyData->GetNumberOfCells()<< std::endl;
vtkSMPTools::For(0, numTriangles, [&](vtkIdType begin, vtkIdType end) {
std::cerr << "beginTuple: " << begin << ", endTuple: " << end << std::endl;
for (; begin < end; ++begin) {
vtkCell* cell = trianglePolyData->GetCell(begin);
vtkTriangle* triangle = vtkTriangle::SafeDownCast(cell);
vtkIdType pointId0, pointId1, pointId2;
// Extract indices
pointId0 = triangle->GetPointId(0);
pointId1 = triangle->GetPointId(1);
pointId2 = triangle->GetPointId(2);
h_triangles[begin].triangle_id = static_cast<int64_t>(begin);
vtkIdType pointIds[3] = {pointId0, pointId1, pointId2}; double coordinates[3];
points->GetPoint(pointIds[0], coordinates);
h_triangles[begin].p1x = static_cast<double>(coordinates[0]);
h_triangles[begin].p1y = static_cast<double>(coordinates[1]);
h_triangles[begin].p1z = static_cast<double>(coordinates[2]);
points->GetPoint(pointIds[1], coordinates);
h_triangles[begin].p2x = static_cast<double>(coordinates[0]);
h_triangles[begin].p2y = static_cast<double>(coordinates[1]);
h_triangles[begin].p2z = static_cast<double>(coordinates[2]);
points->GetPoint(pointIds[2], coordinates);
h_triangles[begin].p3x = static_cast<double>(coordinates[0]);
h_triangles[begin].p3y = static_cast<double>(coordinates[1]);
h_triangles[begin].p3z = static_cast<double>(coordinates[2]);
h_triangles[begin].Material = static_cast<int>(materialArray->GetTuple1(begin));
h_triangles[begin].Body = static_cast<int>(bodiesArray->GetTuple1(begin));
}});
std::cout << "Triangle List Ready ! "<< std::endl;
return h_triangles;};
The error issued is this one:
: /home/3484681/miniconda3/envs/vtkenv/vtk-master/source2/VTK/Common/Core/vtkDataArrayTupleRange_AOS.h:921: vtk::detail::TupleRange<vtkAOSDataArrayTemplate<ValueType>, TupleSize>::TupleRange(vtk::detail::TupleRange<vtkAOSDataArrayTemplate<ValueType>, TupleSize>::ArrayType*, vtk::TupleIdType, vtk::TupleIdType) [with ValueType = double; int TupleSize = 3; vtk::detail::TupleRange<vtkAOSDataArrayTemplate<ValueType>, TupleSize>::ArrayType = vtkAOSDataArrayTemplate<double>; vtk::TupleIdType = long long int]: Assertion `endTuple >= 0 && endTuple <= this->Array->GetNumberOfTuples()' failed.
, endTuple: 648349
61165, endTuple: 73398beginTuple: 770679, endTuple: 782912
758446Abortado (imagem do núcleo gravada)