]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement more accurate memory size calculation
authorapo <apo@opencascade.com>
Mon, 4 Dec 2006 06:49:10 +0000 (06:49 +0000)
committerapo <apo@opencascade.com>
Mon, 4 Dec 2006 06:49:10 +0000 (06:49 +0000)
13 files changed:
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_IDMapper.hxx
src/OBJECT/VISU_Actor.cxx
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_Vectors_i.cc

index 60ce65673b63b74dd5c88197e35d95aeeca090b7..b5814d6adc3f18260aeb038b8d5ea5d043bd7b46 100644 (file)
@@ -91,8 +91,8 @@ void parseFile(const char* theFileName)
            if(anEntity != VISU::NODE_ENTITY){
              VISU::PGaussPtsIDMapper aGaussMesh = 
                aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
-             VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput();
              /*
+             VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput();
              int aNbCells = aDataSet->GetNumberOfCells();
              for(int anCellId = 0; anCellId < aNbCells; anCellId++){
                VISU::TGaussPointID anObjID = aGaussMesh->GetObjID(anCellId);
@@ -102,8 +102,8 @@ void parseFile(const char* theFileName)
            }else{
              VISU::PIDMapper anIDMapper = 
                aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-             VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
              /*
+             VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
              int aNbCells = aDataSet->GetNumberOfCells();
              for(int anCellId = 0; anCellId < aNbCells; anCellId++){
                int anObjID = anIDMapper->GetElemObjID(anCellId);
@@ -132,9 +132,9 @@ void parseFile(const char* theFileName)
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
        VISU::PIDMapper anIDMapper = aCon->GetMeshOnEntity(aMeshName,anEntity);
-       VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
        {
          /*
+         VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
          int aNbCells, anCellId, anObjID, aVTKID;
          aNbCells = aDataSet->GetNumberOfCells();
          for(anCellId = 0; anCellId < aNbCells; anCellId++){
index 286a81a144c69b4e9fa810c8f2faca8c985ae189..2a819f897c4bdf33059f9d81b7a4bebf3ccbda0b 100644 (file)
@@ -365,13 +365,21 @@ public:
                         const std::string& theFieldName,
                         int theStampsNum) = 0;
    
-  //! Get amount of memory to build mesh for corresponding MED TIMESTAMP
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
   size_t
-  GetTimeStampSize(const std::string& theMeshName, 
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFieldName,
-                  int theStampsNum) = 0;
+  GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theStampsNum) = 0;
+    
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
+  virtual 
+  size_t
+  GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theStampsNum) = 0;
     
   //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD
   virtual 
index 067ec8cb1ad56065d3ffd3ba203289f971348027..4bfe9a5be946dc44c1be099a5b455d676dd9b753 100644 (file)
@@ -67,6 +67,37 @@ static int MYDEBUGWITHFILES = 0;
 
 namespace VISU
 {
+  //---------------------------------------------------------------
+  /*! Computes number of points by the given number of cells
+   *  in assumption of regular hexahedral mesh structure
+   */
+  size_t
+  GetNumberofPoints(size_t theNbCells)
+  {
+    return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
+  }
+
+  //---------------------------------------------------------------
+  /*! Computes size dataset the given number of mesh macro metrics
+   *  in assumption of regular hexahedral mesh structure
+   */
+  size_t
+  GetDataSetSize(size_t theNbOfPoints,
+                size_t theNbOfCells,
+                size_t theCellsSize,
+                bool theComputeLinks)
+  {
+    size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
+    size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
+    size_t aLocationsSize = theNbOfCells*sizeof(int);
+    vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
+    size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
+    if(!theComputeLinks)
+      aLinksSize = 0;
+    size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+    return aResult;
+  }
+
   //---------------------------------------------------------------
   TIsVTKDone::TIsVTKDone(): 
     myIsVTKDone(false),
@@ -103,6 +134,35 @@ namespace VISU
     return GetSource().GetPointer();
   }
 
+  unsigned long int
+  TSource
+  ::GetMemorySize()
+  {
+    if(TVTKOutput* anOutput = GetVTKOutput()){
+      anOutput->Update();
+      return GetVTKOutput()->GetActualMemorySize() * 1024;
+    }
+    if(myIsDone){
+      size_t aNbPoints = GetNumberofPoints(myNbCells);
+      return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
+    }
+    throw std::runtime_error("TSource::GetMemorySize - myIsDone == false !!!");
+    return 0;
+  }
+
+  //---------------------------------------------------------------
+  unsigned long int
+  TMemoryCheckIDMapper
+  ::GetMemorySize()
+  {
+    if(myIsVTKDone){
+      GetVTKOutput()->Update();
+      return GetVTKOutput()->GetActualMemorySize() * 1024;
+    }else
+      throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
+    return 0;
+  }
+
 
   //---------------------------------------------------------------
   TAppendFilter::TAppendFilter()
@@ -128,7 +188,6 @@ namespace VISU
     return GetFilter()->GetOutput();
   }
 
-
   //---------------------------------------------------------------
   TMergeFilter::TMergeFilter()
   {}
@@ -152,7 +211,6 @@ namespace VISU
     return GetFilter()->GetUnstructuredGridOutput();
   }
 
-
   //---------------------------------------------------------------
   TPointCoords
   ::TPointCoords():
@@ -186,6 +244,15 @@ namespace VISU
     return TCoordSlice(myCoord,std::slice(theNodeId*myDim,myDim,1));
   }
 
+  unsigned long int
+  TPointCoords
+  ::GetMemorySize()
+  {
+    size_t aSize = sizeof(TCoord) * myCoord.size();
+    aSize += myPoints->GetActualMemorySize() * 1024;
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   void
@@ -271,6 +338,15 @@ namespace VISU
     return theID;
   }
 
+  unsigned long int
+  TSubProfileImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TSource::GetMemorySize();
+    aSize += sizeof(vtkIdType) * mySubMeshID.size();
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   bool
@@ -369,6 +445,18 @@ namespace VISU
     return anAppendFilter->GetOutput();
   }
 
+  unsigned long int
+  TProfileImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilter::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    for(size_t anId = 0; anId < mySubProfileArr.size(); anId++)
+      aSize += mySubProfileArr[anId]->GetMemorySize();
+    return aSize;
+  }
+
   std::string 
   TProfileImpl
   ::GetNodeName(vtkIdType theObjID) const
@@ -415,6 +503,15 @@ namespace VISU
     return myFilter->GetUnstructuredGridOutput();
   }
 
+  unsigned long int
+  TIDMapperFilter
+  ::GetMemorySize()
+  {
+    size_t aSize = myIDMapper->GetMemorySize();
+    aSize += mySource.GetMemorySize();
+    return aSize;
+  }
+
   vtkIdType
   TIDMapperFilter
   ::GetNodeObjID(vtkIdType theID) const
@@ -484,6 +581,15 @@ namespace VISU
     return TGaussPointID(aCellID,aLocalPntID);
   }
 
+  unsigned long int
+  TGaussSubMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TSource::GetMemorySize();
+    aSize += myPointCoords.GetMemorySize();
+    return aSize;
+  }
+
   //---------------------------------------------------------------
   bool
   operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
@@ -530,6 +636,17 @@ namespace VISU
     return mySource.GetVTKOutput();
   }
 
+  unsigned long int
+  TGaussMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilter::GetMemorySize();
+    aSize += mySource.GetMemorySize();
+    for(size_t anId = 0; anId < myGaussSubMeshArr.size(); anId++)
+      aSize += myGaussSubMeshArr[anId]->GetMemorySize();
+    return aSize;
+  }
+
   TNamedIDMapper* 
   TGaussMeshImpl::
   GetParent()
@@ -569,6 +686,18 @@ namespace VISU
     return "";
   }
 
+  unsigned long int
+  TSubMeshImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TSource::GetMemorySize();
+    for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
+      const TConnect& aConnect = myCell2Connect[anId];
+      aSize += aConnect.size() * sizeof(vtkIdType);
+    }
+    return aSize;
+  }
+
   //---------------------------------------------------------------
   vtkIdType
   TMeshOnEntityImpl
@@ -628,6 +757,20 @@ namespace VISU
     return aSubMesh->GetElemName(anInputID);
   }
 
+  unsigned long int
+  TMeshOnEntityImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilter::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    for(size_t anId = 0; anId < mySubMeshArr.size(); anId++){
+      const PSubMeshImpl& aSubMesh = mySubMeshArr[anId];
+      aSize += aSubMesh->GetMemorySize();
+    }
+    return aSize;
+  }
+
   //---------------------------------------------------------------
   vtkIdType
   TFamilyImpl
@@ -671,6 +814,24 @@ namespace VISU
     return TSource::GetVTKOutput();
   }
 
+  unsigned long int
+  TFamilyImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TSource::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    aSize += myMeshID.size() * sizeof(vtkIdType);
+    TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
+    TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
+    for(; anIter != anIterEnd; anIter++){
+      const TSubMeshID& aSubMeshID = anIter->second;
+      aSize += aSubMeshID.size() * sizeof(vtkIdType);
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   TNbASizeCells 
@@ -726,6 +887,21 @@ namespace VISU
     return myNamedPointCoords->GetVTKID(theID);
   }
 
+  unsigned long int
+  TGroupImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = TAppendFilter::GetMemorySize();
+    aSize += myNamedPointCoords->GetMemorySize();
+    aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+    for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
+      const PFamilyImpl& aFamily = myFamilyArr[anId];
+      aSize += aFamily->GetMemorySize();
+    }
+    return aSize;
+  }
+
+
   
   //---------------------------------------------------------------
   TFieldImpl
@@ -828,6 +1004,15 @@ namespace VISU
     return aValueSliceArr;
   }
 
+  unsigned long int
+  TMeshValue
+  ::GetMemorySize() const
+  {
+    size_t aSize = sizeof(TMeshValue);
+    aSize += myValue.size() * sizeof(vtkFloatingPointType);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   TValForTimeImpl
@@ -865,6 +1050,22 @@ namespace VISU
     return anIter->second;
   }
   
+  unsigned long int
+  TValForTimeImpl
+  ::GetMemorySize()
+  {
+    size_t aSize = sizeof(TValForTimeImpl);
+    TGeom2Value::const_iterator anIter = myGeom2Value.begin();
+    TGeom2Value::const_iterator anIterEnd = myGeom2Value.end();
+    for(; anIter != anIterEnd; anIter++){
+      const TMeshValue& aMeshValue = anIter->second;
+      aSize += aMeshValue.GetMemorySize();
+      aSize += sizeof(EGeometry);
+    }
+    return aSize;
+  }
+
+
 
   //---------------------------------------------------------------
   vtkIdType
@@ -2397,7 +2598,7 @@ VISU_Convertor_impl
   size_t aLinksSize = aMesh->myNbPoints * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
 
   MSG(MYDEBUG,"GetMeshOnEntitySize "<<
       "- aResult = "<<vtkFloatingPointType(aResult)<<
@@ -2411,7 +2612,7 @@ VISU_Convertor_impl
     BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<vtkFloatingPointType(aLinksSize)<<"\n");
   }
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -2440,7 +2641,7 @@ VISU_Convertor_impl
   size_t aLinksSize = aMesh->myNbPoints * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
 
   MSG(MYDEBUG,"GetFamilyOnEntitySize "<<
       "- aResult = "<<vtkFloatingPointType(aResult)<<
@@ -2455,7 +2656,7 @@ VISU_Convertor_impl
     BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<vtkFloatingPointType(aLinksSize)<<"\n");
   }
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -2496,7 +2697,7 @@ VISU_Convertor_impl
   size_t aLinksSize = aMesh->myNbPoints * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
   aLinksSize = 0;
-  vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+  size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
   if(MYDEBUG){
     MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aPointsSize = "<<vtkFloatingPointType(aPointsSize));
     MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<vtkFloatingPointType(aConnectivityAndTypesSize));
@@ -2506,7 +2707,7 @@ VISU_Convertor_impl
   MSG(MYDEBUG,"GetMeshOnGroupSize - aResult = "<<vtkFloatingPointType(aResult)<<"; theMeshName = '"
       <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
 
-  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  aResult = size_t(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
@@ -2611,7 +2812,7 @@ VISU_Convertor_impl
   PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
   PFieldImpl aField = boost::get<3>(aFindTimeStamp);
   
-  size_t aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
+  size_t aMeshSize = GetMeshOnEntitySize(theMeshName, aVTKMeshOnEntity->myEntity);
   size_t aTimeStampSize = size_t(aField->myDataSize*sizeof(vtkFloatingPointType) * ERR_SIZE_CALC);
   size_t aResult = aMeshSize + aTimeStampSize;
 
@@ -2624,6 +2825,70 @@ VISU_Convertor_impl
 }
 
 
+size_t
+VISU_Convertor_impl
+::GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theStampsNum)
+{
+  size_t aSize = 0;
+
+  //Cheching possibility do the query
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theStampsNum);
+
+  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  PIDMapperFilter anIDMapperFilter = aValForTime->myIDMapperFilter;
+  if(anIDMapperFilter->myIsVTKDone){
+    VISU::PIDMapper anIDMapper = GetTimeStampOnMesh(theMeshName, 
+                                                   theEntity, 
+                                                   theFieldName, 
+                                                   theStampsNum);
+    anIDMapper->GetVTKOutput();
+    aSize += anIDMapper->GetMemorySize();
+  }else
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
+
+  cout<<"VISU_Convertor_impl::GetTimeStampOnMeshSize - "<<aSize<<"; "<<(anIDMapperFilter->myIsVTKDone)<<endl;
+  return aSize;
+}
+
+
+size_t
+VISU_Convertor_impl
+::GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theStampsNum)
+{
+  size_t aSize = 0;
+
+  //Cheching possibility do the query
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theStampsNum);
+
+  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+  if(aGaussPtsIDFilter->myIsVTKDone){
+    VISU::PGaussPtsIDMapper aGaussPtsIDMapper = GetTimeStampOnGaussPts(theMeshName, 
+                                                                      theEntity, 
+                                                                      theFieldName, 
+                                                                      theStampsNum);
+    aGaussPtsIDMapper->GetVTKOutput();
+    aSize += aGaussPtsIDMapper->GetMemorySize();
+  }else
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
+
+  cout<<"VISU_Convertor_impl::GetTimeStampOnGaussPtsSize - "<<aSize<<"; "<<(aGaussPtsIDFilter->myIsVTKDone)<<endl;
+  return aSize;
+}
+
+
 const VISU::PField
 VISU_Convertor_impl
 ::GetField(const string& theMeshName, 
index 40b90c3234f9a9aab77c62500cbc77f39cc6d4a3..e8256438cb830d000f9b6ab5aa2c3ddf869415c8 100644 (file)
@@ -115,6 +115,23 @@ namespace VISU
     virtual
     TVTKOutput* 
     GetVTKOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define an intermediate class which unifies memory size calculation
+  struct TMemoryCheckIDMapper: public virtual TIsVTKDone,
+                              public virtual TIDMapper
+  {
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
 
 
@@ -123,8 +140,7 @@ namespace VISU
   /*!
     This container allow to combine other VTK representation into single one.
   */
-  class TAppendFilter: public virtual TIsVTKDone,
-                      public virtual TIDMapper
+  class TAppendFilter: public virtual TMemoryCheckIDMapper
   {
   protected:
     mutable TVTKAppendFilter myFilter;
@@ -147,8 +163,7 @@ namespace VISU
   /*!
     This container allow to assign data to mesh and represent them into single VTK representation
   */
-  class TMergeFilter: public virtual TIsVTKDone,
-                     public virtual TIDMapper
+  class TMergeFilter: public virtual TMemoryCheckIDMapper
   {
   protected:
     mutable TVTKMergeFilter myFilter;
@@ -214,6 +229,11 @@ namespace VISU
 
     const TVTKPoints&
     GetPoints() const { return myPoints;}
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
   typedef SharedPtr<TPointCoords> PPointCoords;
 
@@ -232,7 +252,7 @@ namespace VISU
   protected:
     typedef TVector<std::string> TPointsDim;
     TPointsDim myPointsDim; //!< Keeps name of each dimension
-    TVectorID myVectorID; //!< Keeps object¶ numeration
+    TVectorID myVectorID; //!< Keeps object¶ numeration
     TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
 
   public:
@@ -302,6 +322,11 @@ namespace VISU
     vtkIdType 
     GetElemObjID(int theVtkI) const;
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     //! Keeps status of the structure
     /*!
       In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
@@ -362,6 +387,11 @@ namespace VISU
     TVTKOutput* 
     GetVTKOutput();
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     //! Reimplement the TNamedIDMapper::GetNodeName
     virtual
     std::string 
@@ -377,7 +407,6 @@ namespace VISU
     PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
     TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
 
-    TSource mySource; //!< Keeps VTK representation of the MED TIMESTAMP mesh
     TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
   };
   typedef SharedPtr<TProfileImpl> PProfileImpl;
@@ -424,6 +453,11 @@ namespace VISU
     virtual
     TVTKOutput* 
     GetVTKOutput();
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
   typedef SharedPtr<TIDMapperFilter> PIDMapperFilter;
 
@@ -460,6 +494,11 @@ namespace VISU
     GetObjID(vtkIdType theID,
             vtkIdType theStartID) const;
     
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
 
     //! Keeps status of the structure
@@ -494,6 +533,11 @@ namespace VISU
     TVTKOutput* 
     GetVTKOutput();
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     //! Reimplement the TGaussPtsIDMapper::GetParent
     virtual 
     TNamedIDMapper*
@@ -545,6 +589,11 @@ namespace VISU
     std::string 
     GetElemName(vtkIdType theObjID) const;
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     vtkIdType myStartID;
     TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
   };
@@ -590,6 +639,11 @@ namespace VISU
     std::string 
     GetElemName(vtkIdType theObjID) const;
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping 
     TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter
     PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
@@ -630,6 +684,11 @@ namespace VISU
     TVTKOutput* 
     GetVTKOutput();
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     PNamedPointCoords myNamedPointCoords;  //!< Share the same instance with TMesh to implement nodal mapping
     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
     TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
@@ -671,6 +730,11 @@ namespace VISU
     vtkIdType 
     GetNodeVTKID(vtkIdType theID) const;
 
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
+
     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
     TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter
     PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
@@ -741,6 +805,11 @@ namespace VISU
     //! To get assigned values first by components and then by Gauss Points
     TValueSliceArr 
     GetCompValueSliceArr(vtkIdType theElemId);
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize() const;
   };
   
 
@@ -770,6 +839,11 @@ namespace VISU
     virtual
     int
     GetNbGauss(EGeometry theGeom) const;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize();
   };
   typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
 }
@@ -864,13 +938,21 @@ public:
                     const std::string& theFieldName,
                     int theStampsNum);
 
-  //! Implemention of the VISU_Convertor::GetTimeStampSize
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
-  size_t 
-  GetTimeStampSize(const std::string& theMeshName, 
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFieldName,
-                  int theStampsNum);
+  size_t
+  GetTimeStampOnMeshSize(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theStampsNum);
+    
+  //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
+  virtual 
+  size_t
+  GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
+                            const VISU::TEntity& theEntity,
+                            const std::string& theFieldName,
+                            int theStampsNum);
 
   //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
   virtual
@@ -958,6 +1040,14 @@ protected:
                        const VISU::TEntity& theEntity);
   
 protected:
+  //! Implemention of the VISU_Convertor::GetTimeStampSize
+  virtual 
+  size_t 
+  GetTimeStampSize(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFieldName,
+                  int theStampsNum);
+
   //! To fill intermeiate representation of TMeshOnEntity from a MED source
   virtual
   int
index a488a210c105ab42137511dce461db07634aeec5..9614bc82cefe6734747782cc5a6e51f62c29e231 100644 (file)
@@ -100,6 +100,11 @@ namespace VISU
     virtual
     TVTKOutput*
     GetVTKOutput() = 0;
+
+    //! Gets memory size used by the instance (bytes).
+    virtual
+    unsigned long int
+    GetMemorySize() = 0;
   };
   typedef SharedPtr<TIDMapper> PIDMapper;
   
index be9dbf2932c9a625ef12221f52e2a22b179af19d..b7e5202e9e66738b46320ff765e84cae15288310 100644 (file)
@@ -418,8 +418,9 @@ unsigned long int
 VISU_Actor
 ::GetMemorySize()
 {
+  static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
   vtkDataSet* aDataSet = GetMapper()->GetInput();
-  unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+  unsigned long int aSize = size_t(aDataSet->GetActualMemorySize() * 1024 * ERR_SIZE_CALC);
 
   aDataSet = myGeomFilter->GetOutput();
   aSize += aDataSet->GetActualMemorySize() * 1024;
index b1b2042f0860c333cbfe4d109ed7a067c8ba244f..2341f2095b7f8169f50a478d14a6d13daead3883 100644 (file)
@@ -67,10 +67,10 @@ VISU::GaussPoints_i
     size_t aResult = VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,false);
     if(theIsMemoryCheck && aResult){
       VISU::Result_i::TInput* anInput = theResult->GetInput();
-      size_t aSize = anInput->GetTimeStampSize(theMeshName,
-                                              (VISU::TEntity)theEntity,
-                                              theFieldName,
-                                              theTimeStampNumber);
+      size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName,
+                                                        (VISU::TEntity)theEntity,
+                                                        theFieldName,
+                                                        theTimeStampNumber);
       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       if(MYDEBUG) 
@@ -258,6 +258,25 @@ VISU::GaussPoints_i
   }
 }
 
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::GaussPoints_i
+::GetMemorySize()
+{
+  CORBA::Float aMemorySize = TSuperClass::GetMemorySize();
+
+  // To calculate memory used by VISU Converter
+  VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+  CORBA::Float aSize = anInput->GetTimeStampOnGaussPtsSize(GetCMeshName(),
+                                                          GetTEntity(),
+                                                          GetCFieldName(),
+                                                          GetTimeStampNumber());
+  // Convert to mega bytes
+  aMemorySize += aSize / (1024.0 * 1024.0);
+  cout<<"GaussPoints_i::GetMemorySize - "<<this<<"; anInput = "<<aMemorySize<<endl;
+  cout<<endl;
+  return aMemorySize;
+}
 
 //----------------------------------------------------------------------------
 VISU::Storable* 
index c9a4793bc9f39b7ac104e87b3e01843ef5c6f7f6..708c964bfc7fb539549b2aedbe09bded4f527910 100644 (file)
@@ -51,6 +51,7 @@ namespace VISU
   public:
     //----------------------------------------------------------------------------
     typedef ColoredPrs3d_i TSuperClass;
+    typedef VISU::GaussPoints TInterface;
 
     explicit
     GaussPoints_i(EPublishInStudyMode thePublishInStudyModep);
@@ -68,8 +69,13 @@ namespace VISU
       return VISU::TGAUSSPOINTS;
     }
 
-    typedef VISU::GaussPoints TInterface;
+    //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
 
+    //----------------------------------------------------------------------------
     int
     GetFaceLimit() { return myFaceLimit; }
 
index 2ac12b6cb4343fe9b770bfc0d80a8bbc496dabbc..7d157700ac7ef8667f9e65152931b5d32d1a40e2 100644 (file)
@@ -621,15 +621,9 @@ CORBA::Float
 VISU::Prs3d_i
 ::GetMemorySize()
 {
-  // To calculate memory used by VISU Converter
-  static int INCMEMORY = 4;
-  vtkDataSet* aDataSet = GetPipeLine()->GetInput();
-  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;
+  CORBA::Float 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();
@@ -637,10 +631,9 @@ 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<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
       }
 
-  //cout<<endl;
   // Convert to mega bytes
   return aSize / (1024.0 * 1024.0);
 }
index b4c68d1f837e3435ea64220ec58012fbc3985eef..11c12cfba1b50eb67f0c7c51a44553319db2ab70 100644 (file)
@@ -74,10 +74,10 @@ VISU::ScalarMapOnDeformedShape_i
                                                    theFieldName);
       if(aField->myNbComp <= 1)
        return 0;
-      size_t aSize = anInput->GetTimeStampSize(theMeshName,
-                                              (VISU::TEntity)theEntity,
-                                              theFieldName,
-                                              theTimeStampNumber);
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber);
       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
index 99e2ccb39cf17a1e13fda315222df264dd0c1f93..2b142fa4475da1d57d295265bffa84e7955f164a 100644 (file)
@@ -60,10 +60,10 @@ VISU::ScalarMap_i
   try{
     if(theResult){
       VISU::Result_i::TInput* anInput = theResult->GetInput();
-      size_t aSize = anInput->GetTimeStampSize(theMeshName,
-                                              (VISU::TEntity)theEntity,
-                                              theFieldName,
-                                              theTimeStampNumber);
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber);
       aSize *= INCMEMORY;
       aResult = 1;
       if(theIsMemoryCheck){
@@ -180,6 +180,26 @@ VISU::ScalarMap_i
   return this;
 }
 
+//----------------------------------------------------------------------------
+CORBA::Float
+VISU::ScalarMap_i
+::GetMemorySize()
+{
+  CORBA::Float aMemorySize = TSuperClass::GetMemorySize();
+
+  // To calculate memory used by VISU Converter
+  VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+  CORBA::Float aSize = anInput->GetTimeStampOnMeshSize(GetCMeshName(),
+                                                      GetTEntity(),
+                                                      GetCFieldName(),
+                                                      GetTimeStampNumber());
+  // Convert to mega bytes
+  aMemorySize += aSize / (1024.0 * 1024.0);
+  cout<<"ScalarMap_i::GetMemorySize - "<<this<<"; anInput = "<<aMemorySize<<endl;
+  cout<<endl;
+  return aMemorySize;
+}
+
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ScalarMap_i
index 94cb91cea6d82536ff5d0b92abb72790bca78db6..069ee213debfaa6e9602e0a786312513aa9a51d7 100644 (file)
@@ -43,6 +43,7 @@ namespace VISU
   public:
     //----------------------------------------------------------------------------
     typedef ColoredPrs3d_i TSuperClass;
+    typedef VISU::ScalarMap TInterface;
 
     explicit
     ScalarMap_i(EPublishInStudyMode thePublishInStudyModep);
@@ -59,6 +60,13 @@ namespace VISU
       return VISU::TSCALARMAP;
     }
 
+    //----------------------------------------------------------------------------
+    //! Gets memory size actually used by the presentation (Mb).
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
+    //----------------------------------------------------------------------------
     virtual 
     VISU::Scaling 
     GetScaling();
@@ -74,7 +82,6 @@ namespace VISU
     virtual
     void
     SetSourceRange();
-
     
     // To provide backward compatibility
     virtual
@@ -85,8 +92,6 @@ namespace VISU
     VISU::ScalarMap::Orientation 
     GetBarOrientation();
 
-    typedef VISU::ScalarMap TInterface;
-
   protected:
     //! Redefines VISU_ColoredPrs3d_i::DoSetInput
     virtual 
index 1e0ae1f3237a5ceab7f35f088a9da48bd28f5067..7da7d785f256e8b58e821777df93cc541a566307 100644 (file)
@@ -63,10 +63,10 @@ VISU::Vectors_i
                                             false);
     if(theIsMemoryCheck && aResult){
       VISU::Result_i::TInput* anInput = theResult->GetInput();
-      size_t aSize = anInput->GetTimeStampSize(theMeshName,
-                                              (VISU::TEntity)theEntity,
-                                              theFieldName,
-                                              theTimeStampNumber);
+      size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
+                                                    (VISU::TEntity)theEntity,
+                                                    theFieldName,
+                                                    theTimeStampNumber);
       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       if(MYDEBUG)