From: apo Date: Wed, 29 Nov 2006 14:00:05 +0000 (+0000) Subject: To improve memory size calculation X-Git-Tag: WP1_2_3_05-12-2006_cache_system~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6414ab16cb17fab3a755f53896d043670324e77e;p=modules%2Fvisu.git To improve memory size calculation --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 6d945d86..be9dbf29 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -419,8 +419,17 @@ VISU_Actor ::GetMemorySize() { vtkDataSet* aDataSet = GetMapper()->GetInput(); - unsigned long int aSize = aDataSet->GetActualMemorySize(); - return aSize * 1024; + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myGeomFilter->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + if(IsShrunk()){ + aDataSet = myShrinkFilter->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + return aSize; } //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 43314db9..eef5dbe2 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -99,6 +99,7 @@ VISU_DeformedShapePL return myScaleFactor; } +//---------------------------------------------------------------------------- void VISU_DeformedShapePL ::Init() @@ -117,6 +118,7 @@ VISU_DeformedShapePL SetScale(0.0); } +//---------------------------------------------------------------------------- VISU_ScalarMapPL::THook* VISU_DeformedShapePL ::DoHook() @@ -125,6 +127,7 @@ VISU_DeformedShapePL return myWarpVector->GetOutput(); } +//---------------------------------------------------------------------------- void VISU_DeformedShapePL ::Update() @@ -132,6 +135,24 @@ VISU_DeformedShapePL VISU_ScalarMapPL::Update(); } +//---------------------------------------------------------------------------- +unsigned long int +VISU_DeformedShapePL +::GetMemorySize() +{ + vtkDataSet* aDataSet = myCellDataToPointData->GetOutput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myWarpVector->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + aSize += Superclass::GetMemorySize(); + + return aSize; +} + + +//---------------------------------------------------------------------------- void VISU_DeformedShapePL ::SetMapScale(vtkFloatingPointType theMapScale) diff --git a/src/PIPELINE/VISU_DeformedShapePL.hxx b/src/PIPELINE/VISU_DeformedShapePL.hxx index 96c3d0eb..4049c668 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.hxx +++ b/src/PIPELINE/VISU_DeformedShapePL.hxx @@ -70,6 +70,11 @@ public: void Update(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 3905fdb4..d244c466 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -53,6 +53,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +//---------------------------------------------------------------------------- VISU_PipeLine ::VISU_PipeLine(): myMapper(vtkDataSetMapper::New()), @@ -75,12 +76,14 @@ VISU_PipeLine myIsShrinkable = false; } +//---------------------------------------------------------------------------- VISU_PipeLine ::~VISU_PipeLine() { if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<Delete(); } +//---------------------------------------------------------------------------- TInput* VISU_PipeLine ::GetInput() const @@ -137,6 +145,7 @@ VISU_PipeLine return myInput.GetPointer(); } +//---------------------------------------------------------------------------- vtkDataSet* VISU_PipeLine ::GetOutput() @@ -144,6 +153,7 @@ VISU_PipeLine return GetMapper()->GetInput(); } +//---------------------------------------------------------------------------- TInput* VISU_PipeLine ::GetInput2() const @@ -153,6 +163,7 @@ VISU_PipeLine return aDataSet; } +//---------------------------------------------------------------------------- void VISU_PipeLine ::SetInput(TInput* theInput) @@ -167,6 +178,7 @@ VISU_PipeLine myInput = theInput; } +//---------------------------------------------------------------------------- VISU_PipeLine::TMapper* VISU_PipeLine ::GetMapper() @@ -181,6 +193,7 @@ VISU_PipeLine return myMapper.GetPointer(); } +//---------------------------------------------------------------------------- void VISU_PipeLine ::Update() @@ -188,6 +201,7 @@ VISU_PipeLine myMapper->Update(); } +//---------------------------------------------------------------------------- size_t VISU_PipeLine ::CheckAvailableMemory(size_t theSize) @@ -205,6 +219,7 @@ VISU_PipeLine return 0; } +//---------------------------------------------------------------------------- size_t VISU_PipeLine ::GetAvailableMemory(size_t theSize, @@ -226,6 +241,23 @@ VISU_PipeLine return aMax; } +//---------------------------------------------------------------------------- +unsigned long int +VISU_PipeLine +::GetMemorySize() +{ + vtkDataSet* aDataSet = myExtractGeometry->GetInput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myExtractGeometry->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + aDataSet = GetMapper()->GetInput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + return aSize; +} + //------------------------ Clipping planes ----------------------------------- bool VISU_PipeLine @@ -247,6 +279,7 @@ VISU_PipeLine return true; } +//---------------------------------------------------------------------------- vtkPlane* VISU_PipeLine ::GetClippingPlane(vtkIdType theID) const @@ -265,6 +298,7 @@ VISU_PipeLine return aPlane; } +//---------------------------------------------------------------------------- void VISU_PipeLine ::RemoveAllClippingPlanes() @@ -276,6 +310,7 @@ VISU_PipeLine } } +//---------------------------------------------------------------------------- vtkIdType VISU_PipeLine ::GetNumberOfClippingPlanes() const @@ -287,6 +322,7 @@ VISU_PipeLine return 0; } +//---------------------------------------------------------------------------- static void ComputeBoundsParam (vtkDataSet* theDataSet, @@ -335,6 +371,7 @@ ComputeBoundsParam (vtkDataSet* theDataSet, theMinPnt[2] = aMinPnt[2]; } +//---------------------------------------------------------------------------- static void DistanceToPosition(vtkDataSet* theDataSet, @@ -350,6 +387,7 @@ DistanceToPosition(vtkDataSet* theDataSet, thePos[2] = aMinPnt[2]-theDirection[2]*aLength; } +//---------------------------------------------------------------------------- static void PositionToDistance (vtkDataSet* theDataSet, @@ -363,6 +401,7 @@ PositionToDistance (vtkDataSet* theDataSet, theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj); } +//---------------------------------------------------------------------------- void VISU_PipeLine ::SetPlaneParam(vtkFloatingPointType theDir[3], @@ -375,6 +414,7 @@ VISU_PipeLine thePlane->SetOrigin(anOrigin); } +//---------------------------------------------------------------------------- void VISU_PipeLine ::GetPlaneParam(vtkFloatingPointType theDir[3], @@ -388,10 +428,7 @@ VISU_PipeLine ::PositionToDistance(GetInput(),theDir,anOrigin,theDist); } -//======================================================================= -//function : IsPlanarInput -//purpose : -//======================================================================= +//---------------------------------------------------------------------------- bool VISU_PipeLine ::IsPlanarInput() const diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index e1027526..95bf380e 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -147,9 +147,14 @@ public: static size_t - GetAvailableMemory(size_t theSize = 16*1024*1024, + GetAvailableMemory(size_t theSize, size_t theMinSize = 1024*1024); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + // Clipping planes void RemoveAllClippingPlanes(); diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index 0c6b9903..755e4575 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -204,6 +204,7 @@ VISU_ScalarMapPL } +//---------------------------------------------------------------------------- void VISU_ScalarMapPL ::Init() @@ -212,6 +213,7 @@ VISU_ScalarMapPL SetSourceRange(); } +//---------------------------------------------------------------------------- void VISU_ScalarMapPL ::Build() @@ -220,6 +222,24 @@ VISU_ScalarMapPL } +//---------------------------------------------------------------------------- +unsigned long int +VISU_ScalarMapPL +::GetMemorySize() +{ + vtkDataSet* aDataSet = myExtractor->GetOutput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aDataSet = myFieldTransform->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + + aSize += Superclass::GetMemorySize(); + + return aSize; +} + + +//---------------------------------------------------------------------------- void VISU_ScalarMapPL ::Update() diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index de07ce2a..fb7be40a 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -114,6 +114,11 @@ public: void Update(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + virtual VISU_LookupTable* GetMapperTable(); diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 1ee0f33d..d319ad25 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -601,20 +601,23 @@ CORBA::Float VISU::Prs3d_i ::GetMemorySize() { - static int INCMEMORY = 4; - vtkDataSet* aDataSet = GetPipeLine()->GetMapper()->GetInput(); - CORBA::Float aSize = aDataSet->GetActualMemorySize() * INCMEMORY * 1024.0; - //cout<<"Prs3d_i::GetMemorySize - "<