It might help if you ran your code in a debugger and found out exactly where the error occurred.
I think the for loops are wrong. The conditions should be <, not <=. You might be mixing up dimension lengths and extent values. -Ken On 9/16/08 11:08 AM, "Natalie Happenhofer" <[EMAIL PROTECTED]> wrote: > Hi! > I´m still encountering problems with my filter, it does compile and link > neatly with paraview, but at runtime an error occurs which causes paraview to > shut down. I´m pretty sure that the problem is how I define the output, that > this is not done correctly. Lastly, I commented just the algorithm out to test > the in- and output, and it looks like this: > > void vtkHorizontalAverage::Execute() > {vtkDataSet *input = this -> GetInput(); > vtkStructuredGrid *output = this -> GetOutput(); > > int DataSetType; > DataSetType = input -> GetDataObjectType(); > > if(DataSetType != VTK_RECTILINEAR_GRID) { vtkErrorMacro("unsupported DataSet > format");} > > > > int dims[3],i,j,k; > // pointer for casting > vtkSmartPointer<vtkRectilinearGrid> rect_input = > vtkSmartPointer<vtkRectilinearGrid>::New(); > //vtkStructuredGrid *structgrid_input = vtkStructuredGrid::New(); > > > vtkPointData *scaldat = input -> GetPointData(); > vtkDataArray *new_scaldat; > > vtkSmartPointer<vtkFloatArray> scalars = > vtkSmartPointer<vtkFloatArray>::New(); > vtkSmartPointer<vtkFloatArray> new_scalars = > vtkSmartPointer<vtkFloatArray>::New(); > > scalars = vtkFloatArray::SafeDownCast(scaldat); //this is now the input as > vtkFloatArray > scaldat -> Delete(); > int numbOfComp = scalars -> GetNumberOfComponents(); > if(numbOfComp ==1) vtkErrorMacro("Number of Components of Input Array bigger > than 1!"); //!!!! > int numOfTuples = scalars -> GetNumberOfTuples(); > > > new_scalars -> SetNumberOfComponents(1); > new_scalars -> SetNumberOfTuples(numOfTuples); > > > rect_input = vtkRectilinearGrid::SafeDownCast(input); > > if(!rect_input) {vtkErrorMacro("SafeDownCast to Rectilinear Grid failed");} > > else { rect_input -> GetDimensions(dims); > > //get the points: > /*vtkDataArray *XCoord = vtkDataArray::New(); > vtkDataArray *YCoord = vtkDataArray::New(); > vtkDataArray *ZCoord = vtkDataArray::New();*/ > > vtkDataArray *XCoord = rect_input -> GetXCoordinates(); > vtkDataArray *YCoord = rect_input -> GetYCoordinates(); > vtkDataArray *ZCoord = rect_input -> GetZCoordinates(); > > output -> SetDimensions(dims); > vtkSmartPointer<vtkPoints> pts = vtkSmartPointer<vtkPoints>::New(); > pts -> SetNumberOfPoints(numOfTuples); > > > for(int i=0;i<=dims[2];i++) > { for(int j=0;j<=dims[1];j++) > {for(int k=0;k<=dims[0];k++) > {pts -> InsertNextPoint(XCoord -> GetTuple1(k),YCoord -> > GetTuple1(j), ZCoord -> GetTuple1(i)); > }//for (int k > }//for(int j > }//for (int i > > XCoord -> Delete(); > YCoord -> Delete(); > ZCoord -> Delete(); > > output -> SetPoints(pts); //Now the points are set > //output -> GetPointData()-> CopyAllocate(new_scalars,0,new_scalars -> > GetNumberOfTuples()); > output -> GetPointData() -> PassData(input -> GetPointData()); > new_scalars -> Delete(); > > > Here I get as an input a data set, cast it down to rectilinear grid and > compute the points for the structured grid. As I said, Paraview shuts down > (Access violation my debugger says) when I execute it. > > Any help would be appreciated! > thx, > NH > > > Express yourself instantly with MSN Messenger! MSN Messenger > <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/> **** Kenneth Moreland *** Sandia National Laboratories *********** *** *** *** email: [EMAIL PROTECTED] ** *** ** phone: (505) 844-8919 *** fax: (505) 845-0833 _______________________________________________ ParaView mailing list ParaView@paraview.org http://www.paraview.org/mailman/listinfo/paraview