From: apo Date: Wed, 29 Nov 2006 17:05:42 +0000 (+0000) Subject: To improve memory size calculation X-Git-Tag: WP1_2_3_05-12-2006_cache_system~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=97d5fe1d3fb8d69d8a61cbaef31a09898b763bb6;p=modules%2Fvisu.git To improve memory size calculation --- diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index d1b0ad56..c8760129 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -246,9 +246,11 @@ unsigned long int VISU_GaussPtsAct ::GetMemorySize() { - unsigned long int aSize = Superclass::GetMemorySize(); vtkDataSet* aDataSet = myDeviceActor->GetMapper()->GetInput(); - aSize += aDataSet->GetActualMemorySize() * 1024; + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + //aSize += Superclass::GetMemorySize(); + return aSize; } @@ -1453,13 +1455,9 @@ VISU_GaussPtsAct1 ::GetMemorySize() { unsigned long int aSize = Superclass::GetMemorySize(); - { - vtkDataSet* aDataSet = myInsideDeviceActor->GetMapper()->GetInput(); - aSize += aDataSet->GetActualMemorySize() * 1024; - } - { - vtkDataSet* aDataSet = myOutsideDeviceActor->GetMapper()->GetInput(); - aSize += aDataSet->GetActualMemorySize() * 1024; + if(IsSegmentationEnabled()){ + aSize += myInsideDeviceActor->GetMemorySize(); + aSize += myOutsideDeviceActor->GetMemorySize(); } return aSize; } @@ -1538,6 +1536,17 @@ VISU_GaussPtsAct2 } +//---------------------------------------------------------------------------- +unsigned long int +VISU_GaussPtsAct2 +::GetMemorySize() +{ + if(IsSegmentationEnabled()) + return Superclass::GetMemorySize(); + return 0; +} + + //---------------------------------------------------------------------------- void VISU_GaussPtsAct2 diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 47fbbd3a..09ba29e6 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -478,6 +478,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + protected: //---------------------------------------------------------------------------- VISU_GaussPtsAct2(); diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index 68efe38f..1bf2ec18 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -152,6 +152,20 @@ VISU_GaussPtsDeviceActor return myMapper.GetPointer(); } +//---------------------------------------------------------------------------- +unsigned long int +VISU_GaussPtsDeviceActor +::GetMemorySize() +{ + vtkDataSet* aDataSet = GetMapper()->GetInput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + aSize += GetPipeLine()->GetMemorySize(); + + return aSize; +} + +//---------------------------------------------------------------------------- int VISU_GaussPtsDeviceActor ::GetPickable() diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h index 24dcb7b2..633ac01b 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.h +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.h @@ -79,6 +79,11 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor VISU_OpenGLPointSpriteMapper* GetPSMapper(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + virtual int GetPickable(); diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index eef5dbe2..c714e076 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -140,11 +140,13 @@ unsigned long int VISU_DeformedShapePL ::GetMemorySize() { - vtkDataSet* aDataSet = myCellDataToPointData->GetOutput(); + vtkDataSet* aDataSet = myWarpVector->GetOutput(); unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; - aDataSet = myWarpVector->GetOutput(); - aSize += aDataSet->GetActualMemorySize() * 1024; + if(myCellDataToPointData->GetInput()){ + aDataSet = myCellDataToPointData->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } aSize += Superclass::GetMemorySize(); diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 51b7547d..65c7ab7e 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -257,6 +257,33 @@ VISU_GaussPointsPL VISU_ScalarMapPL::Update(); } +//---------------------------------------------------------------------------- +unsigned long int +VISU_GaussPointsPL +::GetMemorySize() +{ + vtkDataSet* aDataSet = myGeomFilter->GetOutput(); + unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; + + if(myCellDataToPointData->GetInput()){ + aDataSet = myCellDataToPointData->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + if(GetIsDeformed()){ + aDataSet = myWarpVector->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + if(GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere){ + aDataSet = myGlyph->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } + + return aSize; +} + + //---------------------------------------------------------------------------- void VISU_GaussPointsPL diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 5a53c7fb..7f5f1ca7 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -102,6 +102,11 @@ public: void Update(); + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + //! Update glyph. void UpdateGlyph(); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index d244c466..91c453a7 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -252,9 +252,6 @@ VISU_PipeLine aDataSet = myExtractGeometry->GetOutput(); aSize += aDataSet->GetActualMemorySize() * 1024; - aDataSet = GetMapper()->GetInput(); - aSize += aDataSet->GetActualMemorySize() * 1024; - return aSize; } diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 54a1db96..73edbdfd 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -225,8 +225,10 @@ VISU_Plot3DPL vtkDataSet* aDataSet = myGeometryFilter->GetOutput(); unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024; - aDataSet = myCellDataToPointData->GetInput(); - aSize += aDataSet->GetActualMemorySize() * 1024; + if(myCellDataToPointData->GetInput()){ + aDataSet = myCellDataToPointData->GetOutput(); + aSize += aDataSet->GetActualMemorySize() * 1024; + } aDataSet = myContourFilter->GetInput(); aSize += aDataSet->GetActualMemorySize() * 1024; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 9a47812d..23b2c3f7 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -49,6 +49,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +static int INCMEMORY = 10; + //---------------------------------------------------------------------------- size_t VISU::GaussPoints_i @@ -60,8 +62,20 @@ VISU::GaussPoints_i bool theIsMemoryCheck) { try{ - if(theEntity != VISU::NODE) - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,theIsMemoryCheck); + if(theEntity == VISU::NODE) + return 0; + size_t aResult = VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,false); + if(theIsMemoryCheck && aResult){ + VISU::Result_i::TInput* anInput = theResult->GetInput(); + float aSize = anInput->GetTimeStampSize(theMeshName, + (VISU::TEntity)theEntity, + theFieldName, + theTimeStampNumber); + aSize *= INCMEMORY; + aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + if(MYDEBUG) + MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<GetInput(); - CORBA::Float aSize = aDataSet->GetActualMemorySize() * INCMEMORY / 1024.0; + CORBA::Float aSize = aDataSet->GetActualMemorySize() * INCMEMORY * 1024.0; + cout<<"Prs3d_i::GetMemorySize - "<