]> Creatis software - bbtk.git/commitdiff
Clean code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 3 Oct 2025 11:49:30 +0000 (13:49 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 3 Oct 2025 11:49:30 +0000 (13:49 +0200)
packages/std/src/bbstdFindOptimalParam.cxx
packages/std/src/bbstdFindOptimalParam.h

index 28bcdeb667542002bcf69c403ab7b60e79c3d6ec..dc71da36c7772c070bd6d3fc76b7bc2216ff309a 100644 (file)
@@ -23,12 +23,18 @@ std::string FindOptimalParam::Replace(std::string strCommand, double value)
 
 int FindOptimalParam::Evaluate( double value )
 {
-       int result=-9999;
-       std::string strCommand = Replace( bbGetInputString(), value );
-       strCommand=strCommand+" NameFileTransfer="+bbGetInputTransferFile();
-       printf("EED FindOptimalParam::Evaluate  command=%s\n", strCommand.c_str());
+       int         result      = -9999;
+       std::string strCommand  = Replace( bbGetInputString(), value );
+       strCommand              = strCommand+" NameFileTransfer="+bbGetInputTransferFile();
+       
+#ifdef __APPLE__
+       strCommand              = "source /Users/davila/.bashrc_CreaTools ;" + strCommand;
+#endif
+
+    printf("EED FindOptimalParam::Evaluate  command=%s\n", strCommand.c_str());
+    printf("EED FindOptimalParam::Evaluate  start... \n", strCommand.c_str());
        system( strCommand.c_str() );
-       FILE *ff = fopen( bbGetInputTransferFile().c_str()  , "r");
+       FILE *ff = fopen( bbGetInputTransferFile().c_str()  , "r");
        if (ff!=NULL) 
        {
                fscanf(ff,"%d",&result);
@@ -36,10 +42,10 @@ int FindOptimalParam::Evaluate( double value )
                printf("EED Warnning!!  FindOptimalParam::Evaluate  TransferFile not set.\n");
        }// ff
        fclose(ff);
+    printf("EED FindOptimalParam::Evaluate  ...end \n", strCommand.c_str());
        return result;
 }
 
-
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
@@ -93,46 +99,42 @@ void FindOptimalParam::Process()
        } while ( bbGetInputMinDifference() < (end-start)   );
        bbSetOutputResult(start);
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void FindOptimalParam::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
    bbSetInputInitStart(0);
    bbSetInputInitEnd(100);
    bbSetInputString("");
    bbSetInputMinDifference(1);
-  
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void FindOptimalParam::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    if any
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void FindOptimalParam::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
 }
-}
-// EO namespace bbstd
+
+}// EO namespace bbstd
 
 
index 6add6fd23715882de92fb9da524960d4da1e048d..702c0961d1455af83425e73bd85e91d68de36619 100644 (file)
@@ -28,9 +28,8 @@ class bbstd_EXPORT FindOptimalParam
   BBTK_PROCESS(Process);
   void Process();
 
-       std::string Replace(std::string command, double value);
-       int             Evaluate( double value );
-
+  std::string   Replace(std::string command, double value);
+  int              Evaluate( double value );
 
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
@@ -42,22 +41,18 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(FindOptimalParam,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-
   BBTK_INPUT(FindOptimalParam,InitStart,"Initial Start",double,"");
   BBTK_INPUT(FindOptimalParam,InitEnd,"(defalut 100) Initial End ",double,"");
   BBTK_INPUT(FindOptimalParam,MinDifference,"(default 1) Minimum (End-Start) to stop iteration ",double,"");
   BBTK_INPUT(FindOptimalParam,String,"String script evaluation (use 'XXvalueXX' to be optimice)",std::string,"");
   BBTK_INPUT(FindOptimalParam,TransferFile,"File to check the difference",std::string,"");
-
   BBTK_OUTPUT(FindOptimalParam,Result,"Find optimal parameter",double,"");
-
-
 BBTK_END_DESCRIBE_BLACK_BOX(FindOptimalParam);
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
-}
-// EO namespace bbstd
+
+}// EO namespace bbstd
 
 #endif // __bbstdFindOptimalParam_h_INCLUDED__