[vtkusers] VTK *.app Abort trap:6
henlau
henrylau9677 at gmail.com
Mon Apr 10 21:07:57 EDT 2017
Below is my code:
//Creating vectors and points for hedgehog
static int dims[3] = {1430, 1557, 151};
float x[3], v[3];
int offset, kOffset, jOffset, k, deltaHeight, componentNum;
vtkStructuredGrid* reformedWeatherGrid = c2p->GetStructuredGridOutput();
reformedWeatherGrid->SetDimensions(dims[0], dims[1], dims[2]);
vtkFloatArray* vector = vtkFloatArray::New();
vector->SetNumberOfComponents(3);
vector->SetNumberOfTuples(dims[0]*dims[1]*dims[2]);
vtkPoints* points = vtkPoints::New();
points->Allocate(dims[0]*dims[1]*dims[2]);
v[2] = 0.0;
deltaHeight = dims[0] * dims[1];
for(int height = 1; height < dims[2]; height++){
x[2] = height;
kOffset = height*dims[0]*dims[1];
for(int lat = 1; lat < dims[1]; lat++){
jOffset = lat*dims[0];
for(int lon = 1; lon < dims[0]; lon++){
x[0] = lon;
x[1] = lat;
componentNum = height*lat*lon;
v[0] =
reformedWeatherGrid->GetPointData()->GetArray("ua")->GetComponent(componentNum,
0);
v[1] =
reformedWeatherGrid->GetPointData()->GetArray("va")->GetComponent(componentNum,0);
offset = lon+jOffset+kOffset;
points->InsertPoint(offset,x);
vector->InsertTuple(offset,v);
}
}
}
//Set points and vector to the structuredgrid
reformedWeatherGrid->SetPoints(points);
reformedWeatherGrid->GetPointData()->SetVectors(vector);
reformedWeatherGrid->Print(std::cout);
//HedgeHog
vtkHedgeHog* hedgehog = vtkHedgeHog::New();
hedgehog->SetInputData(reformedWeatherGrid);
hedgehog->SetScaleFactor(0.05);
hedgehog->Print(std::cout);
vtkPolyDataMapper* hhMapper = vtkPolyDataMapper::New();
hhMapper->SetInputConnection(hedgehog->GetOutputPort());
vtkActor* hhActor = vtkActor::New();
hhActor->SetMapper(hhMapper);
//Renderer, render window
......
Just now I tried with a smaller dimension, like 300x300x151 and it works. Is
that because of my computer not able to handle such large amount of data?
--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-app-Abort-trap-6-tp5742788p5742790.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list