Salome HOME
Copyright update 2021
[plugins/ghs3dprlplugin.git] / src / GHS3DPRLPlugin / MG_TetraHPC_API.cxx
index 6bd90d529b820be310cda4a7a5f7f3d1eafb8a62..b8b59d55e86848b685977c67a30e96d45f188f3a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2004-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -341,7 +341,7 @@ struct MG_TetraHPC_API::LibData
     _nbRequiredTria = nb;
   }
 
-  void AddNode( double x, double y, double z, int domain )
+  void AddNode( double x, double y, double z, int /*domain*/ )
   {
     _xyz.push_back( x );
     _xyz.push_back( y );
@@ -353,13 +353,13 @@ struct MG_TetraHPC_API::LibData
     _nodeSize.push_back( size );
   }
   
-  void AddEdgeNodes( int node1, int node2, int domain )
+  void AddEdgeNodes( int node1, int node2, int /*domain*/ )
   {
     _edgeNodes.push_back( node1 );
     _edgeNodes.push_back( node2 );
   }
   
-  void AddTriaNodes( int node1, int node2, int node3, int domain )
+  void AddTriaNodes( int node1, int node2, int node3, int /*domain*/ )
   {
     _triaNodes.push_back( node1 );
     _triaNodes.push_back( node2 );
@@ -398,12 +398,12 @@ struct MG_TetraHPC_API::LibData
 
   int IsVertexRequired( int iNode )
   {
-    return ! ( iNode < int( _xyz.size() - _nodeSize.size() ));
+    return ! ( iNode < int( NbNodes() - _nodeSize.size() ));
   }
 
   double GetSizeAtVertex( int iNode )
   {
-    return IsVertexRequired( iNode ) ? _nodeSize[ iNode - _xyz.size() + _nodeSize.size() ] : 0.;
+    return IsVertexRequired( iNode ) ? _nodeSize[ iNode - NbNodes() + _nodeSize.size() ] : 0.;
   }
 };
 
@@ -615,6 +615,16 @@ bool MG_TetraHPC_API::LibData::Compute( const std::string& outFile )
   return true;
 }
 
+#else // ifdef USE_MG_LIBS
+
+struct MG_TetraHPC_API::LibData // to avoid compiler warnings
+{
+  volatile bool& _cancelled_flag;
+  double& _progress;
+  LibData(volatile bool& cancelled_flag, double& progress)
+    : _cancelled_flag{cancelled_flag}, _progress{progress}
+  {}
+};
 
 #endif // ifdef USE_MG_LIBS
 
@@ -627,13 +637,14 @@ bool MG_TetraHPC_API::LibData::Compute( const std::string& outFile )
 
 MG_TetraHPC_API::MG_TetraHPC_API(volatile bool& cancelled_flag, double& progress)
 {
+  _useLib = false;
+  _libData = new LibData( cancelled_flag, progress );
 #ifdef USE_MG_LIBS
   _useLib = true;
-  _libData = new LibData( cancelled_flag, progress );
   _libData->Init();
-#endif
   if ( getenv("MG_TetraHPC_USE_EXE"))
     _useLib = false;
+#endif
 }
 
 //================================================================================
@@ -733,10 +744,16 @@ bool MG_TetraHPC_API::Compute( const std::string& cmdLine )
     }
 
     // compute
-    return _libData->Compute( outFile );
+    bool ok =  _libData->Compute( outFile );
+
+    GetLog(); // write a log file
+    _logFile = ""; // not to write it again
+
+    return ok;
 #endif
   }
 
+  (void)cmdLine; // unused
   // Run library ONLY
 
   // int err = system( cmdLine.c_str() ); // run
@@ -745,9 +762,6 @@ bool MG_TetraHPC_API::Compute( const std::string& cmdLine )
   //   errStr = SMESH_Comment("system(mg-tetra.exe ...) command failed with error: ")
   //     << strerror( errno );
 
-  // GetLog(); // write a log file
-  // _logFile = ""; // not to write it again
-
   return false;
 }
 
@@ -827,7 +841,7 @@ void MG_TetraHPC_API::GmfGotoKwd( int iMesh, GmfKwdCod what )
  */
 //================================================================================
 
-void MG_TetraHPC_API::GmfGetLin( int iMesh, GmfKwdCod what, int* nbNodes, int* faceInd, int* ori, int* domain, int dummy )
+void MG_TetraHPC_API::GmfGetLin( int iMesh, GmfKwdCod what, int* nbNodes, int* faceInd, int* ori, int* domain, int /*dummy*/ )
 {
   if ( _useLib ) {
 #ifdef USE_MG_LIBS