]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix an external bug with "contraintes.med" file
authorapo <apo@opencascade.com>
Mon, 19 Feb 2007 12:52:57 +0000 (12:52 +0000)
committerapo <apo@opencascade.com>
Mon, 19 Feb 2007 12:52:57 +0000 (12:52 +0000)
12 files changed:
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3dFactory.cc
src/VISU_I/VISU_ColoredPrs3dFactory.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_Vectors_i.cc

index ba84f66a5b748ea08d0049951c9749b76240fa63..1d1cd451959f155a82c357a44732ead69bb41dfa 100644 (file)
@@ -145,7 +145,7 @@ public:
   GetTimeStampOnMesh(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName,
-                    int theStampsNum) = 0;
+                    int theTimeStampNumber) = 0;
 
   //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP
   virtual
@@ -153,7 +153,7 @@ public:
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum) = 0;
+                        int theTimeStampNumber) = 0;
    
   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
@@ -161,7 +161,8 @@ public:
   GetTimeStampOnMeshSize(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum) = 0;
+                        int theTimeStampNumber,
+                        bool& theIsEstimated) = 0;
     
   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
   virtual 
@@ -169,7 +170,8 @@ public:
   GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
                             const VISU::TEntity& theEntity,
                             const std::string& theFieldName,
-                            int theStampsNum) = 0;
+                            int theTimeStampNumber,
+                            bool& theIsEstimated) = 0;
     
   //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD
   virtual 
@@ -191,7 +193,7 @@ public:
   GetTimeStamp(const std::string& theMeshName, 
               const VISU::TEntity& theEntity,
               const std::string& theFieldName,
-              int theStampsNum) = 0;
+              int theTimeStampNumber) = 0;
     
   //! Allow to generate pretty name for MED TIMESTAMP
   static 
index 5054f0a4ed158058cb4bec1cbf54c3c4bc6aeac1..1442f995a038e6d04e60f7e5cf476567565f3fc1 100644 (file)
@@ -1318,7 +1318,8 @@ VISU_Convertor_impl
 ::GetTimeStampOnMeshSize(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum)
+                        int theTimeStampNumber,
+                        bool& theIsEstimated)
 {
   size_t aSize = 0;
 
@@ -1326,7 +1327,7 @@ VISU_Convertor_impl
   TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
                                                theEntity,
                                                theFieldName,
-                                               theStampsNum);
+                                               theTimeStampNumber);
 
   VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
   VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = aValForTime->myUnstructuredGridIDMapper;
@@ -1334,11 +1335,13 @@ VISU_Convertor_impl
     VISU::PIDMapper anIDMapper = GetTimeStampOnMesh(theMeshName, 
                                                    theEntity, 
                                                    theFieldName, 
-                                                   theStampsNum);
+                                                   theTimeStampNumber);
     anIDMapper->GetOutput();
     aSize += anIDMapper->GetMemorySize();
   }else
-    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theTimeStampNumber);
+
+  theIsEstimated = !(anUnstructuredGridIDMapper->myIsVTKDone);
 
   //cout<<"VISU_Convertor_impl::GetTimeStampOnMeshSize - "<<aSize<<"; "<<(anIDMapperFilter->myIsVTKDone)<<endl;
   return aSize;
@@ -1350,7 +1353,8 @@ VISU_Convertor_impl
 ::GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
                             const VISU::TEntity& theEntity,
                             const std::string& theFieldName,
-                            int theStampsNum)
+                            int theTimeStampNumber,
+                            bool& theIsEstimated)
 {
   size_t aSize = 0;
 
@@ -1358,7 +1362,7 @@ VISU_Convertor_impl
   TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
                                                theEntity,
                                                theFieldName,
-                                               theStampsNum);
+                                               theTimeStampNumber);
 
   VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
   VISU::PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
@@ -1366,11 +1370,13 @@ VISU_Convertor_impl
     VISU::PGaussPtsIDMapper aGaussPtsIDMapper = GetTimeStampOnGaussPts(theMeshName, 
                                                                       theEntity, 
                                                                       theFieldName, 
-                                                                      theStampsNum);
+                                                                      theTimeStampNumber);
     aGaussPtsIDMapper->GetOutput();
     aSize += aGaussPtsIDMapper->GetMemorySize();
   }else
-    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
+    aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theTimeStampNumber);
+
+  theIsEstimated = !(aGaussPtsIDFilter->myIsVTKDone);
 
   //cout<<"VISU_Convertor_impl::GetTimeStampOnGaussPtsSize - "<<aSize<<"; "<<(aGaussPtsIDFilter->myIsVTKDone)<<endl;
   return aSize;
index 7912b79b9f9dc237f691a9db4c576140d0d07f8d..ccb7cd20b739bb92ccb31e8becbaeb6d302c73d5 100644 (file)
@@ -123,7 +123,7 @@ public:
   GetTimeStampOnMesh(const std::string& theMeshName, 
                     const VISU::TEntity& theEntity,
                     const std::string& theFieldName,
-                    int theStampsNum);
+                    int theTimeStampNumber);
 
   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
   virtual 
@@ -131,7 +131,8 @@ public:
   GetTimeStampOnMeshSize(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum);
+                        int theTimeStampNumber,
+                        bool& theIsEstimated);
     
   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
   virtual 
@@ -139,7 +140,8 @@ public:
   GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
                             const VISU::TEntity& theEntity,
                             const std::string& theFieldName,
-                            int theStampsNum);
+                            int theTimeStampNumber,
+                            bool& theIsEstimated);
 
   //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
   virtual
@@ -147,7 +149,7 @@ public:
   GetTimeStampOnGaussPts(const std::string& theMeshName, 
                         const VISU::TEntity& theEntity,
                         const std::string& theFieldName,
-                        int theStampsNum);
+                        int theTimeStampNumber);
   
   //! Implemention of the VISU_Convertor::GetFieldOnMeshSize
   virtual 
index 0761326e0371c4973e59dd19d78601821fcd750f..4ca72b11c4252461984c4559d0753408ae9c549f 100644 (file)
@@ -130,23 +130,26 @@ namespace VISU
                                             theTimeId);
       else
       {
-       float aRequiredMemory = 0.0;
+       CORBA::Float anUsedMemory = 0.0;
+       CORBA::Float aRequiredMemory = 0.0;
        VISU::ColoredPrs3dCache::EnlargeType anEnlargeType = 
          VISU::GetRequiredCacheMemory<TPrs3d_i>(aResult,
                                                 theMeshName,
                                                 theEntity,
                                                 theFieldName,
                                                 theTimeId,
+                                                anUsedMemory,
                                                 aRequiredMemory);
 
        if( anEnlargeType == VISU::ColoredPrs3dCache::IMPOSSIBLE )
        {
-         long aMb = 1024 * 1024;
-         double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+         size_t aMb = 1024 * 1024;
+         double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
 
+         CORBA::Float aNecessaryMemory = aRequiredMemory - aFreeMemory - anUsedMemory;
          SUIT_MessageBox::warn1(GetDesktop(theModule),
                                 QObject::tr("WRN_VISU"),
-                                QObject::tr("ERR_NO_MEMORY_TO_BUILD").arg(aRequiredMemory - aFreeMemory),
+                                QObject::tr("ERR_NO_MEMORY_TO_BUILD").arg(aNecessaryMemory),
                                 QObject::tr("&OK") );
          QApplication::restoreOverrideCursor();
          return NULL;
index 9d285a702c3249f2426ed74baef55f70db08e2b5..320fc577f6371d7ae52ed4a6df78a01c4fc3e444 100644 (file)
@@ -344,9 +344,9 @@ VISU::ColoredPrs3dCache_i
 
       theRequiredMemory = int( aMemoryUsed + aMemoryNeeded ) + 1;
 
-      long aMb = 1024 * 1024;
-      double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
-      anEnlargeType = theRequiredMemory < aFreeMemory ?
+      size_t aMb = 1024 * 1024;
+      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+      anEnlargeType = aMemoryNeeded < aFreeMemory ?
        VISU::ColoredPrs3dCache::ENLARGE : VISU::ColoredPrs3dCache::IMPOSSIBLE;
     }
   }
@@ -437,9 +437,11 @@ VISU::ColoredPrs3dCache_i
   if( fabs( myLimitedMemory - theMemorySize ) < 1 / VTK_LARGE_FLOAT )
     return;
 
-  long aMb = 1024 * 1024;
-  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
-  if( theMemorySize > aFreeMemory )
+  size_t aMb = 1024 * 1024;
+  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+  CORBA::Float aMemoryUsed = GetDeviceMemorySize();
+  CORBA::Float aMemoryNeeded = theMemorySize - aMemoryUsed;
+  if( aMemoryNeeded > aFreeMemory )
     return;
 
   ClearCache(theMemorySize);
index 5634f0141000030357d9e0d8d8efabb873ef409f..427eb46e058a2f0bb8de40816b451931bf6205fb 100644 (file)
@@ -140,6 +140,7 @@ namespace VISU
                         VISU::Entity theEntity,
                         const std::string& theFieldName, 
                         CORBA::Long theIteration,
+                        CORBA::Float& theUsedMemory,
                         CORBA::Float& theRequiredMemory)
   {
     VISU::ColoredPrs3dCache::EnlargeType anEnlargeType = VISU::ColoredPrs3dCache::NO_ENLARGE;
@@ -154,6 +155,7 @@ namespace VISU
       SALOMEDS::Study_var aStudy = aResult->GetStudyDocument();
       VISU::ColoredPrs3dCache_var aCache = ColoredPrs3dCache_i::GetInstance(aStudy);
 
+      theUsedMemory = aCache->GetMemorySize();
       anEnlargeType = aCache->GetRequiredMemory(theType, anInput, theRequiredMemory);
     }
     return anEnlargeType;
index b36aec0c26acbf0038d771bd5c2203c37729af0e..5ae97c373e498bd2e45e902b0cf38f07d63c0bd2 100644 (file)
@@ -198,6 +198,7 @@ namespace VISU
                         VISU::Entity theEntity,
                         const std::string& theFieldName, 
                         CORBA::Long theTimeStampNumber,
+                        CORBA::Float& theUsedMemory,
                         CORBA::Float& theRequiredMemory);
 
 
@@ -210,6 +211,7 @@ namespace VISU
                         VISU::Entity theEntity,
                         const std::string& theFieldName, 
                         CORBA::Long theTimeStampNumber,
+                        CORBA::Float& theUsedMemory,
                         CORBA::Float& theRequiredMemory)
   {
     typedef typename TL::TColoredType2Enum<TColoredPrs3d_i>::TResult TEnum;
@@ -220,6 +222,7 @@ namespace VISU
                                  theEntity,
                                  theFieldName, 
                                  theTimeStampNumber,
+                                 theUsedMemory,
                                  theRequiredMemory);
   }
 
index 4c13191b85dc7c1ab17a7b056ad14d2de018623c..02a20b454526ea864cc9ccb740231aa638860fad 100644 (file)
@@ -132,10 +132,18 @@ VISU::ColoredPrs3d_i
   if(anIsCreatNew)
     CreatePipeLine(NULL); // to create proper pipeline
 
-  DoSetInput(anIsCreatNew, theReInit);
+  try{
+    DoSetInput(anIsCreatNew, theReInit);
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+    throw;
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+    throw;
+  }
 
   // To update title according to the new input
-  SetTitle(GetCTitle().c_str());
+  SetTitle(GetCFieldName().c_str());
 
   return anIsCreatNew;
 }
index b53ba51942ee8f2c61ffd213ee9a4be1664d777b..2350dae9d18ea02cbceb30a2224f8ece2c986012 100644 (file)
@@ -69,14 +69,17 @@ VISU::GaussPoints_i
   if(theEntity == VISU::NODE)
     return aResult;
   try{
+    bool anIsEstimated = true;
     VISU::Result_i::TInput* anInput = theResult->GetInput();
     size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName,
                                                       (VISU::TEntity)theEntity,
                                                       theFieldName,
-                                                      theTimeStampNumber);
+                                                      theTimeStampNumber,
+                                                      anIsEstimated);
       aResult = 1;
     if(theIsMemoryCheck){
-      aSize *= INCMEMORY;
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       if(MYDEBUG) 
        MESSAGE("GaussPoints_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
index f4b52725f513d173d5ae1afe42ee187b3dc8f8e4..3a4d51dd0aa8ac7b21218e24b7a330467f7fc46f 100644 (file)
@@ -74,11 +74,15 @@ VISU::ScalarMapOnDeformedShape_i
                                                    theFieldName);
       if(aField->myNbComp <= 1)
        return 0;
+
+      bool anIsEstimated = true;
       size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
                                                     (VISU::TEntity)theEntity,
                                                     theFieldName,
-                                                    theTimeStampNumber);
-      aSize *= INCMEMORY;
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     }
index 36969f5389161fe64cefd51fbc42d2b00eb6b9f0..a2c568595c95cf7f9609194786a96c235958c111 100644 (file)
@@ -61,14 +61,17 @@ VISU::ScalarMap_i
   size_t aResult = 0;
   try{
     if(theResult){
+      bool anIsEstimated = true;
       VISU::Result_i::TInput* anInput = theResult->GetInput();
       size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
                                                     (VISU::TEntity)theEntity,
                                                     theFieldName,
-                                                    theTimeStampNumber);
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
       aResult = 1;
       if(theIsMemoryCheck){
-       aSize *= INCMEMORY;
+       if(anIsEstimated)
+         aSize *= INCMEMORY;
        aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
        if(MYDEBUG) 
          MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
index da4b789a02a7b157067ab75554ae2d6a79ccdd01..e39def962171de2ebf51b674d1d6265643d5851d 100644 (file)
@@ -62,12 +62,15 @@ VISU::Vectors_i
                                             theTimeStampNumber,
                                             false);
     if(theIsMemoryCheck && aResult){
+      bool anIsEstimated = true;
       VISU::Result_i::TInput* anInput = theResult->GetInput();
       size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
                                                     (VISU::TEntity)theEntity,
                                                     theFieldName,
-                                                    theTimeStampNumber);
-      aSize *= INCMEMORY;
+                                                    theTimeStampNumber,
+                                                    anIsEstimated);
+      if(anIsEstimated)
+       aSize *= INCMEMORY;
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
       if(MYDEBUG) 
        MESSAGE("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);