Hi Owen, You will need to declare the whole extent in request information. See this post: http://markmail.org/message/af6n3hutrbnxjowf
Regards, Paul On 20 July 2010 16:02, <owen.arn...@stfc.ac.uk> wrote: > Hi, > > > > I am attempting to create a data source based on a > vtkStructuredGridAlgorithm. Eventually I would like to represent the grid > in a hexahedron format > http://vtk.1045678.n5.nabble.com/Creating-a-structured-grid-of-250x250-cells-is-causing-MS-runtime-to-throw-an-exception-td1250336.html. > While I have been able to get this example running in vtk using the python > API, my Paraview plugin source does not work. > > > > I have the same problem attempting to write a plugin source using a simpler > example from the vtk guide: > http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/DataManipulation/Cxx/SGrid.cxx?root=VTK&content-type=text/plain. > According to the information tab in Paraview, I have zero points and zero > cells, although debugging the datasource shows that for my vtkStructuredGrid > output, the points and cells have been created. > > > > Can anyone spot what I might be doing, and suggest how I might fix the > problem (see below). > > > > Thanks in advance, > > > > Owen > > > > int vtkStructuredHexahedronSource::RequestData(vtkInformation *request, > vtkInformationVector **inputVector, vtkInformationVector *outputVector) > > { > > vtkInformation *outInfo = outputVector->GetInformationObject(0); > > vtkStructuredGrid *output = > vtkStructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); > > > > int i, j, k, kOffset, jOffset, offset; > > float x[3], v[3], rMin=0.5, rMax=1.0, deltaRad, deltaZ; > > float radius, theta; > > static int dims[3]={13,11,11}; > > > > // Create the structured grid. > > > > output->SetDimensions(dims); > > > > // We also create the points and vectors. The points > > // form a hemi-cylinder of data. > > vtkFloatArray *vectors = vtkFloatArray::New(); > > vectors->SetNumberOfComponents(3); > > vectors->SetNumberOfTuples(dims[0]*dims[1]*dims[2]); > > vtkPoints *points = vtkPoints::New(); > > points->Allocate(dims[0]*dims[1]*dims[2]); > > > > deltaZ = 2.0 / (dims[2]-1); > > deltaRad = (rMax-rMin) / (dims[1]-1); > > v[2]=0.0; > > for ( k=0; k<dims[2]; k++) > > { > > x[2] = -1.0 + k*deltaZ; > > kOffset = k * dims[0] * dims[1]; > > for (j=0; j<dims[1]; j++) > > { > > radius = rMin + j*deltaRad; > > jOffset = j * dims[0]; > > for (i=0; i<dims[0]; i++) > > { > > theta = i * vtkMath::RadiansFromDegrees(15.0); > > x[0] = radius * cos(theta); > > x[1] = radius * sin(theta); > > v[0] = -x[1]; > > v[1] = x[0]; > > offset = i + jOffset + kOffset; > > points->InsertPoint(offset,x); > > vectors->InsertTuple(offset,v); > > } > > } > > } > > output->SetPoints(points); > > points->Delete(); > > output->GetPointData()->SetVectors(vectors); > > vectors->Delete(); > > return 1; > > } > > -- > Scanned by iCritical. > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview