From 9ba04735986f91cfbfcb8bb3dca78f07930b30e7 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 15 May 2007 11:59:39 +0000 Subject: [PATCH] IPAL15171: IOLS. Error SIGSEGV on creating Stream Lines on maill.3.med. --- src/PIPELINE/VISUPipeline.hxx | 2 +- src/PIPELINE/VISU_UsedPointsFilter.cxx | 60 +++++++++++++++----------- src/PIPELINE/VISU_UsedPointsFilter.hxx | 16 +++---- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/PIPELINE/VISUPipeline.hxx b/src/PIPELINE/VISUPipeline.hxx index 897c68a2..334195fa 100755 --- a/src/PIPELINE/VISUPipeline.hxx +++ b/src/PIPELINE/VISUPipeline.hxx @@ -44,4 +44,4 @@ #define VISU_PIPELINE_EXPORT #endif -#endif \ No newline at end of file +#endif diff --git a/src/PIPELINE/VISU_UsedPointsFilter.cxx b/src/PIPELINE/VISU_UsedPointsFilter.cxx index 6fb0ffda..b88d18ed 100644 --- a/src/PIPELINE/VISU_UsedPointsFilter.cxx +++ b/src/PIPELINE/VISU_UsedPointsFilter.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_StreamLinesPL.cxx @@ -27,6 +27,8 @@ #include "VISU_UsedPointsFilter.hxx" +#include "VISU_ConvertorUtils.hxx" + #include #include #include @@ -34,56 +36,62 @@ #include #include +#include +#include + //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_UsedPointsFilter); //---------------------------------------------------------------------------- -VISU_UsedPointsFilter -::VISU_UsedPointsFilter() +VISU_UsedPointsFilter::VISU_UsedPointsFilter() { PercentsOfUsedPoints = 1.0; } - //---------------------------------------------------------------------------- -VISU_UsedPointsFilter -::~VISU_UsedPointsFilter() +VISU_UsedPointsFilter::~VISU_UsedPointsFilter() {} //---------------------------------------------------------------------------- -void -VISU_UsedPointsFilter -::Execute() +int VISU_UsedPointsFilter::RequestData (vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { - vtkDataSet *anInput = this->GetInput(); - vtkPointSet *anOutput = this->GetOutput(); - anOutput->GetPointData()->CopyAllOff(); - anOutput->GetCellData()->CopyAllOff(); - anOutput->CopyStructure(anInput); + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkDataSet *input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPointSet *output = vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); + + ////////// + output->GetPointData()->CopyAllOff(); + output->GetCellData()->CopyAllOff(); + output->CopyStructure(input); vtkPoints* aPoints = vtkPoints::New(); vtkIdList *anIdList = vtkIdList::New(); - vtkIdType iEnd = anInput->GetNumberOfPoints(); - for(vtkIdType i = 0; i < iEnd; i++){ - anInput->GetPointCells(i,anIdList); - if(anIdList->GetNumberOfIds() > 0) - aPoints->InsertNextPoint(anInput->GetPoint(i)); + vtkIdType iEnd = input->GetNumberOfPoints(); + for (vtkIdType i = 0; i < iEnd; i++) { + input->GetPointCells(i, anIdList); + if (anIdList->GetNumberOfIds() > 0) + aPoints->InsertNextPoint(input->GetPoint(i)); } vtkPoints* aNewPoints = vtkPoints::New(); iEnd = aPoints->GetNumberOfPoints(); - if (PercentsOfUsedPoints > 0){ + if (PercentsOfUsedPoints > 0) { vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints); - if(anOffset < 1) anOffset = 1; - for(vtkIdType i = 0; i < iEnd; i += anOffset) + if (anOffset < 1) anOffset = 1; + for (vtkIdType i = 0; i < iEnd; i += anOffset) aNewPoints->InsertNextPoint(aPoints->GetPoint(i)); } - anOutput->SetPoints(aNewPoints); + output->SetPoints(aNewPoints); aNewPoints->Delete(); aPoints->Delete(); -} - -//---------------------------------------------------------------------------- + return 1; +} diff --git a/src/PIPELINE/VISU_UsedPointsFilter.hxx b/src/PIPELINE/VISU_UsedPointsFilter.hxx index 3795da85..380e0fc9 100644 --- a/src/PIPELINE/VISU_UsedPointsFilter.hxx +++ b/src/PIPELINE/VISU_UsedPointsFilter.hxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_UsedPointsFilter.hxx @@ -27,17 +27,17 @@ #ifndef VISU_UsedPointsFilter_HeaderFile #define VISU_UsedPointsFilter_HeaderFile -#include +#include //---------------------------------------------------------------------------- -class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter +class VISU_UsedPointsFilter : public vtkPointSetAlgorithm { public: - vtkTypeMacro(VISU_UsedPointsFilter, vtkDataSetToUnstructuredGridFilter); + vtkTypeMacro(VISU_UsedPointsFilter, vtkPointSetAlgorithm); - static - VISU_UsedPointsFilter* + static + VISU_UsedPointsFilter* New(); vtkSetMacro(PercentsOfUsedPoints,float); @@ -50,9 +50,7 @@ protected: virtual ~VISU_UsedPointsFilter(); - virtual - void - Execute(); + int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); float PercentsOfUsedPoints; }; -- 2.39.2