BUG: impossible to import a med file of size more than MAX_INT (~2.1 Gb)

(SMESH_File.*)

Fix an error of porting to OCCT-7
  (StdMeshers_Cartesian_3D.cxx)

Remove useless MESSAGE's
This commit is contained in:
eap 2016-06-09 14:22:37 +03:00
parent 6883e45c6b
commit 8d3d2084b7
8 changed files with 28 additions and 60 deletions

View File

@ -317,7 +317,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
return DRS_FAIL; return DRS_FAIL;
} }
try { try {
MESSAGE("Perform - myFile : "<<myFile); //MESSAGE("Perform - myFile : "<<myFile);
// Creating the MED mesh for corresponding SMDS structure // Creating the MED mesh for corresponding SMDS structure
//------------------------------------------------------- //-------------------------------------------------------
@ -430,7 +430,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::PWrapper myMed = CrWrapper(myFile,myMedVersion); MED::PWrapper myMed = CrWrapper(myFile,myMedVersion);
PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName); PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName()); //MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
myMed->SetMeshInfo(aMeshInfo); myMed->SetMeshInfo(aMeshInfo);
// Storing SMDS groups and sub-meshes as med families // Storing SMDS groups and sub-meshes as med families
@ -454,7 +454,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY; if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY;
if (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY; if (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY;
MESSAGE("Perform - aFamilyInfo"); //MESSAGE("Perform - aFamilyInfo");
list<DriverMED_FamilyPtr> aFamilies; list<DriverMED_FamilyPtr> aFamilies;
if (myAllSubMeshes) { if (myAllSubMeshes) {
aFamilies = DriverMED_Family::MakeFamilies aFamilies = DriverMED_Family::MakeFamilies
@ -529,8 +529,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord)); aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord));
} }
//cout << " SetNodeInfo(aNodeInfo)" << endl; //MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
myMed->SetNodeInfo(aNodeInfo); myMed->SetNodeInfo(aNodeInfo);
aNodeInfo.reset(); // free memory used for arrays aNodeInfo.reset(); // free memory used for arrays

View File

@ -1604,7 +1604,7 @@ double SMESH_Mesh::GetComputeProgress() const
const std::vector<SMESH_subMesh*>& smToCompute = algo->SubMeshesToCompute(); const std::vector<SMESH_subMesh*>& smToCompute = algo->SubMeshesToCompute();
for ( size_t i = 0; i < smToCompute.size(); ++i ) for ( size_t i = 0; i < smToCompute.size(); ++i )
{ {
if ( smToCompute[i]->IsEmpty() ) if ( smToCompute[i]->IsEmpty() || smToCompute.size() == 1 )
algoNotDoneCost += smToCompute[i]->GetComputeCost(); algoNotDoneCost += smToCompute[i]->GetComputeCost();
else else
algoDoneCost += smToCompute[i]->GetComputeCost(); algoDoneCost += smToCompute[i]->GetComputeCost();

View File

@ -815,22 +815,19 @@ SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
mySMESHDSMesh(NULL), mySMESHDSMesh(NULL),
mySMDSMesh(NULL) mySMDSMesh(NULL)
{ {
MESSAGE("SMESH_Client::SMESH_Client"); if ( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client");
myMeshServer->Register(); myMeshServer->Register();
CORBA::Boolean anIsEmbeddedMode; CORBA::Boolean anIsEmbeddedMode;
GetSMESHGen(theORB,anIsEmbeddedMode); GetSMESHGen(theORB,anIsEmbeddedMode);
if(anIsEmbeddedMode){ if(anIsEmbeddedMode){
if ( MYDEBUG ) if ( MYDEBUG ) MESSAGE("Info: The same process, update mesh by pointer ");
MESSAGE("Info: The same process, update mesh by pointer ");
// just set client mesh pointer to server mesh pointer // just set client mesh pointer to server mesh pointer
//SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*>(theMesh->GetMeshPtr()); //SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*>(theMesh->GetMeshPtr());
CORBA::LongLong pointeur = theMesh->GetMeshPtr(); CORBA::LongLong pointeur = theMesh->GetMeshPtr();
if( MYDEBUG ) if( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client pointeur "<<pointeur);
MESSAGE("SMESH_Client::SMESH_Client pointeur "<<pointeur);
SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*> (pointeur); SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*> (pointeur);
if ( MYDEBUG ) if ( MYDEBUG ) MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
//if(aMesh->GetMeshDS()->IsEmbeddedMode()){ //if(aMesh->GetMeshDS()->IsEmbeddedMode()){
if(anIsEmbeddedMode){ if(anIsEmbeddedMode){
mySMESHDSMesh = aMesh->GetMeshDS(); mySMESHDSMesh = aMesh->GetMeshDS();

View File

@ -74,7 +74,7 @@
#endif #endif
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 1; static int MYDEBUG = 0;
#else #else
static int MYDEBUG = 0; static int MYDEBUG = 0;
#endif #endif

View File

@ -251,9 +251,7 @@ namespace SMESH
void OnVisuException() void OnVisuException()
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
// PAL16774 (Crash after display of many groups). Salome sometimes crashes just // PAL16774 (Crash after display of many groups). Salome sometimes crashes just
// after or at showing this message, so we do an additional check of available memory // after or at showing this message, so we do an additional check of available memory
// char* buf = new char[100*1024]; // char* buf = new char[100*1024];
@ -284,9 +282,7 @@ namespace SMESH
TVisualObjPtr aVisualObj; TVisualObjPtr aVisualObj;
TVisualObjCont::key_type aKey(theStudyId,theEntry); TVisualObjCont::key_type aKey(theStudyId,theEntry);
try{ try{
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey); TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
if(anIter != VISUAL_OBJ_CONT.end()){ if(anIter != VISUAL_OBJ_CONT.end()){
aVisualObj = anIter->second; aVisualObj = anIter->second;
@ -351,19 +347,14 @@ namespace SMESH
bool objModified = false; bool objModified = false;
if ( aVisualObj ) { if ( aVisualObj ) {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
//MESSAGE("GetVisualObj");
if (nulData) if (nulData)
objModified = aVisualObj->NulData(); objModified = aVisualObj->NulData();
else else
objModified = aVisualObj->Update(); objModified = aVisualObj->Update();
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::GetVisualObj()" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::GetVisualObj()" );
#endif
RemoveVisualObjectWithActors( theEntry ); // remove this object RemoveVisualObjectWithActors( theEntry ); // remove this object
OnVisuException(); OnVisuException();
aVisualObj.reset(); aVisualObj.reset();
@ -377,7 +368,7 @@ namespace SMESH
// TODO: estimate memory usage in other modes and take current mode into account // TODO: estimate memory usage in other modes and take current mode into account
int freeMB = SMDS_Mesh::CheckMemory(true); int freeMB = SMDS_Mesh::CheckMemory(true);
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024; int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
MESSAGE("SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB); //MESSAGE("SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB);
if ( freeMB > 0 && usedMB * 5 > freeMB ) { if ( freeMB > 0 && usedMB * 5 > freeMB ) {
bool continu = false; bool continu = false;
if ( usedMB * 3 > freeMB ) if ( usedMB * 3 > freeMB )
@ -476,16 +467,12 @@ namespace SMESH
if (SVTK_ViewWindow* wnd = GetCurrentVtkView()) if (SVTK_ViewWindow* wnd = GetCurrentVtkView())
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
wnd->getRenderer()->Render(); wnd->getRenderer()->Render();
wnd->Repaint(false); wnd->Repaint(false);
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" );
#endif
OnVisuException(); OnVisuException();
} }
} }
@ -494,16 +481,12 @@ namespace SMESH
void RepaintViewWindow(SVTK_ViewWindow* theWindow) void RepaintViewWindow(SVTK_ViewWindow* theWindow)
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
theWindow->getRenderer()->Render(); theWindow->getRenderer()->Render();
theWindow->Repaint(); theWindow->Repaint();
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException(); OnVisuException();
} }
} }
@ -511,16 +494,12 @@ namespace SMESH
void RenderViewWindow(SVTK_ViewWindow* theWindow) void RenderViewWindow(SVTK_ViewWindow* theWindow)
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
theWindow->getRenderer()->Render(); theWindow->getRenderer()->Render();
theWindow->Repaint(); theWindow->Repaint();
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException(); OnVisuException();
} }
} }
@ -528,16 +507,12 @@ namespace SMESH
void FitAll(){ void FitAll(){
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){ if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
wnd->onFitAll(); wnd->onFitAll();
wnd->Repaint(); wnd->Repaint();
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" );
#endif
OnVisuException(); OnVisuException();
} }
} }
@ -637,7 +612,7 @@ namespace SMESH
} }
} }
} }
MESSAGE("CreateActor " << anActor); //MESSAGE("CreateActor " << anActor);
if( anActor ) if( anActor )
if( SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI() ) if( SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI() )
aSMESHGUI->addActorAsObserver( anActor ); aSMESHGUI->addActorAsObserver( anActor );
@ -648,26 +623,23 @@ namespace SMESH
void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){ void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){ if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif //MESSAGE("DisplayActor " << theActor);
MESSAGE("DisplayActor " << theActor);
vtkWnd->AddActor(theActor); vtkWnd->AddActor(theActor);
vtkWnd->Repaint(); vtkWnd->Repaint();
} }
catch (...) { catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" ); MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" );
#endif
OnVisuException(); OnVisuException();
} }
} }
} }
void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){ void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor)
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){ {
MESSAGE("RemoveActor " << theActor); if ( SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)) {
//MESSAGE("RemoveActor " << theActor);
vtkWnd->RemoveActor(theActor); vtkWnd->RemoveActor(theActor);
if(theActor->hasIO()){ if(theActor->hasIO()){
Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
@ -706,7 +678,7 @@ namespace SMESH
bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry) bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
{ {
//MESSAGE("UpdateView"); //MESSAGE("UpdateView");
bool OK = false; bool OK = false;
SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd); SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd);
if (!aViewWnd) if (!aViewWnd)
@ -732,7 +704,7 @@ namespace SMESH
case eDisplayAll: { case eDisplayAll: {
while (vtkActor *anAct = aCollection->GetNextActor()) { while (vtkActor *anAct = aCollection->GetNextActor()) {
if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) { if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
MESSAGE("--- display " << anActor); //MESSAGE("--- display " << anActor);
anActor->SetVisibility(true); anActor->SetVisibility(true);
if(anActor->hasIO()){ if(anActor->hasIO()){
@ -750,7 +722,7 @@ namespace SMESH
//MESSAGE("---case eDisplayOnly"); //MESSAGE("---case eDisplayOnly");
while (vtkActor *anAct = aCollection->GetNextActor()) { while (vtkActor *anAct = aCollection->GetNextActor()) {
if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) { if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
//MESSAGE("--- erase " << anActor); //MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false); anActor->SetVisibility(false);
} }
} }
@ -761,14 +733,14 @@ namespace SMESH
switch (theAction) { switch (theAction) {
case eDisplay: case eDisplay:
case eDisplayOnly: case eDisplayOnly:
//MESSAGE("--- display " << anActor); //MESSAGE("--- display " << anActor);
anActor->Update(); anActor->Update();
anActor->SetVisibility(true); anActor->SetVisibility(true);
if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange(); if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
aStudy->setVisibilityState(theEntry, Qtx::ShownState); aStudy->setVisibilityState(theEntry, Qtx::ShownState);
break; break;
case eErase: case eErase:
//MESSAGE("--- erase " << anActor); //MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false); anActor->SetVisibility(false);
aStudy->setVisibilityState(theEntry, Qtx::HiddenState); aStudy->setVisibilityState(theEntry, Qtx::HiddenState);
break; break;
@ -779,7 +751,7 @@ namespace SMESH
case eDisplay: case eDisplay:
case eDisplayOnly: case eDisplayOnly:
{ {
//MESSAGE("---"); //MESSAGE("---");
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study()); SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
_PTR(Study) aDocument = aStudy->studyDS(); _PTR(Study) aDocument = aStudy->studyDS();
// Pass non-visual objects (hypotheses, etc.), return true in this case // Pass non-visual objects (hypotheses, etc.), return true in this case
@ -810,7 +782,7 @@ namespace SMESH
bool UpdateView(EDisplaing theAction, const char* theEntry) { bool UpdateView(EDisplaing theAction, const char* theEntry) {
//MESSAGE("UpdateView"); //MESSAGE("UpdateView");
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() ); SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
if ( SUIT_ViewManager* vm = app->activeViewManager() ) if ( SUIT_ViewManager* vm = app->activeViewManager() )

View File

@ -75,7 +75,7 @@ SMESH_File::~SMESH_File()
bool SMESH_File::open() bool SMESH_File::open()
{ {
int length = size(); long length = size();
if ( !_map && length > 0 ) if ( !_map && length > 0 )
{ {
#ifdef WIN32 #ifdef WIN32
@ -188,7 +188,7 @@ long SMESH_File::size()
boost::uintmax_t size = boofs::file_size( _name, err ); boost::uintmax_t size = boofs::file_size( _name, err );
_error = err.message(); _error = err.message();
return err ? -1 : (long) size; return !err ? (long) size : -1;
} }
//================================================================================ //================================================================================

View File

@ -109,7 +109,7 @@ public:
private: private:
std::string _name; //!< file name std::string _name; //!< file name
int _size; //!< file size long _size; //!< file size
std::string _error; std::string _error;
#ifdef WIN32 #ifdef WIN32
HANDLE _file, _mapObj; HANDLE _file, _mapObj;

View File

@ -1416,7 +1416,7 @@ namespace
#if OCC_VERSION_MAJOR < 7 #if OCC_VERSION_MAJOR < 7
if ( !edgeIsSafe && !noSafeTShapes.insert((const Standard_Transient*) e.TShape() ).second ) if ( !edgeIsSafe && !noSafeTShapes.insert((const Standard_Transient*) e.TShape() ).second )
#else #else
if ( !edgeIsSafe && !noSafeTShapes.insert( _face.TShape().get() ).second ) if ( !edgeIsSafe && !noSafeTShapes.insert( e.TShape().get() ).second )
#endif #endif
isSafe = false; isSafe = false;
} }