From: apo Date: Wed, 29 Nov 2006 15:03:07 +0000 (+0000) Subject: To improve memory size calculation X-Git-Tag: WP1_2_3_05-12-2006_cache_system~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25937bf51b38d7f7e75ef5f0d8f03ef40d66e2c6;p=modules%2Fvisu.git To improve memory size calculation --- diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index 789e1ebb..cefa247f 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -138,7 +138,6 @@ VISU_CutLinesPL GetDir(aDir[1],myAng[1],myBasePlane[1]); VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,aDataSet,GetNbParts(),aDir[1],aBounds, myPartPosition,myPartCondition,myDisplacement[1]); - anAppendPolyData->Register(myAppendPolyData); anAppendPolyData->Delete(); //Calculate values for building of table vtkMath::Cross(aDir[0],aDir[1],myDirLn); diff --git a/src/PIPELINE/VISU_CutLinesPL.hxx b/src/PIPELINE/VISU_CutLinesPL.hxx index 7406610e..a151f616 100644 --- a/src/PIPELINE/VISU_CutLinesPL.hxx +++ b/src/PIPELINE/VISU_CutLinesPL.hxx @@ -31,7 +31,8 @@ class vtkAppendPolyData; -class VISU_CutLinesPL : public VISU_CutPlanesPL{ +class VISU_CutLinesPL : public VISU_CutPlanesPL +{ protected: VISU_CutLinesPL(); VISU_CutLinesPL(const VISU_CutLinesPL&); diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index a5af21f5..745206d8 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -74,14 +74,14 @@ VISU_CutPlanesPL for (int i = 0, iend = GetNbParts(); i < iend; i++) if(!aPipeLine->IsPartDefault(i)) SetPartPosition(i, aPipeLine->GetPartPosition(i)); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + Superclass::ShallowCopy(thePipeLine); } void VISU_CutPlanesPL ::Init() { - VISU_ScalarMapPL::Init(); + Superclass::Init(); SetNbParts(10); myBasePlane[0] = YZ; @@ -110,9 +110,30 @@ VISU_CutPlanesPL CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds, myPartPosition,myPartCondition,myDisplacement[0]); - VISU_ScalarMapPL::Update(); + Superclass::Update(); } +//---------------------------------------------------------------------------- +unsigned long int +VISU_CutPlanesPL +::GetMemorySize() +{ + vtkDataSet* aDataSet = myAppendPolyData->GetOutput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + int anEnd = myAppendPolyData->GetNumberOfInputs(); + for(int anId = 0; anId < anEnd; anId++){ + aDataSet = myAppendPolyData->GetInput(anId); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + aSize += Superclass::GetMemorySize(); + + return aSize; +} + + +//---------------------------------------------------------------------------- void VISU_CutPlanesPL ::SetPartPosition(int theNum) @@ -390,7 +411,6 @@ VISU_CutPlanesPL aCutPlane->SetCutFunction(aPlane); aPlane->Delete(); theAppendPolyData->AddInput(aCutPlane->GetOutput()); - aCutPlane->Register(theAppendPolyData); aCutPlane->Delete(); } diff --git a/src/PIPELINE/VISU_CutPlanesPL.hxx b/src/PIPELINE/VISU_CutPlanesPL.hxx index 5dc01d39..5d0da26f 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.hxx +++ b/src/PIPELINE/VISU_CutPlanesPL.hxx @@ -33,7 +33,8 @@ class vtkAppendPolyData; -class VISU_CutPlanesPL : public VISU_ScalarMapPL{ +class VISU_CutPlanesPL : public VISU_ScalarMapPL +{ protected: VISU_CutPlanesPL(); VISU_CutPlanesPL(const VISU_CutPlanesPL&); @@ -116,6 +117,11 @@ public: void Update(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + virtual vtkAppendPolyData* GetAppendPolyData() diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 8875badb..54a1db96 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -77,7 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine) SetContourPrs( aPipeLine->GetIsContourPrs() ); SetNumberOfContours( aPipeLine->GetNumberOfContours() ); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + Superclass::ShallowCopy(thePipeLine); } VISU_CutPlanesPL::PlaneOrientation @@ -133,7 +133,7 @@ void VISU_Plot3DPL:: Init() { - VISU_ScalarMapPL::Init(); + Superclass::Init(); myOrientation = GetOrientation(GetInput2()); SetScaleFactor(GetScaleFactor(GetInput2())); @@ -213,12 +213,43 @@ Update() myWarpScalar->SetNormal(aPlaneNormal); - VISU_ScalarMapPL::Update(); + Superclass::Update(); } + +//---------------------------------------------------------------------------- +unsigned long int +VISU_Plot3DPL +::GetMemorySize() +{ + vtkDataSet* aDataSet = myGeometryFilter->GetOutput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myCellDataToPointData->GetInput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myContourFilter->GetInput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myWarpScalar->GetInput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + int anEnd = myAppendPolyData->GetNumberOfInputs(); + for(int anId = 0; anId < anEnd; anId++){ + aDataSet = myAppendPolyData->GetInput(anId); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + aSize += Superclass::GetMemorySize(); + + return aSize; +} + + +//---------------------------------------------------------------------------- void -VISU_Plot3DPL:: -SetNumberOfContours(int theNumber) +VISU_Plot3DPL +::SetNumberOfContours(int theNumber) { myContourFilter->SetNumberOfContours(theNumber); } @@ -409,7 +440,7 @@ void VISU_Plot3DPL ::SetMapScale(vtkFloatingPointType theMapScale) { - VISU_ScalarMapPL::SetMapScale(theMapScale); + Superclass::SetMapScale(theMapScale); if ( myIsContour ) { vtkFloatingPointType aRange[2]; diff --git a/src/PIPELINE/VISU_Plot3DPL.hxx b/src/PIPELINE/VISU_Plot3DPL.hxx index 93044d79..d2fd79fb 100644 --- a/src/PIPELINE/VISU_Plot3DPL.hxx +++ b/src/PIPELINE/VISU_Plot3DPL.hxx @@ -35,7 +35,8 @@ class vtkContourFilter; class vtkGeometryFilter; class vtkCellDataToPointData; -class VISU_Plot3DPL : public VISU_ScalarMapPL{ +class VISU_Plot3DPL : public VISU_ScalarMapPL +{ protected: VISU_Plot3DPL(); VISU_Plot3DPL(const VISU_Plot3DPL&); @@ -91,16 +92,28 @@ public: int GetNumberOfContours() const; - void GetBasePlane (vtkFloatingPointType theOrigin[3], - vtkFloatingPointType theNormal[3], - bool theCenterOrigine = false ) const; + void + GetBasePlane (vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], + bool theCenterOrigine = false ) const; + + void + GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const; + +public: + virtual + void + Init(); - void GetMinMaxPosition( vtkFloatingPointType& minPos, - vtkFloatingPointType& maxPos ) const; + virtual + void + Update(); -public: - virtual void Init(); - virtual void Update(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); static VISU_CutPlanesPL::PlaneOrientation