]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve memory size calculation
authorapo <apo@opencascade.com>
Wed, 29 Nov 2006 17:05:42 +0000 (17:05 +0000)
committerapo <apo@opencascade.com>
Wed, 29 Nov 2006 17:05:42 +0000 (17:05 +0000)
12 files changed:
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Vectors_i.cc

index d1b0ad56ce41b49eb0830077a2af20bbbf258e06..c87601295895e91e909076f7573610daee1ab025 100644 (file)
@@ -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
index 47fbbd3a384f0445ce9035384fddcff47839021e..09ba29e6831bf2ca281316c8950d09b71e37d48a 100644 (file)
@@ -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();
index 68efe38fe013e13a759f2b0bc3771a4c48020bd2..1bf2ec18671e7d16a419ade72537755f78d711fa 100644 (file)
@@ -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()
index 24dcb7b225b90fb1b9e26010e6e46f4d6a25364d..633ac01bd9b81d1e1ecbcdae3765fe42e16de099 100644 (file)
@@ -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();
index eef5dbe2b05983abcf3504c9980b2e16c35f6879..c714e076763a6fefbfc46ab2bc11e16ff989df98 100644 (file)
@@ -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();
 
index 51b7547d732c81c45f8da5ee2747a678d0c6b735..65c7ab7e0b6ef6333fef543442970d6b028b1d9d 100644 (file)
@@ -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
index 5a53c7fbfd1c1a5c019f6631e3970cc8012ab000..7f5f1ca772c603e10670506f442aa9e84b0034c4 100644 (file)
@@ -102,6 +102,11 @@ public:
   void
   Update();
 
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+
   //! Update glyph.
   void
   UpdateGlyph();
index d244c466e26fb7b69a72c79eafc9a7138393e477..91c453a78e8f170f7e187bc339479ca7e25fc395 100644 (file)
@@ -252,9 +252,6 @@ VISU_PipeLine
   aDataSet = myExtractGeometry->GetOutput();
   aSize += aDataSet->GetActualMemorySize() * 1024;
 
-  aDataSet = GetMapper()->GetInput();
-  aSize += aDataSet->GetActualMemorySize() * 1024;
-
   return aSize;
 }
 
index 54a1db96e72a368ef0a25cace639a577aa82aae5..73edbdfda9151b7b5a16128fbccc10bc9a816526 100644 (file)
@@ -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;
index 9a47812d07dfc0f4156f6df40bc462c2f6e58c73..23b2c3f79e0838070ca588868324d80efe448f93 100644 (file)
@@ -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 = "<<float(aSize)<<"; aResult = "<<aResult);
+    }
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
index d319ad259d659aa62f53103e272c955987285ec6..62b64bb42f15298e447f52ec3868d354e8be83a8 100644 (file)
@@ -602,12 +602,14 @@ VISU::Prs3d_i
 ::GetMemorySize()
 {
   // To calculate memory used by VISU Converter
-  static int INCMEMORY = 2;
+  static int INCMEMORY = 4;
   vtkDataSet* aDataSet = GetPipeLine()->GetInput();
-  CORBA::Float aSize = aDataSet->GetActualMemorySize() * INCMEMORY / 1024.0;
+  CORBA::Float aSize = aDataSet->GetActualMemorySize() * INCMEMORY * 1024.0;
+  cout<<"Prs3d_i::GetMemorySize - "<<this<<"; aDataSet = "<<aSize / (1024.0 * 1024.0)<<endl;
 
   // To calculate memory used by VISU PipeLine
   aSize += GetPipeLine()->GetMemorySize();
+  cout<<"Prs3d_i::GetMemorySize - "<<this<<"; GetPipeLine = "<<aSize / (1024.0 * 1024.0)<<endl;
 
   // To calculate memory used by VISU Actos
   int anEnd = myActorCollection->GetNumberOfItems();
@@ -615,8 +617,10 @@ VISU::Prs3d_i
     if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
       if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
        aSize += anActor->GetMemorySize();
+       cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
       }
 
+  cout<<endl;
   // Convert to mega bytes
   return aSize / (1024.0 * 1024.0);
 }
index 5be3f8309333d4b4ca4c47ea2612519b83586ff0..3eea16a157ae65a3b7e4dc5ce730159edc212b8b 100644 (file)
@@ -70,7 +70,8 @@ VISU::Vectors_i
                                              theTimeStampNumber);
       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-      MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+      if(MYDEBUG) 
+       MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     }
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());