Salome HOME
Update of CheckDone
[modules/smesh.git] / src / SMESH_I / SMESH_NoteBook.cxx
index 7994cf1f100ded4e341bb69c016390802484eafd..6576b5d5e545aa4d39fd2b6cf56d3f9a2c683ad3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <vector>
 #include <string>
 
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
 using namespace std;
 
 
@@ -242,7 +236,7 @@ void SMESH_NoteBook::ReplaceVariables()
     TCollection_AsciiString aMethod      = aCmd->GetMethod();
     TCollection_AsciiString aObject      = aCmd->GetObject();
     TCollection_AsciiString aResultValue = aCmd->GetResultValue();
-    if(MYDEBUG) {
+    if(SALOME::VerbosityActivated()) {
       cout<<"Command before : "<< aCmd->GetString()<<endl;
       cout<<"Method : "<< aMethod<<endl;
       cout<<"Object : "<< aObject<<endl;
@@ -286,7 +280,7 @@ void SMESH_NoteBook::ReplaceVariables()
           varIndex = atoi( varIndexPtr );
         if ( 0 <= (int)varIndex && varIndex < vars.size() && !vars[varIndex].empty() )
         {
-          // replace '$VarIndex$' either by var name of var value
+          // replace '$VarIndex$' either by var name or var value
           const char var0    = vars[varIndex][0];
           const bool isValue = (( '0' <= var0 && var0 <= '9' ) || var0 == '-');
           if ( isValue ) // remove TVar::Quote() as well
@@ -329,7 +323,7 @@ void SMESH_NoteBook::ReplaceVariables()
     }
 
     if(it != _objectMap.end()) {
-      if(MYDEBUG)
+      if(SALOME::VerbosityActivated())
         cout << "Found object : " << (*it).first << endl;
       SMESH_ObjectStates *aStates = (*it).second;
       // Case for LocalLength hypothesis
@@ -384,7 +378,7 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetLayerDistribution"){
           LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
           aLDStates->AddDistribution(aCmd->GetArg(1));
-          if(MYDEBUG)
+          if(SALOME::VerbosityActivated())
             cout<<"Add Distribution :"<<aCmd->GetArg(1)<<endl;
         }
       }
@@ -707,7 +701,7 @@ void SMESH_NoteBook::ReplaceVariables()
         // dumped calls due to the fix of
         // issue 0021364:: Dump of netgen parameters has duplicate lines
         SMESH_Gen_i *          aGen = SMESH_Gen_i::GetSMESHGen();
-        SALOMEDS::SObject_wrap sobj = SMESH_Gen_i::getStudyServant()->FindObjectID( (*it).first.ToCString() );
+        SALOMEDS::SObject_wrap sobj = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectID( (*it).first.ToCString() );
         CORBA::Object_var       obj = aGen->SObjectToObject( sobj );
         if ( SMESH_Hypothesis_i* h = SMESH::DownCast< SMESH_Hypothesis_i*>( obj ))
         {
@@ -723,10 +717,10 @@ void SMESH_NoteBook::ReplaceVariables()
       }
     }
     else {
-      if(MYDEBUG)
+      if(SALOME::VerbosityActivated())
         cout << "Object not found" << endl;
     }
-    if(MYDEBUG) {
+    if(SALOME::VerbosityActivated()) {
       cout<<"Command after: "<< aCmd->GetString()<<endl;
     }
   }
@@ -744,7 +738,7 @@ void SMESH_NoteBook::InitObjectMap()
   if(!aGen)
     return;
   
-  SALOMEDS::Study_var aStudy = SMESH_Gen_i::getStudyServant();
+  SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant();
   if(aStudy->_is_nil())
     return;
   
@@ -766,7 +760,7 @@ void SMESH_NoteBook::InitObjectMap()
       std::vector< std::string >     allVars = aGen->GetAllParameters( anID.in() );
       SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters.in());
       _entry2VarsMap[ TCollection_AsciiString( anID.in() )] = allVars;
-      if(MYDEBUG) {
+      if(SALOME::VerbosityActivated()) {
         cout<<"Entry : "<< anID<<endl;
         cout<<"aParameters : "<<aParameters<<endl;
       }
@@ -781,7 +775,7 @@ void SMESH_NoteBook::InitObjectMap()
       else if (!aMesh->_is_nil() ) {
         anObjType = "Mesh";
       }
-      if(MYDEBUG)
+      if(SALOME::VerbosityActivated())
         cout<<"The object Type : "<<anObjType<<endl;
       SMESH_ObjectStates *aState = NULL;
       if(anObjType == "LayerDistribution")
@@ -800,7 +794,7 @@ void SMESH_NoteBook::InitObjectMap()
             aVar.InsertAfter(aVar.Length(), SMESH::TVar::Quote() );
           }
           aVars.push_back(aVar);
-          if(MYDEBUG) {
+          if(SALOME::VerbosityActivated()) {
             cout<<"Variable: '"<<aVar<<"'"<<endl;
           }
         }
@@ -826,7 +820,7 @@ void SMESH_NoteBook::InitObjectMap()
 //================================================================================
 void SMESH_NoteBook::AddCommand(const TCollection_AsciiString& theString)
 {
-  if(MYDEBUG)
+  if(SALOME::VerbosityActivated())
     cout<<theString<<endl;
   Handle(_pyCommand) aCommand = new _pyCommand( theString, -1);
   _commands.push_back(aCommand);
@@ -953,7 +947,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double&
 {
   bool ok = false;
 
-  SALOMEDS::Study_ptr aStudy = SMESH_Gen_i::getStudyServant();
+  SALOMEDS::Study_ptr aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant();
   if(aStudy->_is_nil())
     return ok;