]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve memory size calculation
authorapo <apo@opencascade.com>
Wed, 29 Nov 2006 15:03:07 +0000 (15:03 +0000)
committerapo <apo@opencascade.com>
Wed, 29 Nov 2006 15:03:07 +0000 (15:03 +0000)
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutLinesPL.hxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_Plot3DPL.hxx

index 789e1ebb2d0f340db5f55baa6455996bf7a23a8a..cefa247febfac3070f418bceaa3b46308723170b 100644 (file)
@@ -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);
index 7406610e0ba024cfb20f3e3382d1b5848050ef9a..a151f616a2edb3a29ea74168df974a6a2daf55f8 100644 (file)
@@ -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&);
index a5af21f509754b77de5680d607702110f9da0028..745206d857df358f7e943fb9ef7f3a847c08401a 100644 (file)
@@ -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();
 }
 
index 5dc01d397576931068be304975555c67afb8c18e..5d0da26f56b96fde84d4848bd0e1e1826d60a6d0 100644 (file)
@@ -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() 
index 8875badb741d898a8b2a9cfa691a917bc45efdd1..54a1db96e72a368ef0a25cace639a577aa82aae5 100644 (file)
@@ -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];
index 93044d79bce6fb040e38d4eacc25bdddd35a335b..d2fd79fb27c4f0553c28599ef14b5b5a014239d9 100644 (file)
@@ -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