Is there a way to debug in Paraview. I am creating a custom filter which is a combination of calculator and glyph filters. For now I have just added calculator filter.
But after applying my new filter when I click “Apply” Paraview crashes, is there a way to debug what’s going wrong?
I am running Paraview from my directory using this command:
paraview.exe -l=C:\Users\msaad\paraview.log,TRACE
But log files does not show details of debug. This is the snapshot of the log file when I click “Apply”
( 93.967s) [paraview ]vtkStreamingDemandDrive:207 9| . . vtkPVPostFilter (000002019C4846C0) execute-time-dependent-information
( 93.967s) [paraview ]vtkStreamingDemandDrive:319 9| . . vtkPVPostFilter (000002019C4846C0) execute-update-extent
( 93.967s) [paraview ]vtkStreamingDemandDrive:319 9| . . vtkMyForceFilter (0000020187A74EE0) execute-update-extent
( 93.968s) [paraview ]vtkDemandDrivenPipeline:260 9| . . vtkMyForceFilter (0000020187A74EE0) execute-data
( 93.968s) [paraview ] vtkSISourceProxy.cxx:306 9| . . { MyForce1: execute
Here is my header file, if that can help in debugging. For now I have commented out vtkPVGlyphFilter.
#ifndef vtkMyForceFilter_h
#define vtkMyForceFilter_h
#include "ForceFiltersModule.h" //needed for exports
#include "vtkPolyDataAlgorithm.h"
#include <vtkPVArrayCalculator.h>
// #include <vtkPVGlyphFilter.h>
// #include "vtkPolyDataAlgorithm.h"
#include "vtkDataSetAlgorithm.h"
#include <string>
class FORCEFILTERS_EXPORT vtkMyForceFilter : public vtkDataSetAlgorithm
{
public:
static vtkMyForceFilter* New();
// Wrapper methods to expose vtkPVArrayCalculator and vtkPVGlyphFilter functionalities
vtkTypeMacro(vtkMyForceFilter, vtkDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
void SetAttributeType(int value);
void SetCoordinateResults(int value);
void SetResultNormals(int value);
void SetResultTCoords(int value);
void SetResultArrayName(std::string value);
void SetFunction(std::string value);
void SetReplaceInvalidValues(int value);
void SetReplacementValue(double value);
void SetResultArrayType(int value);
void SetFunctionParserTypeFromInt(int value);
protected:
vtkMyForceFilter();
~vtkMyForceFilter() override;
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
private:
vtkMyForceFilter(const vtkMyForceFilter&) = delete;
void operator=(const vtkMyForceFilter&) = delete;
vtkSmartPointer<vtkPVArrayCalculator> ArrayCalculator;
// vtkSmartPointer<vtkPVGlyphFilter> GlyphFilter;
};
#endif
And here is the RequestData function of my .cxx file:
int vtkMyForceFilter::RequestData(
vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
if (!this->ArrayCalculator)
{
vtkErrorMacro("Filters not set up properly.");
return 0;
}
// Get input and output data objects
vtkDataObject* inputData = vtkDataObject::GetData(inputVector[0], 0);
vtkSmartPointer<vtkDataObject> input = inputData->NewInstance();
input->ShallowCopy(inputData);
// vtkDataObject* input = vtkDataObject::GetData(inputVector[0], 0);
vtkDebugMacro("Input: " << *input);
if (!input)
{
vtkErrorMacro("Input is invalid.");
return 0;
}
// Create a new output information vector for the vtkPVArrayCalculator
vtkInformationVector* arrayCalcOutputVector = vtkInformationVector::New();
vtkDataObject* arrayCalcOutput = vtkDataObject::GetData(inputVector[0]);
arrayCalcOutputVector->SetInformationObject(0, arrayCalcOutput->GetInformation());
vtkDebugMacro("ArrayCalculator Function: " << this->ArrayCalculator->GetFunction());
// Call the vtkPVArrayCalculator's ProcessRequest with REQUEST_DATA key
this->ArrayCalculator->ProcessRequest(request, inputVector, arrayCalcOutputVector);
// vtkDebugMacro("vtkPVArrayCalculator output: " << *arrayCalcOutput);
// Set up the input for vtkPVGlyphFilter
// vtkInformationVector** glyphInputVector = new vtkInformationVector*[1];
// glyphInputVector[0] = arrayCalcOutputVector;
// Call the vtkPVGlyphFilter's ProcessRequest with REQUEST_DATA key
// this->GlyphFilter->ProcessRequest(request, glyphInputVector, outputVector);
// vtkDataObject* glyphOutput = vtkDataObject::GetData(outputVector, 0);
// if (glyphOutput)
// {
// vtkDebugMacro("vtkPVGlyphFilter output: " << *glyphOutput);
// }
// else
// {
// vtkDebugMacro("vtkPVGlyphFilter output is invalid.");
// }
// Clean up
// arrayCalcOutput->Delete();
// arrayCalcOutputVector->Delete();
vtkDataObject* output = vtkDataObject::GetData(outputVector, 0);
output->ShallowCopy(arrayCalcOutput);
arrayCalcOutput->Delete();
arrayCalcOutputVector->Delete();
// delete[] glyphInputVector;
return 1;
}