From: enk Date: Thu, 15 Mar 2007 15:08:47 +0000 (+0000) Subject: Porting to VTK-5.0.0 X-Git-Tag: V4_0a2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5ea14227537aa3d7f3fefd64f7048a2945a04856;p=modules%2Fvisu.git Porting to VTK-5.0.0 --- diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index f406e557..1d7782c6 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -28,6 +28,7 @@ #include #include +#include #ifdef _DEBUG_ static int MYDEBUG = 0; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 6cbea3fb..89cd5478 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -27,8 +27,8 @@ #include "VISU_Convertor_impl.hxx" #include "VISU_ConvertorUtils.hxx" #include "VTKViewer_AppendFilter.h" -#include "VISU_MergeFilter.hxx" #include "VTKViewer_CellLocationsArray.h" +#include "VISU_MergeFilter.hxx" #include #include @@ -42,7 +42,6 @@ #include #include - #include #include @@ -57,7 +56,7 @@ static vtkFloatingPointType ERR_SIZE_CALC = 1.00; static int MYVTKDEBUG = 0; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; //#define _DEXCEPT_ #else @@ -405,7 +404,6 @@ namespace VISU const TVTKSource& aSource = mySource.GetSource(); TDataSet* aDataSet = aSource.GetPointer(); aDataSet->ShallowCopy(aGeometry); - const TVTKMergeFilter& aFilter = GetFilter(); aFilter->SetGeometry(aGeometry); aFilter->SetScalars(aDataSet); @@ -1322,26 +1320,15 @@ namespace int aNbTuples = theField->myDataSize/theField->myNbComp; std::string aFieldName = GenerateFieldName(theField,theValForTime); - vtkDataSetAttributes* aDataSetAttributes; - switch(theEntity){ - case VISU::NODE_ENTITY : - aDataSetAttributes = theSource->GetPointData(); - break; - default: - aDataSetAttributes = theSource->GetCellData(); - } - int aNbComp = theField->myNbComp; - vtkFloatArray *aFloatArray = vtkFloatArray::New(); - switch(aNbComp) { + vtkFloatArray *aFloatArray = vtkFloatArray::New(); + switch(aNbComp){ case 1: aFloatArray->SetNumberOfComponents(1); - aDataSetAttributes->SetScalars(aFloatArray); break; default: aFloatArray->SetNumberOfComponents(3); - aDataSetAttributes->SetVectors(aFloatArray); } aFloatArray->SetNumberOfTuples(aNbTuples); aFloatArray->SetName(aFieldName.c_str()); @@ -1350,7 +1337,6 @@ namespace aDataArray->SetNumberOfComponents(aNbComp); aDataArray->SetNumberOfTuples(aNbTuples); aDataArray->SetName("VISU_FIELD"); - aDataSetAttributes->AddArray(aDataArray); INITMSG(MYDEBUG,"GetTimeStampOnProfile "<< "- theEntity = "< aDataValues(aSize,0.0); + TVector aDataValues(aSize,0.0); TGeom2Value& aGeom2Value = theValForTime->myGeom2Value; TGeom2Value::const_iterator anIter = aGeom2Value.begin(); @@ -1389,8 +1375,29 @@ namespace aDataArray->SetTuple(aTupleId,&aDataValues[0]); } } + + vtkDataSetAttributes* aDataSetAttributes; + switch(theEntity){ + case VISU::NODE_ENTITY : + aDataSetAttributes = theSource->GetPointData(); + break; + default: + aDataSetAttributes = theSource->GetCellData(); + } + + switch(aNbComp) { + case 1: + aDataSetAttributes->SetScalars(aFloatArray); + break; + default: + aDataSetAttributes->SetVectors(aFloatArray); + } + + aDataSetAttributes->AddArray(aDataArray); + aFloatArray->Delete(); aDataArray->Delete(); + } diff --git a/src/CONVERTOR/VISU_ExtractUnstructuredGrid.cxx b/src/CONVERTOR/VISU_ExtractUnstructuredGrid.cxx index b3f59e63..ba36c3fd 100644 --- a/src/CONVERTOR/VISU_ExtractUnstructuredGrid.cxx +++ b/src/CONVERTOR/VISU_ExtractUnstructuredGrid.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include using namespace std; @@ -71,8 +73,22 @@ namespace{ } } -void VISU_ExtractUnstructuredGrid::Execute(){ - vtkUnstructuredGrid *anInput = this->GetInput(), *anOutput = this->GetOutput(); +int VISU_ExtractUnstructuredGrid::RequestData( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) +{ + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + + // get the input and ouptut + vtkUnstructuredGrid *anInput = vtkUnstructuredGrid::SafeDownCast( + inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkUnstructuredGrid *anOutput = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + + vtkIdType aNbCells = anInput->GetNumberOfCells(); anOutput->Allocate(aNbCells); MSG(MYDEBUG,"Execute - anInput->GetNumberOfCells() = "<GetNumberOfCells()); @@ -97,4 +113,6 @@ void VISU_ExtractUnstructuredGrid::Execute(){ aCellIds->Delete(); anOutput->SetPoints(anInput->GetPoints()); MSG(MYDEBUG,"Execute - anOutput->GetNumberOfCells() = "<GetNumberOfCells()); + + return 1; } diff --git a/src/CONVERTOR/VISU_ExtractUnstructuredGrid.hxx b/src/CONVERTOR/VISU_ExtractUnstructuredGrid.hxx index 6541f259..37567954 100644 --- a/src/CONVERTOR/VISU_ExtractUnstructuredGrid.hxx +++ b/src/CONVERTOR/VISU_ExtractUnstructuredGrid.hxx @@ -55,7 +55,7 @@ protected: VISU_ExtractUnstructuredGrid(); ~VISU_ExtractUnstructuredGrid(); - void Execute(); + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); std::set myRemovedCellIds; std::set myRemovedCellTypes; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 5ef4aa56..d614e523 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -56,10 +56,10 @@ using MED::TFloat; using MED::EBooleen; #ifdef _DEBUG_ -static int MYDEBUG = 1; -static int MYVALUEDEBUG = 1; -static int MY_FAMILY_DEBUG = 1; -static int MY_GROUP_DEBUG = 1; +static int MYDEBUG = 0; +static int MYVALUEDEBUG = 0; +static int MY_FAMILY_DEBUG = 0; +static int MY_GROUP_DEBUG = 0; //#define _DEXCEPT_ #else static int MYDEBUG = 0; diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index e2e9be32..8e4da0d0 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -30,7 +30,6 @@ #include "VISU_PipeLine.hxx" #include "VTKViewer_ShrinkFilter.h" #include "VTKViewer_GeometryFilter.h" -#include "VTKViewer_PassThroughFilter.h" #include #include @@ -50,6 +49,7 @@ #include #include #include +#include #include #include diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index 68efe38f..db41fee1 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -34,7 +34,6 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" -#include "VTKViewer_PassThroughFilter.h" #include #include @@ -42,6 +41,7 @@ #include #include #include +#include #include "utilities.h" @@ -69,7 +69,7 @@ VISU_GaussPtsDeviceActor myTransformFilter->Delete(); for(int i = 0; i < 3; i++){ - PPassThroughFilter aFilter(VTKViewer_PassThroughFilter::New()); + PPassThroughFilter aFilter(vtkPassThroughFilter::New()); myPassFilter.push_back(aFilter); aFilter->Delete(); } diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h index 24dcb7b2..afc40261 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.h +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.h @@ -36,11 +36,11 @@ class VTKViewer_Transform; class VTKViewer_TransformFilter; -class VTKViewer_PassThroughFilter; class VISU_OpenGLPointSpriteMapper; class VISU_GaussPointsPL; +class vtkPassThroughFilter; //============================================================================ class VISU_GaussPtsDeviceActor: public vtkLODActor @@ -90,7 +90,7 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor vtkSmartPointer myGeomFilter; vtkSmartPointer myTransformFilter; - typedef vtkSmartPointer PPassThroughFilter; + typedef vtkSmartPointer PPassThroughFilter; std::vector myPassFilter; VISU_GaussPtsDeviceActor(); diff --git a/src/OBJECT/VISU_VectorsAct.cxx b/src/OBJECT/VISU_VectorsAct.cxx index 6fc38567..0043541f 100644 --- a/src/OBJECT/VISU_VectorsAct.cxx +++ b/src/OBJECT/VISU_VectorsAct.cxx @@ -28,14 +28,13 @@ #include "VISU_VectorsAct.h" #include "VISU_VectorsPL.hxx" -#include "VTKViewer_PassThroughFilter.h" // VTK Includes #include #include #include #include - +#include //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_VectorsAct); diff --git a/src/PIPELINE/Makefile.in b/src/PIPELINE/Makefile.in index 853f337d..ea6f2056 100644 --- a/src/PIPELINE/Makefile.in +++ b/src/PIPELINE/Makefile.in @@ -110,6 +110,6 @@ LDFLAGS+= \ $(GUI_LDFLAGS) \ $(MED_LDFLAGS) -LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lmed_V2_1 -lsuit -lqtx -lSALOMEBasics +LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lmed_V2_1 -lsuit -lqtx -lSALOMEBasics -lvtkWidgets @CONCLUDE@ diff --git a/src/PIPELINE/SALOME_ExtractGeometry.cxx b/src/PIPELINE/SALOME_ExtractGeometry.cxx index 03cf524c..801436b1 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.cxx +++ b/src/PIPELINE/SALOME_ExtractGeometry.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -166,10 +168,25 @@ SALOME_ExtractGeometry //---------------------------------------------------------------------------- -void +int SALOME_ExtractGeometry -::Execute() +::RequestData( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { + vtkInformation* aRequest; + + // 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())); + vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + //cout << "SALOME_ExtractGeometry::input"<Print(cout); myElemVTK2ObjIds.clear(); myNodeVTK2ObjIds.clear(); // @@ -182,18 +199,32 @@ SALOME_ExtractGeometry } if(myIsDoneShallowCopy){ - GetOutput()->ShallowCopy(GetInput()); + output->ShallowCopy(input); Modified(); - return; + return 1; } - Execute2(); + return RequestData2(aRequest,inputVector,outputVector); } -void +int SALOME_ExtractGeometry -::Execute2() +::RequestData2( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) { + + // 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())); + vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkIdType ptId, numPts, numCells, i, cellId, newCellId, newId, *pointMap; vtkIdList *cellPts; vtkCell *cell; @@ -202,10 +233,8 @@ SALOME_ExtractGeometry vtkFloatingPointType multiplier; vtkPoints *newPts; vtkIdList *newCellPts; - vtkDataSet *input = this->GetInput(); vtkPointData *pd = input->GetPointData(); vtkCellData *cd = input->GetCellData(); - vtkUnstructuredGrid *output = this->GetOutput(); vtkPointData *outputPD = output->GetPointData(); vtkCellData *outputCD = output->GetCellData(); int npts; @@ -215,7 +244,7 @@ SALOME_ExtractGeometry if ( ! this->ImplicitFunction ) { vtkErrorMacro(<<"No implicit function specified"); - return; + return 0; } newCellPts = vtkIdList::New(); @@ -369,4 +398,6 @@ SALOME_ExtractGeometry } output->Squeeze(); + + return 1; } diff --git a/src/PIPELINE/SALOME_ExtractGeometry.h b/src/PIPELINE/SALOME_ExtractGeometry.h index 6fcb07b6..f99d1ba2 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.h +++ b/src/PIPELINE/SALOME_ExtractGeometry.h @@ -72,8 +72,9 @@ protected: SALOME_ExtractGeometry(); ~SALOME_ExtractGeometry(); - virtual void Execute(); - void Execute2(); + // Usual data generation method + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + virtual int RequestData2(vtkInformation *, vtkInformationVector **, vtkInformationVector *); private: bool myStoreMapping; diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 6bf73009..8d61b4e1 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -27,6 +27,7 @@ #include "VISU_Convertor.hxx" #include "VISU_MeshPL.hxx" #include "VISU_ScalarMapPL.hxx" +#include "VISU_PrsMergerPL.hxx" #include "VISU_IsoSurfacesPL.hxx" #include "VISU_CutPlanesPL.hxx" #include "VISU_CutLinesPL.hxx" @@ -36,7 +37,7 @@ #include "VISU_GaussPointsPL.hxx" #include "VISU_Plot3DPL.hxx" -typedef VISU_GaussPointsPL TPresent; +typedef VISU_ScalarMapPL TPresent; #include #include @@ -47,6 +48,7 @@ typedef VISU_GaussPointsPL TPresent; #include #include #include +#include #include @@ -56,11 +58,9 @@ using namespace std; static int isOnlyMesh = false; -int main(int argc, char** argv) -{ - try { - if(argc > 1) - { +int main(int argc, char** argv){ + try{ + if(argc > 1){ vtkRenderWindow *renWin = vtkRenderWindow::New(); vtkRenderer *ren = vtkRenderer::New(); renWin->AddRenderer(ren); @@ -78,43 +78,46 @@ int main(int argc, char** argv) const VISU::PMesh aMesh = aMeshMapIter->second; const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter; - if(isOnlyMesh) - { - const VISU::TEntity& anEntity = VISU::CELL_ENTITY; - aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity); + if(isOnlyMesh){ + const VISU::TEntity& anEntity = VISU::CELL_ENTITY; + aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity); - VISU::PIDMapper anIDMapper = - aConvertor->GetMeshOnEntity(aMeshName,anEntity); - VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); + VISU::PIDMapper anIDMapper = + aConvertor->GetMeshOnEntity(aMeshName,anEntity); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); - VISU_MeshPL* aPresent = VISU_MeshPL::New(); - aPresent->SetInput(aDataSet); - aPresent->Build(); + VISU_MeshPL* aPresent = VISU_MeshPL::New(); + aPresent->SetInput(aDataSet); + aPresent->Build(); - vtkActor* aActor = vtkActor::New(); - aActor->SetMapper(aPresent->GetMapper()); - aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); - //ren->ResetCameraClippingRange(); + vtkActor* aActor = vtkActor::New(); + aActor->SetMapper(aPresent->GetMapper()); + aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); + //ren->ResetCameraClippingRange(); - ren->AddActor(aActor); + ren->AddActor(aActor); - renWin->Render(); - iren->Start(); - return 0; + renWin->Render(); + iren->Start(); + return 0; } //Import fields aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); + cout << "Input iteration:"; + int aIter; + cin >> aIter; + int aCount = 0; for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) { const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ + for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++,aCount++){ const VISU::PField aField = aFieldMapIter->second; - /* - if(aField->myNbComp == 1) + if(aCount != aIter) continue; - */ +// if(aField->myNbComp == 1) +// continue; const string& aFieldName = aFieldMapIter->first; const VISU::TValField& aValField = aField->myValField; VISU::TValField::const_iterator aValFieldIter = aValField.begin(); @@ -122,15 +125,8 @@ int main(int argc, char** argv) int aTimeStamp = aValFieldIter->first; TPresent* aPresent = TPresent::New(); - VISU::PIDMapper anIDMapper; - if(anEntity != VISU::NODE_ENTITY){ - VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); - aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper); - }else{ - continue; - VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - aPresent->SetIDMapper(anIDMapper); - } + VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + aPresent->SetIDMapper(anIDMapper); aPresent->Build(); aPresent->Init(); @@ -145,11 +141,8 @@ int main(int argc, char** argv) strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" ); //cout << anAlphaTexture << endl; - vtkSmartPointer aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); - aPresent->SetImageData( aTextureValue.GetPointer() ); - aPresent->Update(); - + vtkActor* anActor = vtkActor::New(); anActor->SetMapper(aPresent->GetMapper()); @@ -167,11 +160,9 @@ int main(int argc, char** argv) } } } - } - catch(std::exception& exc){ + }catch(std::exception& exc){ MESSAGE("Follow exception was occured :\n"<GetNumberOfInputs(); - for(int i = iEnd-1; i >= 0; i--) - theAppendPolyData->RemoveInput(theAppendPolyData->GetInput(i)); + theAppendPolyData->RemoveAllInputs(); } vtkFloatingPointType* diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 0a69dc9b..b430876e 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -43,10 +43,12 @@ VISU_DeformedShapePL VISU_DeformedShapePL ::~VISU_DeformedShapePL() { - myWarpVector->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myWarpVector->UnRegisterAllOutputs(); myWarpVector->Delete(); - myCellDataToPointData->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myCellDataToPointData->UnRegisterAllOutputs(); myCellDataToPointData->Delete(); } diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index c33d071a..03a20ae8 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -34,6 +34,9 @@ #include #include #include +#include +#include + using namespace std; @@ -56,15 +59,20 @@ void VISU_Extractor::SetScalarMode(int theScalarMode) } } -template void +template int execute(int theNbElems, int theScalarMode, TypeData* theInputData, TypeData* theOutputData) { if(theNbElems < 1 ) - return; - vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD"); + return 0; + + if(theInputData->GetNumberOfArrays() < 1) + return 1; // no fields output + + string aFieldName = "VISU_FIELD"; + vtkDataArray* aFieldArray = theInputData->GetArray(aFieldName.c_str()); if(vtkFloatArray *aFloatArray = dynamic_cast(aFieldArray)){ int aNbComp = aFloatArray->GetNumberOfComponents(); std::vector anArray(aNbComp < 3? 3: aNbComp); @@ -89,10 +97,29 @@ execute(int theNbElems, theOutputData->SetScalars(aScalars); aScalars->Delete(); } + return 1; } -void VISU_Extractor::Execute(){ - vtkDataSet *input = this->GetInput(), *output = this->GetOutput(); +// waiting for porting vtkSource to the new executive-based pipeline architecture. +// int VISU_Extractor::RequestData( +// vtkInformation *vtkNotUsed(request), +// vtkInformationVector **inputVector, +// vtkInformationVector *outputVector) +void VISU_Extractor::Execute() +{ + int aRet = 1; +// waiting for porting vtkSource to the new executive-based pipeline architecture. +// // 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())); +// vtkDataSet *output = vtkDataSet::SafeDownCast( +// outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkDataSet *input = this->GetInput(); + vtkDataSet *output = this->GetOutput(); output->CopyStructure(input); output->GetPointData()->CopyAllOff(); output->GetCellData()->CopyAllOff(); @@ -101,7 +128,7 @@ void VISU_Extractor::Execute(){ int aNbElems = input->GetNumberOfPoints(); vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData(); if(!inData->GetAttribute(vtkDataSetAttributes::SCALARS)) - execute(aNbElems,myScalarMode,inData,outData); + aRet = execute(aNbElems,myScalarMode,inData,outData); else output->GetPointData()->CopyScalarsOn(); outData->PassData(inData); @@ -111,10 +138,12 @@ void VISU_Extractor::Execute(){ int aNbElems = input->GetNumberOfCells(); vtkCellData *inData = input->GetCellData(), *outData = output->GetCellData(); if(inData->GetAttribute(vtkDataSetAttributes::VECTORS)) - execute(aNbElems,myScalarMode,inData,outData); + aRet = execute(aNbElems,myScalarMode,inData,outData); else output->GetCellData()->CopyScalarsOn(); outData->PassData(inData); outData->AddArray(inData->GetArray("VISU_FIELD")); } + + // return aRet; } diff --git a/src/PIPELINE/VISU_Extractor.hxx b/src/PIPELINE/VISU_Extractor.hxx index 797f9af1..2ddc57ab 100644 --- a/src/PIPELINE/VISU_Extractor.hxx +++ b/src/PIPELINE/VISU_Extractor.hxx @@ -42,6 +42,8 @@ protected: VISU_Extractor(const VISU_Extractor&); ~VISU_Extractor(); + // waiting for porting vtkSource to the new executive-based pipeline architecture. + //virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual void Execute(); int myScalarMode; diff --git a/src/PIPELINE/VISU_FieldTransform.cxx b/src/PIPELINE/VISU_FieldTransform.cxx index 598a36e2..e0f1516c 100644 --- a/src/PIPELINE/VISU_FieldTransform.cxx +++ b/src/PIPELINE/VISU_FieldTransform.cxx @@ -29,6 +29,8 @@ #include #include #include +#include +#include static vtkFloatingPointType Tolerance = 1.0 / VTK_LARGE_FLOAT; @@ -71,13 +73,6 @@ VISU_FieldTransform } -void -VISU_FieldTransform -::Update() -{ - vtkSource::Update(); -} - unsigned long VISU_FieldTransform ::GetMTime() @@ -230,11 +225,27 @@ ExecScalars(VISU_FieldTransform::TTransformFun theFunction, aNewScalars->Delete(); } -void +// waiting for porting vtkSource to the new executive-based pipeline architecture. +int VISU_FieldTransform -::Execute() +::RequestData( + vtkInformation *vtkNotUsed(request), + vtkInformationVector **inputVector, + vtkInformationVector *outputVector) +// void VISU_FieldTransform::Execute() { - vtkDataSet *input = this->GetInput(), *output = this->GetOutput(); + // 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())); + vtkDataSet *output = vtkDataSet::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); +// vtkDataSet *input = this->GetInput(); +// vtkDataSet *output = this->GetOutput(); + output->CopyStructure(input); if(myFunction != &Ident || (myTransform && !myTransform->IsIdentity())){ output->GetPointData()->CopyAllOff(); @@ -252,4 +263,6 @@ VISU_FieldTransform output->GetPointData()->PassData(input->GetPointData()); output->GetCellData()->PassData(input->GetCellData()); } + + return 1; } diff --git a/src/PIPELINE/VISU_FieldTransform.hxx b/src/PIPELINE/VISU_FieldTransform.hxx index f84e0b4d..c8959a3c 100644 --- a/src/PIPELINE/VISU_FieldTransform.hxx +++ b/src/PIPELINE/VISU_FieldTransform.hxx @@ -20,26 +20,25 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // -// File : VISU_Extractor.hxx +// File : VISU_FieldTransform.hxx // Author : Alexey PETROV // Module : VISU #ifndef VISU_FieldTransform_HeaderFile #define VISU_FieldTransform_HeaderFile -#include +#include #include "VTKViewer.h" class VTKViewer_Transform; -class VTK_EXPORT VISU_FieldTransform : public vtkDataSetToDataSetFilter +class VTK_EXPORT VISU_FieldTransform : public vtkDataSetAlgorithm { public: - vtkTypeMacro(VISU_FieldTransform,vtkDataSetToDataSetFilter); + vtkTypeMacro(VISU_FieldTransform,vtkDataSetAlgorithm); static VISU_FieldTransform *New(); - virtual void Update(); virtual unsigned long GetMTime(); static double Ident(double theArg); @@ -59,9 +58,14 @@ public: protected: VISU_FieldTransform(); virtual ~VISU_FieldTransform(); + + // waiting for porting vtkSource to the new executive-based pipeline architecture. + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + // virtual void Execute(); + VISU_FieldTransform(const VISU_FieldTransform&) {}; void operator=(const VISU_FieldTransform&) {}; - void Execute(); + VTKViewer_Transform *myTransform; TTransformFun myFunction; diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 3ffc7564..0c29c689 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -32,7 +32,6 @@ #include "SALOME_ExtractGeometry.h" #include "VISU_DeformedShapePL.hxx" #include "VISU_OpenGLPointSpriteMapper.hxx" -#include "VTKViewer_PassThroughFilter.h" #include #include @@ -43,6 +42,7 @@ #include #include #include +#include //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_GaussPointsPL); @@ -81,7 +81,7 @@ VISU_GaussPointsPL myGlyph->SetSource( mySphereSource->GetOutput() ); for(int i = 0; i < 2; i++) - myPassFilter.push_back(VTKViewer_PassThroughFilter::New()); + myPassFilter.push_back(vtkPassThroughFilter::New()); } @@ -311,7 +311,7 @@ VISU_GaussPointsPL ::GetNodeCoord(int theObjID) { vtkIdType anID = GetNodeVTKID(theObjID); - vtkDataSet* aDataSet = myGeomFilter->GetInput(); + vtkDataSet* aDataSet = myGeomFilter->GetPolyDataInput(0); return aDataSet->GetPoint(anID); } diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index f0698f4f..f0e984a9 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -34,7 +34,6 @@ #include -class VTKViewer_PassThroughFilter; class VISU_OpenGLPointSpriteMapper; class vtkGeometryFilter; @@ -43,6 +42,7 @@ class vtkSphereSource; class vtkDataArray; class vtkImageData; class vtkPointSet; +class vtkPassThroughFilter; class vtkCellDataToPointData; class vtkWarpVector; @@ -269,7 +269,7 @@ protected: vtkFloatingPointType myScaleFactor; vtkWarpVector *myWarpVector; vtkCellDataToPointData* myCellDataToPointData; - std::vector myPassFilter; + std::vector myPassFilter; vtkGlyph3D* myGlyph; vtkSphereSource* mySphereSource; diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index c8b9eaea..eeb0093f 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -44,10 +44,12 @@ VISU_IsoSurfacesPL VISU_IsoSurfacesPL ::~VISU_IsoSurfacesPL() { - myContourFilter->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myContourFilter->UnRegisterAllOutputs(); myContourFilter->Delete(); - myCellDataToPointData->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myCellDataToPointData->UnRegisterAllOutputs(); myCellDataToPointData->Delete(); } diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 6f0edac8..c5300468 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -27,7 +27,7 @@ #include "VISU_OpenGLPointSpriteMapper.hxx" -#include +#include "SVTK_Extension.h" #include #include diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 9c553cf9..8ea35b9a 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -152,7 +152,6 @@ VISU_PipeLine { if(theInput) theInput->Update(); - myExtractGeometry->SetInput(theInput); myInput = theInput; diff --git a/src/PIPELINE/VISU_PrsMergerPL.cxx b/src/PIPELINE/VISU_PrsMergerPL.cxx index 9b46c9fb..8701c47f 100644 --- a/src/PIPELINE/VISU_PrsMergerPL.cxx +++ b/src/PIPELINE/VISU_PrsMergerPL.cxx @@ -27,7 +27,6 @@ #include "VISU_PrsMergerPL.hxx" #include "VISU_MeshPL.hxx" #include "VISU_ScalarMapPL.hxx" -#include "VISU_MergeFilter.hxx" #include "VISU_IDMapper.hxx" #include "VTKViewer_AppendFilter.h" @@ -65,7 +64,6 @@ VISU_PrsMergerPL { myScalars = NULL; - //myMergeFilter->Delete(); myMeshGeometryList.clear(); } diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 624159f5..6f7fbebb 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index 60c3bf5b..a2aa2938 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -29,9 +29,10 @@ #include "VISU_PipeLineUtils.hxx" #include "VTKViewer_TransformFilter.h" #include "VTKViewer_Transform.h" +#include "VISU_MergeFilter.hxx" #include -#include + #include #include #include @@ -52,7 +53,7 @@ VISU_ScalarMapOnDeformedShapePL ::VISU_ScalarMapOnDeformedShapePL() { myDeformVectors = vtkWarpVector::New(); - myMergeFilter = vtkMergeFilter::New(); + myMergeFilter = VISU_MergeFilter::New(); myExtractorScalars = VISU_Extractor::New(); myCellDataToPointData = vtkCellDataToPointData::New(); } @@ -64,16 +65,20 @@ VISU_ScalarMapOnDeformedShapePL VISU_ScalarMapOnDeformedShapePL ::~VISU_ScalarMapOnDeformedShapePL() { - myDeformVectors->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myDeformVectors->UnRegisterAllOutputs(); myDeformVectors->Delete(); - myMergeFilter->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myMergeFilter->UnRegisterAllOutputs(); myMergeFilter->Delete(); - myExtractorScalars->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myExtractorScalars->UnRegisterAllOutputs(); myExtractorScalars->Delete(); - myCellDataToPointData->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myCellDataToPointData->UnRegisterAllOutputs(); myCellDataToPointData->Delete(); } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx index 6ac481af..ae76df9c 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -30,7 +30,7 @@ #include "VISUPipeline.hxx" #include "VISU_PrsMergerPL.hxx" -class vtkMergeFilter; +class VISU_MergeFilter; class vtkWarpVector; class vtkUnstructuredGrid; class vtkCellDataToPointData; @@ -90,7 +90,7 @@ public: protected: vtkFloatingPointType myScaleFactor; vtkWarpVector *myDeformVectors; - vtkMergeFilter *myMergeFilter; + VISU_MergeFilter *myMergeFilter; vtkSmartPointer myScalars; VISU_Extractor* myExtractorScalars; vtkCellDataToPointData* myCellDataToPointData; diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index 22d3f8b7..e64f40f9 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -60,16 +60,20 @@ VISU_StreamLinesPL::VISU_StreamLinesPL(){ } VISU_StreamLinesPL::~VISU_StreamLinesPL(){ - myPointsFilter->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myPointsFilter->UnRegisterAllOutputs(); myPointsFilter->Delete(); - myCenters->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myCenters->UnRegisterAllOutputs(); myCenters->Delete(); - myGeomFilter->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myGeomFilter->UnRegisterAllOutputs(); myGeomFilter->Delete(); - myStream->UnRegisterAllOutputs(); + // commented: porting to vtk5.0 + // myStream->UnRegisterAllOutputs(); myStream->Delete(); } diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index cef3b80d..498d6e90 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -218,7 +218,8 @@ OrientedPlane::~OrientedPlane() myMapper->RemoveAllInputs(); myMapper->Delete(); - myPlaneSource->UnRegisterAllOutputs(); + // commented: porting to vtk 5.0 + //myPlaneSource->UnRegisterAllOutputs(); myPlaneSource->Delete(); } diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index abbdd3f6..f02b2e8a 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -119,7 +119,8 @@ class TPlane : public SALOME_Actor ~TPlane() { myMapper->RemoveAllInputs(); myMapper->Delete(); - myPlaneSource->UnRegisterAllOutputs(); + // commented: porting to vtk 5.0 + //myPlaneSource->UnRegisterAllOutputs(); myPlaneSource->Delete(); }; // Not implemented. diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 6d1ec82e..f5a6e243 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -370,7 +370,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ aTitle = aTitle.simplifyWhiteSpace(); aTableOfReal->SetTitle(aTitle.latin1()); - int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs(); + int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputConnections(0); if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<GetTuple1(i); } if(aFilter){ - aFilter->UnRegisterAllOutputs(); + // commented: porting to vtk 5.0 + //aFilter->UnRegisterAllOutputs(); aFilter->Delete(); } } diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index ba959d3a..4e622a53 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -161,7 +161,8 @@ void VISU::StreamLines_i::ToStream(std::ostringstream& theStr){ VISU::StreamLines_i::~StreamLines_i(){ if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()"); - myAppendFilter->UnRegisterAllOutputs(); + // commented: porting to vtk 5.0 + //myAppendFilter->UnRegisterAllOutputs(); myAppendFilter->Delete(); } @@ -178,7 +179,7 @@ VISU::StreamLines_i::SetParams(CORBA::Double theIntStep, vtkPointSet* aSource = NULL; if(!thePrs3d->_is_nil()) if((aPrs3di = dynamic_cast(VISU::GetServant(thePrs3d).in()))){ - for(int i = myAppendFilter->GetNumberOfInputs()-1; i >= 0; i--) + for(int i = myAppendFilter->GetNumberOfInputConnections(0)-1; i >= 0; i--) myAppendFilter->RemoveInput(myAppendFilter->GetInput(i)); myAppendFilter->AddInput(aPrs3di->GetPL()->GetMapper()->GetInput()); aSource = myAppendFilter->GetOutput();