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;
}
try {
MESSAGE("Perform - myFile : "<<myFile);
//MESSAGE("Perform - myFile : "<<myFile);
// 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);
PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
//MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
myMed->SetMeshInfo(aMeshInfo);
// 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 (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY;
MESSAGE("Perform - aFamilyInfo");
//MESSAGE("Perform - aFamilyInfo");
list<DriverMED_FamilyPtr> aFamilies;
if (myAllSubMeshes) {
aFamilies = DriverMED_Family::MakeFamilies
@ -529,8 +529,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord));
}
//cout << " SetNodeInfo(aNodeInfo)" << endl;
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
//MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
myMed->SetNodeInfo(aNodeInfo);
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();
for ( size_t i = 0; i < smToCompute.size(); ++i )
{
if ( smToCompute[i]->IsEmpty() )
if ( smToCompute[i]->IsEmpty() || smToCompute.size() == 1 )
algoNotDoneCost += smToCompute[i]->GetComputeCost();
else
algoDoneCost += smToCompute[i]->GetComputeCost();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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