From: uhz Date: Thu, 9 Mar 2017 15:46:31 +0000 (+0100) Subject: Padder : write new parameters in DataFile X-Git-Tag: V8_3_0a2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8428a892b5d761ab7f62890b7a27b7e2e98f8fb;p=modules%2Fsmesh.git Padder : write new parameters in DataFile --- diff --git a/src/Tools/padder/meshjob/idl/MESHJOB.idl b/src/Tools/padder/meshjob/idl/MESHJOB.idl index e37a36781..f403e55f3 100644 --- a/src/Tools/padder/meshjob/idl/MESHJOB.idl +++ b/src/Tools/padder/meshjob/idl/MESHJOB.idl @@ -72,6 +72,16 @@ module MESHJOB // This defines a set of parameters for the job initialization typedef sequence MeshJobFileList; + // This defines a single parameter for the job initialization + struct MeshJobParameter + { + string name; + string value; + }; + + // This defines a set of parameters for the job initialization + typedef sequence MeshJobParameterList; + // This defines the result data of a job struct MeshJobResults { @@ -97,7 +107,9 @@ module MESHJOB raises (SALOME::SALOME_Exception); /*! Initialize a smesh computation job and return the job identifier */ - long initialize(in MESHJOB::MeshJobFileList meshJobFileList, in string configId) + long initialize(in MESHJOB::MeshJobFileList meshJobFileList, + in MESHJOB::MeshJobParameterList MeshJobParameterList, + in string configId) raises (SALOME::SALOME_Exception); /*! Submit the job execution and return true if submission is OK */ diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 17d1c0fb0..7a77330d8 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -168,7 +168,8 @@ static std::string REMOTE_WORKDIR("/tmp/spadder.remote.workdir."+USER); * */ const char * MeshJobManager_i::_writeDataFile(std::vector listConcreteMesh, - std::vector listSteelBarMesh) { + std::vector listSteelBarMesh, + const MESHJOB::MeshJobParameterList & meshJobParameterList) { #ifdef WIN32 _mkdir(LOCAL_INPUTDIR.c_str()); #else @@ -212,9 +213,17 @@ const char * MeshJobManager_i::_writeDataFile(std::vector dataFile << line.c_str() << std::endl; } - // Finally, we conclude with the name of the output file + // We conclude the list of files with the name of the output file line = OUTPUTFILE; dataFile << line.c_str() << std::endl; + + // We put the numerical parameters at the end of the data file + for(CORBA::ULong i=0; ic_str(); } @@ -282,6 +291,7 @@ long MeshJobManager_i::JOBID_UNDEFINED = -1; /*! Initialize a smesh computation job and return the job identifier */ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJobFileList, + const MESHJOB::MeshJobParameterList & meshJobParameterList, const char * configId) { beginService("MeshJobManager_i::initialize"); @@ -340,7 +350,7 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJo // data is a text file containing the list of file names and group // names. // - const char * dataFilename = this->_writeDataFile(listConcreteMesh, listSteelBarMesh); + const char * dataFilename = this->_writeDataFile(listConcreteMesh, listSteelBarMesh, meshJobParameterList); LOG("dataFilename = " << dataFilename); const char * scriptFilename = this->_writeScriptFile(dataFilename, configId); LOG("scriptFilename = " << scriptFilename); diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx index 176d32f0c..618a4a2f2 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx @@ -56,6 +56,7 @@ public: bool configure (const char *configId, const MESHJOB::ConfigParameter & configParameter); CORBA::Long initialize (const MESHJOB::MeshJobFileList & meshJobFileList, + const MESHJOB::MeshJobParameterList & meshJobParameterList, const char *configId); bool start (CORBA::Long jobId); char* getState (CORBA::Long jobId); @@ -84,7 +85,8 @@ private: std::map _jobPathsMap; const char* _writeDataFile (std::vector listConcreteMesh, - std::vector listSteelBarMesh); + std::vector listSteelBarMesh, + const MESHJOB::MeshJobParameterList & meshJobParameterList); const char* _writeScriptFile (const char * dataFileName, const char * configId); std::vector * _getResourceNames(); diff --git a/src/Tools/padder/unittests/usecase_meshJobManager.py b/src/Tools/padder/unittests/usecase_meshJobManager.py index 127f32119..131e7c315 100644 --- a/src/Tools/padder/unittests/usecase_meshJobManager.py +++ b/src/Tools/padder/unittests/usecase_meshJobManager.py @@ -160,10 +160,16 @@ def test03_parameters(): #meshJobFileList = test02_parameters() meshJobFileList = test03_parameters() +meshJobParameterList = [] +param = MESHJOB.MeshJobParameter(name="RminRmax",value="1.5") +meshJobParameterList.append(param) +param = MESHJOB.MeshJobParameter(name="NbIteration",value="3") +meshJobParameterList.append(param) + # # Prepare, start and follow-up the job # -jobid = component.initialize(meshJobFileList, configId) +jobid = component.initialize(meshJobFileList, meshJobParameterList, configId) if jobid<0: msg = component.getLastErrorMessage() print "ERR: %s"%msg