[Paraview] problem configuring the output of a filter
Burlen Loring
burlen.loring at kitware.com
Fri Sep 19 08:59:19 EDT 2008
Natalie Happenhofer wrote:
> Hi!
> I have problems configuring the output of my filter, the filter is a
> subclass of vtkDataSetToStructuredGrid and setting the output looks as
> following:
>
> //setting the new point data
> vtkSmartPointer<vtkFloatArray> new_scalars =
> vtkSmartPointer<vtkFloatArray>::New();
>
> double inPtr[numOfTuples + 1]; //pointer for casting the values
> actually to double, so I can perform arithmetic operations with them
> float outPtr[numOfTuples + 1];
> //calculating ..
>
> new_scalars -> SetArray(outPtr,numOfTuples,1);
You are passing a stack based array here, when your function returns
inPtr and outPtr no longer are valid. If you are going to use SetArray
you'll have to malloc or new the memory you need.
>
>
>
> output -> SetDimensions(dims);
> output -> SetPoints(pts); //Now the points are set
> output -> GetPointData() -> SetScalars(new_scalars);
> output -> Squeeze();
>
>
> dims are the dimensions of the input, which is a RectilinearGrid or a
> StructuredGrid, new_scalars is a vtkFloatArray. I believe that the
> "output->GetPointData() ->SetScalars(new_scalars)"-line is causing the
> problem, because I get the following error messages:
>
> Program received signal SIGSEGV, Segmentation fault.
> vtkFieldData::GetActualMemorySize
> at C:/ParaviewSource/ParaView3/VTK/Filtering/vtkFieldData.cxx:577
> size +=this->Data[i]->GetActualMemorySize();
>
> Backtracing, functions in vtkPVDataInformation and vtkSelfConnections
> are called,
> so I guess, this does not actually happen in my source code but in the
> rendering pipeline. As I did not change anything in the rendering
> pipeline, there must be an allocation or a call in my code with
> incorrect arguments, but I do not really know where to look for the
> error.
> Does anyone have an idea?
>
> Thx,
> NH
>
>
> ------------------------------------------------------------------------
> Express yourself instantly with MSN Messenger! MSN Messenger
> <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
--
Burlen Loring
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x137
More information about the ParaView
mailing list