English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Launcher: TCode.h Source File
Uranie / Launcher  v4.10.0
/* @license-end */
TCode.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2024 CEA/DES
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published
6 // by the Free Software Foundation, either version 3 of the License, or any
7 // later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
34 #ifndef TCODE_H
35 #define TCODE_H
36 
37 // URANIE
38 #include "TAttribute.h"
39 #include "TDataServer.h"
40 
41 #include "TInputFile.h"
42 #include "TOutputFile.h"
43 
44 namespace URANIE {
45 namespace Launcher {
46 
47 
48 class TCode: public TNamed {
49 public:
50  //---------------------------------------------
57  TCode();
63  TCode(const TString &name, const TString &title);
69  TCode(URANIE::DataServer::TDataServer *tds, TString scmd);
70 
76 
80  virtual ~TCode();
82 
83  //---------------------------------------------
92  TInputFile * getInputFile(TString sfile);
98  TInputFile * getInputFile(Int_t nfile);
109  TOutputFile * getOutputFile(Int_t nfile);
110 
116  TOutputFile * getOutputFile(TString sfile);
117 
119 
120  //---------------------------------------------
128  void setWorkingDirectory(TString sPathName = "");
129 
135  return _sWorkingDirectory;
136  };
141  void setReferenceDirectory(TString str) {
142  _sReferenceDirectory = str;
143  };
149  return _sReferenceDirectory;
150  };
155  void setCommand(TString str) {
156  _sCommand = str;
157  };
162  TString getCommand() {
163  return _sCommand;
164  };
169  Int_t getNOutputFiles() {
170  return (Int_t)(_outputFiles.size());
171  };
176  Int_t getNOutputAttributes();
182  Int_t getNOutputAttributes(Int_t nfile);
187  Int_t getNInputFiles() {
188  return (Int_t)(_listOfInputFiles->GetEntries());
189  };
194  Int_t getNInputAttributes();
200  Int_t getNInputAttributes(Int_t nfile);
207  URANIE::DataServer::TAttribute * getInputAttribute(Int_t nfile, Int_t natt);
214  URANIE::DataServer::TAttribute * getAttribute(Int_t nfile, Int_t natt);
219  TString getInputVarNames();
224  TString getOutputVarNames();
229  URANIE::DataServer::TDataServer * getTDataServer() {
230  return _tds;
231  };
236  void setTDataServer(URANIE::DataServer::TDataServer *atds) {
237  _tds = atds;
238  // UpdateInputList();
239  };
241 
242  //---------------------------------------------
274  virtual void runTest(Option_t *option = "");
279  virtual void initFileType(Option_t *option = "");
284  virtual void init(Option_t *option = "");
285  virtual void initRun(forkcode *fjob, Option_t *option = "");
293  virtual void preTraitment(forkcode *fjob, Double_t *val, Int_t *index = NULL, Option_t *option = "");
300  virtual void prepareEntries(forkcode *fjob, vector<URANIE::DataServer::UEntry*> *input);
301  virtual void preTraitment(forkcode *fjob, vector<URANIE::DataServer::UEntry*> *input, Option_t *option = "");
306  virtual void run(forkcode *fjob, Option_t *option = "");
311  virtual void start(forkcode *fjob, Option_t *option = "");
320  virtual Bool_t postTraitment(forkcode *fjob, Int_t &nout, Double_t *dvalout, Option_t *option = "", TList *lstOut = NULL);
327  virtual Bool_t postTraitment(forkcode *fjob, vector<URANIE::DataServer::UEntry*> *out, Option_t *option = "");
332  virtual void terminate(Option_t *option = "");
334 
335  //---------------------------------------------
339 
346  void createDirectory(TString sPathName, TString sDirectoryName = "");
347 
352  virtual void copyFiles(Option_t *option = "");
353 
359  void resetCurrentSimulation();
364  virtual void cleanOutputFiles(forkcode *fjob, Option_t *option = "");
366 
367  //---------------------------------------------
375  void addInputFile(TInputFile *ifile);
382  void addInputFile(TString str);
388  void addOutputFile(TOutputFile *ifile);
390 
391  //---------------------------------------------
398  void setLog() {
399  _blog = kTRUE;
400  }
404  void unsetLog() {
405  _blog = kFALSE;
406  }
410  void changeLog() {
411  _blog = _blog ? kFALSE : kTRUE;
412  }
417  Bool_t getLog() {
418  return _blog;
419  }
424  virtual void printLog(Option_t *option = "");
426 
427  ClassDef(URANIE::Launcher::TCode, ID_LAUNCHER)
428 
429  //---------------------------------------------
434  protected:
435  vector<TOutputFile *> _outputFiles;
439  TString _sCommand;
441  Int_t _nOfInput;
444  Bool_t _blog;
445  URANIE::DataServer::TDataServer *_tds;
446 
447 };
448 
449 } // End of namespace Launcher
450 } // End of namespace URANIE
451 
452 #endif
453 // End of File
TString getInputVarNames()
Get the names of the input variables separated by ":".
Definition: TCluster.h:66
virtual void terminate(Option_t *option="")
Terminate phase of the code.
Int_t getNInputAttributes()
Get the number of input attributes.
TString getOutputVarNames()
Get the names of the output variables separated by ":".
virtual void preTraitment(forkcode *fjob, Double_t *val, Int_t *index=NULL, Option_t *option="")
Pre-traitment phase of the code.
virtual void init(Option_t *option="")
Init phase of the code.
virtual void initRun(forkcode *fjob, Option_t *option="")
virtual ~TCode()
Default destructor.
void changeLog()
Swith the status of the log.
Definition: TCode.h:410
virtual void start(forkcode *fjob, Option_t *option="")
Start to run the code (non bloquant)
Interface of the class URANIE::Launcher::TInputFile.
Abstract class for an input file of a code.
Definition: TInputFile.h:55
TInputFile * getLastInputFile()
Get the last input file.
virtual void cleanOutputFiles(forkcode *fjob, Option_t *option="")
Cleans the output files.
URANIE::DataServer::TDataServer * getTDataServer()
Get the pointer to the TDS.
Definition: TCode.h:229
Bool_t _blog
Boolean for edit the log.
Definition: TCode.h:444
TString _sWorkingDirectory
The Working directory.
Definition: TCode.h:437
TString getReferenceDirectory()
Get the reference directory where inputs no change are located.
Definition: TCode.h:148
virtual void printLog(Option_t *option="")
Print the log of the object/class.
TCode()
Default constructor.
TInputFile * getInputFile(TString sfile)
Get the input file file from his name.
Int_t _nOfInput
The size of the vector listOfInput scanning input files.
Definition: TCode.h:441
void addInputFile(TInputFile *ifile)
Add a TInputFile file.
TString getWorkingDirectory()
Get the working directory.
Definition: TCode.h:134
struct unforkjob forkcode
Definition: TInputFile.h:53
void setTDataServer(URANIE::DataServer::TDataServer *atds)
Set the pointer to the TDS.
Definition: TCode.h:236
TString getCommand()
Get the code command.
Definition: TCode.h:162
void resetCurrentSimulation()
resetCurrentSimulation
virtual Bool_t postTraitment(forkcode *fjob, Int_t &nout, Double_t *dvalout, Option_t *option="", TList *lstOut=NULL)
Post-traitment phase of the code.
Int_t _nOfInputToSubstitute
The size of the vector _nIndexOfInputToSubstitute.
Definition: TCode.h:442
Int_t getNOutputFiles()
Get the number of output files.
Definition: TCode.h:169
Description of the class TOutputFile.
Definition: TOutputFile.h:87
URANIE::DataServer::TDataServer * _tds
Definition: TCode.h:445
void createDirectory(TString sPathName, TString sDirectoryName="")
create the directory sPathName+"/"+sDirectoryName
virtual void runTest(Option_t *option="")
Run a test for the code.
Interface of the class URANIE::Launcher::TOutputFile.
void unsetLog()
Force to desable the log.
Definition: TCode.h:404
void setLog()
Force the log.
Definition: TCode.h:398
Int_t getNInputFiles()
Get the number of input files.
Definition: TCode.h:187
void setWorkingDirectory(TString sPathName="")
Set the working directory.
Int_t * _nIndexOfInputToSubstitute
The vector of Index to Substitute.
Definition: TCode.h:443
TString _sCommand
The Command of the code.
Definition: TCode.h:439
virtual void copyFiles(Option_t *option="")
copyFiles
TOutputFile * getOutputFile(Int_t nfile)
Get the output file from his index.
void addOutputFile(TOutputFile *ifile)
Add a TOutputFile file The TOutputFile file contains the output attributes of teh study...
Int_t _nCurrentSimulation
The Current number of simulation.
Definition: TCode.h:440
void setCommand(TString str)
Set the code command.
Definition: TCode.h:155
URANIE::DataServer::TAttribute * getAttribute(Int_t nfile, Int_t natt)
Get an attribute of an output file.
Bool_t getLog()
Get the status of the log.
Definition: TCode.h:417
virtual void run(forkcode *fjob, Option_t *option="")
Run the code (bloquant)
TString _sReferenceDirectory
The Working directory.
Definition: TCode.h:438
void setReferenceDirectory(TString str)
Set the reference directory where inputs no change are located.
Definition: TCode.h:141
protected TList * _listOfInputFiles
< vector of output files
Definition: TCode.h:436
Description of the class TCode.
Definition: TCode.h:48
URANIE::DataServer::TAttribute * getInputAttribute(Int_t nfile, Int_t natt)
Get an attribute of an input file.
Int_t getNOutputAttributes()
Get the number of output attributes.
virtual void prepareEntries(forkcode *fjob, vector< URANIE::DataServer::UEntry *> *input)
Pre-traitment phase of the code that deals with vectors/strings.
virtual void initFileType(Option_t *option="")
Init file typing.