mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
padder: rename MeshJobParameter to MeshJobFile
This commit is contained in:
parent
4a30c75bfc
commit
12d35c6792
0
src/Tools/padder/meshjob/idl/CMakeLists.txt
Executable file → Normal file
0
src/Tools/padder/meshjob/idl/CMakeLists.txt
Executable file → Normal file
@ -62,7 +62,7 @@ module MESHJOB
|
||||
enum FileType {MED_CONCRETE, MED_STEELBAR};
|
||||
|
||||
// This defines a single parameter for the job initialization (a med file)
|
||||
struct MeshJobParameter
|
||||
struct MeshJobFile
|
||||
{
|
||||
string file_name;
|
||||
FileType file_type;
|
||||
@ -70,7 +70,7 @@ module MESHJOB
|
||||
};
|
||||
|
||||
// This defines a set of parameters for the job initialization
|
||||
typedef sequence<MESHJOB::MeshJobParameter> MeshJobParameterList;
|
||||
typedef sequence<MESHJOB::MeshJobFile> MeshJobFileList;
|
||||
|
||||
// This defines the result data of a job
|
||||
struct MeshJobResults
|
||||
@ -97,7 +97,7 @@ module MESHJOB
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*! Initialize a smesh computation job and return the job identifier */
|
||||
long initialize(in MESHJOB::MeshJobParameterList meshJobParameterList, in string configId)
|
||||
long initialize(in MESHJOB::MeshJobFileList meshJobFileList, in string configId)
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*! Submit the job execution and return true if submission is OK */
|
||||
|
@ -167,8 +167,8 @@ static std::string REMOTE_WORKDIR("/tmp/spadder.remote.workdir."+USER);
|
||||
* <steelBarMeshFile_N> <steelBarGroupName_N>
|
||||
* <outputMedFile>
|
||||
*/
|
||||
const char * MeshJobManager_i::_writeDataFile(std::vector<MESHJOB::MeshJobParameter> listConcreteMesh,
|
||||
std::vector<MESHJOB::MeshJobParameter> listSteelBarMesh) {
|
||||
const char * MeshJobManager_i::_writeDataFile(std::vector<MESHJOB::MeshJobFile> listConcreteMesh,
|
||||
std::vector<MESHJOB::MeshJobFile> listSteelBarMesh) {
|
||||
#ifdef WIN32
|
||||
_mkdir(LOCAL_INPUTDIR.c_str());
|
||||
#else
|
||||
@ -281,17 +281,17 @@ bool MeshJobManager_i::configure(const char *configId,
|
||||
long MeshJobManager_i::JOBID_UNDEFINED = -1;
|
||||
|
||||
/*! Initialize a smesh computation job and return the job identifier */
|
||||
CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & meshJobParameterList,
|
||||
CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJobFileList,
|
||||
const char * configId)
|
||||
{
|
||||
beginService("MeshJobManager_i::initialize");
|
||||
//
|
||||
// We first analyse the CORBA sequence to store data in C++ vectors
|
||||
//
|
||||
std::vector<MESHJOB::MeshJobParameter> listConcreteMesh;
|
||||
std::vector<MESHJOB::MeshJobParameter> listSteelBarMesh;
|
||||
for(CORBA::ULong i=0; i<meshJobParameterList.length(); i++) {
|
||||
MESHJOB::MeshJobParameter currentMesh = meshJobParameterList[i];
|
||||
std::vector<MESHJOB::MeshJobFile> listConcreteMesh;
|
||||
std::vector<MESHJOB::MeshJobFile> listSteelBarMesh;
|
||||
for(CORBA::ULong i=0; i<meshJobFileList.length(); i++) {
|
||||
MESHJOB::MeshJobFile currentMesh = meshJobFileList[i];
|
||||
switch ( currentMesh.file_type ) {
|
||||
case MESHJOB::MED_CONCRETE:
|
||||
listConcreteMesh.push_back(currentMesh);
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
bool configure (const char *configId,
|
||||
const MESHJOB::ConfigParameter & configParameter);
|
||||
CORBA::Long initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList,
|
||||
CORBA::Long initialize (const MESHJOB::MeshJobFileList & meshJobFileList,
|
||||
const char *configId);
|
||||
bool start (CORBA::Long jobId);
|
||||
char* getState (CORBA::Long jobId);
|
||||
@ -83,8 +83,8 @@ private:
|
||||
std::map<long, long> _jobDateTimeMap;
|
||||
std::map<long, MESHJOB::MeshJobPaths*> _jobPathsMap;
|
||||
|
||||
const char* _writeDataFile (std::vector<MESHJOB::MeshJobParameter> listConcreteMesh,
|
||||
std::vector<MESHJOB::MeshJobParameter> listSteelBarMesh);
|
||||
const char* _writeDataFile (std::vector<MESHJOB::MeshJobFile> listConcreteMesh,
|
||||
std::vector<MESHJOB::MeshJobFile> listSteelBarMesh);
|
||||
const char* _writeScriptFile (const char * dataFileName, const char * configId);
|
||||
|
||||
std::vector<std::string> * _getResourceNames();
|
||||
|
@ -53,38 +53,38 @@ def getTestPadderDataDir():
|
||||
return datadir
|
||||
|
||||
import MESHJOB # to get the enum constant values
|
||||
from MESHJOB import MeshJobParameter, MeshJobParameterList
|
||||
from MESHJOB import MeshJobFile, MeshJobFileList
|
||||
|
||||
DEFAULT_CONCRETE_FILENAME=os.path.join(getTestDataDir(),'concrete.med')
|
||||
DEFAULT_STEELBAR_LISTFILENAME=[
|
||||
os.path.join(getTestDataDir(),'ferraill.med')
|
||||
]
|
||||
|
||||
def getMeshJobParameterList(concrete_filename=DEFAULT_CONCRETE_FILENAME,
|
||||
def getMeshJobFileList(concrete_filename=DEFAULT_CONCRETE_FILENAME,
|
||||
steelbar_listfilename=DEFAULT_STEELBAR_LISTFILENAME):
|
||||
'''
|
||||
This helper function creates a complete set of parameters (a
|
||||
MeshJobParameterList) for a simple test case, i.e. a case with a
|
||||
MeshJobFileList) for a simple test case, i.e. a case with a
|
||||
concrete filename and a single steelbar filename.
|
||||
'''
|
||||
# Note that a CORBA sequence (MeshJobParameterList) is mapped on a
|
||||
# Note that a CORBA sequence (MeshJobFileList) is mapped on a
|
||||
# simple list in python
|
||||
meshJobParameterList = []
|
||||
meshJobFileList = []
|
||||
# We can add some parameters
|
||||
param = MeshJobParameter(
|
||||
param = MeshJobFile(
|
||||
file_name = concrete_filename,
|
||||
file_type = MESHJOB.MED_CONCRETE,
|
||||
group_name = "concrete")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
for steelbar_filename in steelbar_listfilename:
|
||||
param = MeshJobParameter(
|
||||
param = MeshJobFile(
|
||||
file_name = steelbar_filename,
|
||||
file_type = MESHJOB.MED_STEELBAR,
|
||||
group_name = "steelbar")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
return meshJobParameterList
|
||||
return meshJobFileList
|
||||
|
||||
|
||||
def getSpadderCatalogFilename():
|
||||
|
@ -25,10 +25,10 @@ from salome.kernel.datamodeler import DataModeler, TypeString, TypeInteger
|
||||
|
||||
# __MEM__: Note that this module does not depend on the SPADDER
|
||||
# component on purpose (we could have use a derived structure of
|
||||
# SPADDER_ORB.MeshJobParameter). This choice is made to ease the test
|
||||
# SPADDER_ORB.MeshJobFile). This choice is made to ease the test
|
||||
# and development of the gui part of the plugin. If this data
|
||||
# structure becomes too important, we could make another arrangement
|
||||
# and use directly a SPADDER_ORB.MeshJobParameter.
|
||||
# and use directly a SPADDER_ORB.MeshJobFile.
|
||||
|
||||
class InputData(DataModeler):
|
||||
MESHTYPES=Enumerate([
|
||||
|
@ -266,25 +266,25 @@ class PluginDialog(QDialog):
|
||||
# We first have to create the list of parameters for the
|
||||
# initialize function. For that, we have to create the files
|
||||
# from the mesh objects:
|
||||
meshJobParameterList=[]
|
||||
meshJobFileList=[]
|
||||
concreteIndex=0
|
||||
for inputData in self.__listInputData:
|
||||
# For each input data, we have to create a
|
||||
# MeshJobParameter and add it to the list.
|
||||
# MeshJobFile and add it to the list.
|
||||
filename = self.__exportMesh(inputData.meshName, inputData.meshObject)
|
||||
if inputData.meshType == InputData.MESHTYPES.CONCRETE:
|
||||
filetype = MESHJOB.MED_CONCRETE
|
||||
else:
|
||||
filetype = MESHJOB.MED_STEELBAR
|
||||
|
||||
parameter = MESHJOB.MeshJobParameter(
|
||||
parameter = MESHJOB.MeshJobFile(
|
||||
file_name = filename,
|
||||
file_type = filetype,
|
||||
group_name = inputData.groupName)
|
||||
meshJobParameterList.append(parameter)
|
||||
meshJobFileList.append(parameter)
|
||||
|
||||
jobManager = self.__getJobManager()
|
||||
self.__jobid = jobManager.initialize(meshJobParameterList, self.__configId)
|
||||
self.__jobid = jobManager.initialize(meshJobFileList, self.__configId)
|
||||
if self.__jobid < 0:
|
||||
self.__log("ERR: the job can't be initialized")
|
||||
self.__log("ERR: %s"%jobManager.getLastErrorMessage())
|
||||
|
@ -87,66 +87,66 @@ def test00_parameters():
|
||||
file_concrete=os.path.join(spadder.getTestDataDir(),"concrete.med")
|
||||
file_steelbar=os.path.join(spadder.getTestDataDir(),"ferraill.med")
|
||||
|
||||
meshJobParameterList = []
|
||||
param = MESHJOB.MeshJobParameter(file_name=file_concrete,
|
||||
meshJobFileList = []
|
||||
param = MESHJOB.MeshJobFile(file_name=file_concrete,
|
||||
file_type=MESHJOB.MED_CONCRETE,
|
||||
group_name="concrete")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
param = MESHJOB.MeshJobParameter(file_name=file_steelbar,
|
||||
param = MESHJOB.MeshJobFile(file_name=file_steelbar,
|
||||
file_type=MESHJOB.MED_STEELBAR,
|
||||
group_name="steelbar")
|
||||
meshJobParameterList.append(param)
|
||||
return meshJobParameterList
|
||||
meshJobFileList.append(param)
|
||||
return meshJobFileList
|
||||
|
||||
def test01_parameters():
|
||||
"""One concrete mesh and two steelbar meshes"""
|
||||
datadir = os.path.join(PADDERTESTDIR,"test01")
|
||||
meshJobParameterList = []
|
||||
meshJobFileList = []
|
||||
|
||||
medfile = os.path.join(datadir,"concrete.med")
|
||||
param = MESHJOB.MeshJobParameter(file_name=medfile,
|
||||
param = MESHJOB.MeshJobFile(file_name=medfile,
|
||||
file_type=MESHJOB.MED_CONCRETE,
|
||||
group_name="concrete")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
medfile = os.path.join(datadir,"ferraill.med")
|
||||
param = MESHJOB.MeshJobParameter(file_name=medfile,
|
||||
param = MESHJOB.MeshJobFile(file_name=medfile,
|
||||
file_type=MESHJOB.MED_STEELBAR,
|
||||
group_name="ferraill")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
medfile = os.path.join(datadir,"ferrtran.med")
|
||||
param = MESHJOB.MeshJobParameter(file_name=medfile,
|
||||
param = MESHJOB.MeshJobFile(file_name=medfile,
|
||||
file_type=MESHJOB.MED_STEELBAR,
|
||||
group_name="ferrtran")
|
||||
meshJobParameterList.append(param)
|
||||
meshJobFileList.append(param)
|
||||
|
||||
return meshJobParameterList
|
||||
return meshJobFileList
|
||||
|
||||
def test02_parameters():
|
||||
"""One steelbar mesh only, without a concrete mesh"""
|
||||
datadir = os.path.join(PADDERTESTDIR,"test02")
|
||||
meshJobParameterList = []
|
||||
meshJobFileList = []
|
||||
|
||||
medfile = os.path.join(datadir,"cadreef.med")
|
||||
param = MESHJOB.MeshJobParameter(file_name=medfile,
|
||||
param = MESHJOB.MeshJobFile(file_name=medfile,
|
||||
file_type=MESHJOB.MED_STEELBAR,
|
||||
group_name="cadre")
|
||||
meshJobParameterList.append(param)
|
||||
return meshJobParameterList
|
||||
meshJobFileList.append(param)
|
||||
return meshJobFileList
|
||||
|
||||
def test03_parameters():
|
||||
"""One concrete mesh only, without a steelbar mesh"""
|
||||
datadir = os.path.join(PADDERTESTDIR,"test03")
|
||||
meshJobParameterList = []
|
||||
meshJobFileList = []
|
||||
|
||||
medfile = os.path.join(datadir,"concrete.med")
|
||||
param = MESHJOB.MeshJobParameter(file_name=medfile,
|
||||
param = MESHJOB.MeshJobFile(file_name=medfile,
|
||||
file_type=MESHJOB.MED_CONCRETE,
|
||||
group_name="concrete")
|
||||
meshJobParameterList.append(param)
|
||||
return meshJobParameterList
|
||||
meshJobFileList.append(param)
|
||||
return meshJobFileList
|
||||
|
||||
#
|
||||
# =======================================================================
|
||||
@ -155,15 +155,15 @@ def test03_parameters():
|
||||
#
|
||||
|
||||
# Choose here the use case
|
||||
#meshJobParameterList = test00_parameters()
|
||||
#meshJobParameterList = test01_parameters()
|
||||
#meshJobParameterList = test02_parameters()
|
||||
meshJobParameterList = test03_parameters()
|
||||
#meshJobFileList = test00_parameters()
|
||||
#meshJobFileList = test01_parameters()
|
||||
#meshJobFileList = test02_parameters()
|
||||
meshJobFileList = test03_parameters()
|
||||
|
||||
#
|
||||
# Prepare, start and follow-up the job
|
||||
#
|
||||
jobid = component.initialize(meshJobParameterList, configId)
|
||||
jobid = component.initialize(meshJobFileList, configId)
|
||||
if jobid<0:
|
||||
msg = component.getLastErrorMessage()
|
||||
print "ERR: %s"%msg
|
||||
|
Loading…
Reference in New Issue
Block a user