Salome HOME
Copyright update 2020
[modules/smesh.git] / src / SMESH / SMESH_Gen.cxx
index 27881281ed5f593b839a0561cdea0d6f2b2e56d1..f00d3a4d5f4f506d93d01b9ec8de9feec342d7a8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -20,7 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  SMESH SMESH : implementation of SMESH idl descriptions
 //  File   : SMESH_Gen.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
   #include <windows.h>
 #endif
 
-using namespace std;
+#include <Basics_Utils.hxx>
 
-//#include <vtkDebugLeaks.h>
+using namespace std;
 
+// Environment variable separator
+#ifdef WIN32
+  #define env_sep ';'
+#else
+  #define env_sep ':'
+#endif
 
 //=============================================================================
 /*!
@@ -70,9 +76,7 @@ SMESH_Gen::SMESH_Gen()
   _localId = 0;
   _hypId   = 0;
   _segmentation = _nbSegments = 10;
-  SMDS_Mesh::_meshList.clear();
   _compute_canceled = false;
-  //vtkDebugLeaks::SetExitError(0);
 }
 
 namespace
@@ -96,12 +100,12 @@ namespace
 
 SMESH_Gen::~SMESH_Gen()
 {
-    std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin();
-    for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp )
-    {
-      if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
-        h->NullifyGen();
-    }
+  std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin();
+  for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp )
+  {
+    if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
+      h->NullifyGen();
+  }
   delete _studyContext->myDocument;
   delete _studyContext;
 }
@@ -400,8 +404,10 @@ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
   }
 
   if ( aCompactMesh )
-    aMesh.GetMeshDS()->compactMesh();
-
+  {
+    aMesh.GetMeshDS()->Modified();
+    aMesh.GetMeshDS()->CompactMesh();
+  }
   return ret;
 }
 
@@ -668,7 +674,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh&               aMesh,
           checkConform = false; // no more check conformity
           INFOS( "ERROR: Local <" << algo->GetName() <<
                 "> would produce not conform mesh: "
-                "<Not Conform Mesh Allowed> hypotesis is missing");
+                "<Not Conform Mesh Allowed> hypothesis is missing");
           theErrors.push_back( SMESH_Gen::TAlgoStateError() );
           theErrors.back().Set( SMESH_Hypothesis::HYP_NOTCONFORM, algo, false );
         }
@@ -985,7 +991,7 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
     while ( from < meshers.size() )
     {
       // cut off plugin name
-      pos = meshers.find( ':', from );
+      pos = meshers.find( env_sep, from );
       if ( pos != string::npos )
         plugin = meshers.substr( from, pos-from );
       else
@@ -1032,7 +1038,15 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
       xmlPath += sep + plugin + ".xml";
       bool fileOK;
 #ifdef WIN32
-      fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
+#ifdef UNICODE
+      const wchar_t* path = Kernel_Utils::decode_s(xmlPath);
+#else
+      const char* path = xmlPath.c_str();
+#endif
+      fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
+#ifdef UNICODE
+      delete path;
+#endif
 #else
       fileOK = (access(xmlPath.c_str(), F_OK) == 0);
 #endif
@@ -1173,7 +1187,7 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
 
 //=============================================================================
 /*!
- * Genarate a new id unique within this Gen
+ * Generate a new id unique within this Gen
  */
 //=============================================================================