[Paraview] problem configuring the output of a filter

Mike Jackson mike.jackson at bluequartz.net
Fri Sep 19 13:52:38 EDT 2008


Why don't you just use vtkDoubleArray instead of double outPtr[..] ?


vtkFloatArray* new_scalars = vtkFloatArray::New();

// Assuming in is a temporary variable not needed after this so we use  
a smart pointer
vtkSmartPointer<vtkDoubleArray> in =  
vtkSmartPointer<vtkDoubleArray>::New();

float* outPtr = new_scalars->WritePointer(0, numOfTuples + 1);
double* inPtr = in->WritePointer(0, numOfTuples + 1);

// The next line is NOT needed because you are operating
// directly on the allocated array.
//new_scalars -> SetArray(outPtr,numOfTuples,1);

output -> SetDimensions(dims);
     output -> SetPoints(pts); //Now the points are set
     output -> GetPointData() -> SetScalars(new_scalars);
     output -> Squeeze();

// Keep the reference count correct.
new_scalars->Delete();

  _________________________________________________
| Mike Jackson - Principal Software Engineer      |
| BlueQuartz Software                             |
| mike.jackson at bluequartz.net                     |
| www.bluequartz.net                              |
---------------------------------------------------


> On Sep 19, 2008, at 5:49 AM, 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);
>
>
>
> 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  
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list