]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
On Windows disable MG_ADAPT occ/24009
authorViktor Uzlov <viktor.uzlov@opencascade.com>
Thu, 25 Mar 2021 11:50:55 +0000 (14:50 +0300)
committerViktor Uzlov <viktor.uzlov@opencascade.com>
Thu, 25 Mar 2021 11:50:55 +0000 (14:50 +0300)
CMakeLists.txt
SalomeSMESHConfig.cmake.in
src/SMESH/CMakeLists.txt
src/SMESH/MG_ADAPT.cxx
src/SMESH/MG_ADAPT.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESH_I/MG_ADAPT_i.cxx

index 242782dc419e25991699cecc0753e2f3acacbf4e..854959040b9d8d44d5ee02e7f9ab78d1b8093777 100644 (file)
@@ -240,6 +240,17 @@ IF(WIN32)
   ENDIF(${F2C_FOUND})
 ENDIF(WIN32)
 
+
+SET (SALOME_SMESH_DISABLE_MG_ADAPT OFF)
+IF(WIN32)
+  SET (SALOME_SMESH_DISABLE_MG_ADAPT ON)
+ENDIF()
+
+#On Windows disable MG_ADAPT
+IF(SALOME_SMESH_DISABLE_MG_ADAPT)
+  ADD_DEFINITIONS(-DDISABLE_MG_ADAPT)
+ENDIF()
+
 IF(SALOME_SMESH_ENABLE_MEFISTO)
  SET(MEFISTO2D_NAME "MEFISTO_2D")
 ELSE(SALOME_SMESH_ENABLE_MEFISTO)
index fba20e0cba0b86dcfbe5257c408232309dcba113..106114efdd4dd74809f2392e49bcbbcf259f5a99 100644 (file)
@@ -59,6 +59,7 @@ SET(SALOME_SMESH_BUILD_GUI @SALOME_BUILD_GUI@)
 SET(SALOME_SMESH_USE_CGNS  @SALOME_SMESH_USE_CGNS@)
 SET(SALOME_SMESH_USE_TBB   @SALOME_SMESH_USE_TBB@)
 SET(SALOME_SMESH_ENABLE_MEFISTO   @SALOME_SMESH_ENABLE_MEFISTO@)
+SET(SALOME_SMESH_DISABLE_MG_ADAPT   @SALOME_SMESH_DISABLE_MG_ADAPT@)
 IF(NOT WIN32)
   LIST(APPEND SMESH_DEFINITIONS "-DENABLE_MEFISTO")
 ENDIF(NOT WIN32)
index 55b8da58434733ba6a1b3160d7358521f2eec9d6..3233847b9a1ed6ba975da8901558e589859d3e35 100644 (file)
@@ -114,7 +114,8 @@ SET(SMESHimpl_SOURCES
 
 ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES})
 IF(WIN32)
-  TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj) 
+  TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj)
+  ADD_DEFINITIONS(-DNOMINMAX) 
 ENDIF(WIN32)
 
 TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} )
index 6282a600dfd93e9ac0e597441f3394b2f200ac96..471203ad38fc434d24697ec6043b3e8400381e47 100644 (file)
 #include <MeshFormatWriter.hxx>
 
 #include <Utils_SALOME_Exception.hxx>
+#include <Basics_Utils.hxx>
 
+#ifndef WIN32
 #include <unistd.h> // getpid()
+#else
+#include <process.h>
+#endif
+#include <fcntl.h>
+#include <array>
 #include <memory>   // unique_ptr
 
 typedef SMESH_Comment ToComment;
@@ -859,7 +866,18 @@ void MgAdapt::execCmd( const char* cmd, int& err)
   }
   std::ostream logStream(buf);
 
+  
+#if defined(WIN32)
+#if defined(UNICODE)
+  const wchar_t * aCmd = Kernel_Utils::utf8_decode(cmd);
+  std::unique_ptr <FILE, decltype(&_pclose)> pipe(_wpopen(aCmd, O_RDONLY), _pclose );
+#else
+  std::unique_ptr <FILE, decltype(&_pclose)> pipe(_popen(cmd, "r"), _pclose );
+#endif
+#else
   std::unique_ptr <FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose );
+#endif
+
   if(!pipe)
   {
     throw std::runtime_error("popen() failed!");
@@ -1084,7 +1102,11 @@ std::string MgAdapt::getFileName() const
 
   SMESH_Comment aGenericName( aTmpDir );
   aGenericName << "MgAdapt_";
+#ifndef WIN32
   aGenericName << getpid();
+#else
+aGenericName << _getpid();
+#endif
   aGenericName << "_";
   aGenericName << std::abs((int)(long) aGenericName.data());
 
index 9d11a588850f85541ecbb7992743288a0074a682..fd7cbada07c8abf55bd66de37ce75708b367cb48 100644 (file)
@@ -26,6 +26,8 @@
 #include <vector>
 #include <set>
 
+#include "SMESH_SMESH.hxx"
+
 namespace MEDCoupling
 {
   class MEDFileMesh;
@@ -54,7 +56,7 @@ struct MgAdaptHypothesisData
 };
 
 
-class MgAdapt
+class SMESH_EXPORT MgAdapt
 {
 
 public:
index beb071a3932b8941817122a7d2d5f4929debca2c..de9fe713d1d9e1bcb20d9f72ae0be96c1e12a9e6 100644 (file)
@@ -3044,6 +3044,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       break;
     }
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   case SMESHOp::OpMGAdapt:
     {
       if ( isStudyLocked() )
@@ -3055,6 +3056,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       ( new SMESHGUI_MG_ADAPTDRIVER( this, model, isCreation ))->show();
       break;
     }
+#endif
   // Adaptation - end
   case SMESHOp::OpSplitBiQuadratic:
   case SMESHOp::OpConvertMeshToQuadratic:
@@ -4294,7 +4296,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( SMESHOp::OpDisableAutoColor, "DISABLE_AUTO_COLOR" );
 
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   createSMESHAction( SMESHOp::OpMGAdapt,              "MG_ADAPT",                "ICON_MG_ADAPT" );
+#endif
   // Adaptation - end
 
   createSMESHAction( SMESHOp::OpMinimumDistance,  "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
@@ -4338,7 +4342,9 @@ void SMESHGUI::initialize( CAM_Application* app )
       meshId    = createMenu( tr( "MEN_MESH" ),    -1, 70, 10 ),
       ctrlId    = createMenu( tr( "MEN_CTRL" ),    -1, 60, 10 ),
       modifyId  = createMenu( tr( "MEN_MODIFY" ),  -1, 40, 10 ),
+#ifndef DISABLE_MG_ADAPT
       adaptId   = createMenu( tr( "MEN_ADAPT" ),   -1, 80, 10 ),
+#endif
       measureId = createMenu( tr( "MEN_MEASURE" ), -1, 50, 10 ),
       viewId    = createMenu( tr( "MEN_VIEW" ),    -1,  2 );
 
@@ -4512,7 +4518,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( SMESHOp::OpPatternMapping,         modifyId, -1 );
 
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   createMenu( SMESHOp::OpMGAdapt,              adaptId, -1 );
+#endif
   // Adaptation - end
 
   createMenu( SMESHOp::OpMinimumDistance,  measureId,   -1 );
@@ -4659,8 +4667,10 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( SMESHOp::OpPatternMapping,         modifyTb );
 
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   int adaptTb      = createTool( tr( "TB_ADAPTATION" ),QString( "SMESHAdaptationToolbar" ) ) ;
   createTool( SMESHOp::OpMGAdapt,              adaptTb );
+#endif
   // Adaptation - end
 
   int measuremTb   = createTool( tr( "TB_MEASUREM" ),  QString( "SMESHMeasurementsToolbar" ) ) ;
@@ -4745,7 +4755,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert( separator(), -1, 0 );
 
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   createPopupItem( SMESHOp::OpMGAdapt,              OB, mesh );
+#endif
   // Adaptation - end
 
   QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
@@ -6017,8 +6029,10 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
     op = new SMESHGUI_Add0DElemsOnAllNodesOp();
     break;
   // Adaptation - begin
+#ifndef DISABLE_MG_ADAPT
   case SMESHOp::OpMGAdapt:
     break;
+#endif
   // Adaptation - end
   default:
     break;
index f2bd58ede4d3fdc240d4670cc02eaaef8e6c11c8..7654aba60e63e87c81667ef41fc4f894518c2f54 100644 (file)
@@ -96,25 +96,34 @@ void MG_ADAPT_i::copyHypothesisDataFromImpl(const ::MG_ADAPT::MgAdaptHypothesisD
 
 SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateMG_ADAPT()
 {
+#ifndef DISABLE_MG_ADAPT
   SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
   SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
   return anObj._retn();
+#else
+  return SMESH::MG_ADAPT_ptr();
+#endif
 }
 SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis()
 {
+#ifndef DISABLE_MG_ADAPT
   SMESH::MG_ADAPT_i* aMGadapt = new SMESH::MG_ADAPT_i();
   SMESH::MG_ADAPT_var anObj = aMGadapt->_this();
   return anObj._retn();
+#else
+  return SMESH::MG_ADAPT_ptr();
+#endif
 }
 SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType)
 {
-
+#ifndef DISABLE_MG_ADAPT
   if (!strcmp(adaptationType, "MG_Adapt"))
   {
     SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i();
     SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this();
     return anObj._retn();
   }
+#endif
   return SMESH::MG_ADAPT_OBJECT_ptr();
 }
 //=============================================================================