<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&nbsp; 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 -&gt; GetInput();<br>&nbsp;vtkStructuredGrid *output = this -&gt; GetOutput();<br><br>&nbsp;int DataSetType;<br>&nbsp;DataSetType = input -&gt; GetDataObjectType();<br><br>&nbsp;if(DataSetType != VTK_RECTILINEAR_GRID) { vtkErrorMacro("unsupported DataSet format");}<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;int dims[3],i,j,k;<br>&nbsp;// pointer for casting<br>&nbsp;vtkSmartPointer&lt;vtkRectilinearGrid&gt; rect_input = vtkSmartPointer&lt;vtkRectilinearGrid&gt;::New();<br>&nbsp;//vtkStructuredGrid *structgrid_input = vtkStructuredGrid::New();<br><br><br>&nbsp;vtkPointData *scaldat = input -&gt; GetPointData();<br>&nbsp;vtkDataArray *new_scaldat;<br><br>&nbsp;vtkSmartPointer&lt;vtkFloatArray&gt; scalars = vtkSmartPointer&lt;vtkFloatArray&gt;::New();<br>&nbsp;vtkSmartPointer&lt;vtkFloatArray&gt; new_scalars = vtkSmartPointer&lt;vtkFloatArray&gt;::New();<br><br>&nbsp;scalars = vtkFloatArray::SafeDownCast(scaldat); //this is now the input as vtkFloatArray<br>&nbsp;scaldat -&gt; Delete();<br>&nbsp;int numbOfComp = scalars -&gt; GetNumberOfComponents();<br>&nbsp;if(numbOfComp ==1) vtkErrorMacro("Number of Components of Input Array bigger than 1!"); //!!!!<br>&nbsp;int numOfTuples = scalars -&gt; GetNumberOfTuples();<br><br><br>&nbsp;new_scalars -&gt; SetNumberOfComponents(1);<br>&nbsp;new_scalars -&gt; SetNumberOfTuples(numOfTuples);<br><br><br>&nbsp;rect_input = vtkRectilinearGrid::SafeDownCast(input);<br><br>&nbsp;if(!rect_input) {vtkErrorMacro("SafeDownCast to Rectilinear Grid failed");}<br><br>else {&nbsp; rect_input -&gt; GetDimensions(dims);<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; //get the points:<br>&nbsp;&nbsp; /*vtkDataArray *XCoord = vtkDataArray::New();<br>&nbsp;&nbsp; vtkDataArray *YCoord = vtkDataArray::New();<br>&nbsp;&nbsp; vtkDataArray *ZCoord = vtkDataArray::New();*/<br><br>&nbsp;&nbsp; vtkDataArray *XCoord = rect_input -&gt; GetXCoordinates();<br>&nbsp;&nbsp; vtkDataArray *YCoord = rect_input -&gt; GetYCoordinates();<br>&nbsp;&nbsp; vtkDataArray *ZCoord = rect_input -&gt; GetZCoordinates();<br>&nbsp;<br>output -&gt; SetDimensions(dims);<br>&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkPoints&gt; pts = vtkSmartPointer&lt;vtkPoints&gt;::New();<br>&nbsp;&nbsp;&nbsp; pts -&gt; SetNumberOfPoints(numOfTuples);<br><br><br>&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;=dims[2];i++)<br>&nbsp;&nbsp;&nbsp; { for(int j=0;j&lt;=dims[1];j++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {for(int k=0;k&lt;=dims[0];k++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {pts -&gt; InsertNextPoint(XCoord -&gt; GetTuple1(k),YCoord -&gt; GetTuple1(j), ZCoord -&gt; GetTuple1(i));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }//for (int k<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }//for(int j<br>&nbsp;&nbsp;&nbsp; }//for (int i<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; XCoord -&gt; Delete();<br>&nbsp;&nbsp;&nbsp; YCoord -&gt; Delete();<br>&nbsp;&nbsp;&nbsp; ZCoord -&gt; Delete();<br><br>&nbsp;&nbsp;&nbsp; output -&gt; SetPoints(pts); //Now the points are set<br>&nbsp;&nbsp;&nbsp; //output -&gt; GetPointData()-&gt; CopyAllocate(new_scalars,0,new_scalars -&gt; GetNumberOfTuples());<br>&nbsp;&nbsp;&nbsp; output -&gt; GetPointData() -&gt; PassData(input -&gt; GetPointData());<br>&nbsp;&nbsp;&nbsp; new_scalars -&gt; 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>