<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi!<br>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:<br><br>void vtkHorizontalAverage::Execute()<br>{vtkDataSet *input = this -> GetInput();<br> vtkStructuredGrid *output = this -> GetOutput();<br><br> int DataSetType;<br> DataSetType = input -> GetDataObjectType();<br><br> if(DataSetType != VTK_RECTILINEAR_GRID) { vtkErrorMacro("unsupported DataSet format");}<br> <br> <br> <br> int dims[3],i,j,k;<br> // pointer for casting<br> vtkSmartPointer<vtkRectilinearGrid> rect_input = vtkSmartPointer<vtkRectilinearGrid>::New();<br> //vtkStructuredGrid *structgrid_input = vtkStructuredGrid::New();<br><br><br> vtkPointData *scaldat = input -> GetPointData();<br> vtkDataArray *new_scaldat;<br><br> vtkSmartPointer<vtkFloatArray> scalars = vtkSmartPointer<vtkFloatArray>::New();<br> vtkSmartPointer<vtkFloatArray> new_scalars = vtkSmartPointer<vtkFloatArray>::New();<br><br> scalars = vtkFloatArray::SafeDownCast(scaldat); //this is now the input as vtkFloatArray<br> scaldat -> Delete();<br> int numbOfComp = scalars -> GetNumberOfComponents();<br> if(numbOfComp ==1) vtkErrorMacro("Number of Components of Input Array bigger than 1!"); //!!!!<br> int numOfTuples = scalars -> GetNumberOfTuples();<br><br><br> new_scalars -> SetNumberOfComponents(1);<br> new_scalars -> SetNumberOfTuples(numOfTuples);<br><br><br> rect_input = vtkRectilinearGrid::SafeDownCast(input);<br><br> if(!rect_input) {vtkErrorMacro("SafeDownCast to Rectilinear Grid failed");}<br><br>else { rect_input -> GetDimensions(dims);<br> <br> //get the points:<br> /*vtkDataArray *XCoord = vtkDataArray::New();<br> vtkDataArray *YCoord = vtkDataArray::New();<br> vtkDataArray *ZCoord = vtkDataArray::New();*/<br><br> vtkDataArray *XCoord = rect_input -> GetXCoordinates();<br> vtkDataArray *YCoord = rect_input -> GetYCoordinates();<br> vtkDataArray *ZCoord = rect_input -> GetZCoordinates();<br> <br>output -> SetDimensions(dims);<br> vtkSmartPointer<vtkPoints> pts = vtkSmartPointer<vtkPoints>::New();<br> pts -> SetNumberOfPoints(numOfTuples);<br><br><br> for(int i=0;i<=dims[2];i++)<br> { for(int j=0;j<=dims[1];j++)<br> {for(int k=0;k<=dims[0];k++)<br> {pts -> InsertNextPoint(XCoord -> GetTuple1(k),YCoord -> GetTuple1(j), ZCoord -> GetTuple1(i));<br> }//for (int k<br> }//for(int j<br> }//for (int i<br> <br> XCoord -> Delete();<br> YCoord -> Delete();<br> ZCoord -> Delete();<br><br> output -> SetPoints(pts); //Now the points are set<br> //output -> GetPointData()-> CopyAllocate(new_scalars,0,new_scalars -> GetNumberOfTuples());<br> output -> GetPointData() -> PassData(input -> GetPointData());<br> new_scalars -> Delete();<br><br><br>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. <br><br>Any help would be appreciated!<br>thx,<br>NH<br><br /><hr />Express yourself instantly with MSN Messenger! <a href='http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/' target='_new'>MSN Messenger</a></body>
</html>