From: crouzet Date: Wed, 25 Nov 2009 10:11:06 +0000 (+0000) Subject: treatment of coupling fields and meshes types X-Git-Tag: V6_0_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb15937edd9f5863039687e31c255ce91882b7c7;p=tools%2Fhxx2salome.git treatment of coupling fields and meshes types --- diff --git a/scripts/Makefile.am b/scripts/Makefile.am index e0665d5..5c51488 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -15,4 +15,4 @@ bin_SCRIPTS = hxx2salome \ cpp_compo_template.tgz install-data-hook: - \cp -f ${srcdir}/template_src.tgz ${exec_prefix}/bin + \cp -f ${srcdir}/template_src.tgz ${srcdir}/template_coupling_src.tgz ${exec_prefix}/bin diff --git a/scripts/cpp_compo_template.tgz b/scripts/cpp_compo_template.tgz index fa92fa4..646b08e 100644 Binary files a/scripts/cpp_compo_template.tgz and b/scripts/cpp_compo_template.tgz differ diff --git a/scripts/hxx2salome b/scripts/hxx2salome index 88fb60a..13c50be 100755 --- a/scripts/hxx2salome +++ b/scripts/hxx2salome @@ -189,11 +189,20 @@ generate_module_source() cat code_cxx >> hxx2salome_journal echo # +# select archive for MEDMEM or MEDCoupling + grep MEDCoupling code_idl >& /dev/null + if [ $? -eq 0 ] + then + template_component_archive=${gene_dir}/template_coupling_src.tgz + else + template_component_archive=${gene_dir}/template_src.tgz + fi +# # # ------------------- duplicates template module and insert generated code ------------------------------ # echo -e "\n-> Duplicate template module" | tee hxx2salome_journal - tar xvfz ${gene_dir}/template_src.tgz >> hxx2salome_journal + tar xvfz ${template_component_archive} >> hxx2salome_journal mv HXX2SALOME_GENERIC_CLASS_NAME_SRC ${CLASS_NAME}_SRC ${gene_dir}/renameSalomeModule -i HXX2SALOME_GENERIC_CLASS_NAME ${CLASS_NAME} ${CLASS_NAME}_SRC ###>> hxx2salome_journal @@ -254,7 +263,8 @@ generate_module_source() cd ${CLASS_NAME}_SRC/resources VER=`cat ${KERNEL_ROOT_DIR}/bin/salome/VERSION | awk ' { print $NF }'` # extract number of version export PYTHONPATH=${PYTHONPATH}:${KERNEL_ROOT_DIR}/bin/salome # to be sure IDLparser is in PYTHONPATH - ${idlparser} -Wbcatalog=${CLASS_NAME}Catalog.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl >& /dev/null | tee hxx2salome_journal + #${idlparser} -Wbcatalog=${CLASS_NAME}Catalog.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl >& /dev/null | tee hxx2salome_journal + ${idlparser} -Wbcatalog=${CLASS_NAME}Catalog.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome -I${MED_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl if [ -f ${CLASS_NAME}Catalog.xml ] then sed -i "s?_Gen??g @@ -490,8 +500,12 @@ fi # only if KERNEL_ROOT_DIR and MED_ROOT_DIR are defined if [ "${SHELL_EXT}" == "sh" ] && [ ${ENVIRON_FILE} ] && [ -f ${ENVIRON_FILE} ] then + pwd echo -e "\n Environment file with sh syntax specified => we source ${ENVIRON_FILE}" - source ${ENVIRON_FILE} + cat ${ENVIRON_FILE} | sed "s/ENV_FOR_LAUNCH=1/ENV_FOR_LAUNCH=0/g" > ${ENVIRON_FILE}.tmp + source ${ENVIRON_FILE}.tmp + #rm ${ENVIRON_FILE}.tmp + #source ${ENVIRON_FILE} else if [ ${KERNEL_ROOT_DIR} ] && [ -d ${KERNEL_ROOT_DIR} ] && [ ${MED_ROOT_DIR} ] && [ -d ${MED_ROOT_DIR} ] then diff --git a/scripts/parse3.awk b/scripts/parse3.awk index 80f17f6..59d8894 100644 --- a/scripts/parse3.awk +++ b/scripts/parse3.awk @@ -52,6 +52,7 @@ BEGIN { idl_arg_type["MEDMEM::FIELD*&"]="out SALOME_MED::FIELDINT" idl_arg_type["const std::vector&"]="in SALOME::vectorOfLong" idl_arg_type["std::vector*&"]="out SALOME::vectorOfLong" + idl_arg_type["const ParaMEDMEM::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" # # # mapping for returned types @@ -84,6 +85,8 @@ BEGIN { idl_rtn_type["const MEDMEM::FIELD&"]="SALOME_MED::FIELDINT" idl_rtn_type["std::vector*"]="SALOME::vectorOfLong" idl_rtn_type["std::vector"]="StrSeq" + idl_rtn_type["ParaMEDMEM::MEDCouplingUMesh*"]="SALOME_MED::MEDCouplingUMeshCorbaInterface" + idl_rtn_type["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" # # # Corba mapping table (for argument's types and returned types) @@ -127,6 +130,9 @@ BEGIN { idl_impl_hxx["SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_ptr" idl_impl_hxx["SALOME::vectorOfLong"]="SALOME::vectorOfLong*" idl_impl_hxx["StrSeq"]=class_name"_ORB::StrSeq*" + idl_impl_hxx["in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr" + idl_impl_hxx["SALOME_MED::MEDCouplingUMeshCorbaInterface"]="SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr" + idl_impl_hxx["SALOME_MED::MEDCouplingFieldDoubleCorbaInterface"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr" # # # table for c++ code generation : argument's processing @@ -173,7 +179,7 @@ BEGIN { # cpp_impl_a["const std::vector&"]="\tlong _%s_size;\n\tint *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\ # "\tstd::vector _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;" cpp_impl_a["std::vector*&"]="\tstd::vector* _%s;\n" - + cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%s);\n" # # # table for c++ code generation : returned value processing @@ -253,7 +259,14 @@ BEGIN { "\t_rtn_ior->length(_rtn_cpp_length);\n"\ "\tfor (int i=0; i<_rtn_cpp_length; ++i)\n"\ "\t (*_rtn_ior)[i] = _rtn_cpp[i].c_str();\n" - + cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]=\ + "\tParaMEDMEM::MEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::MEDCouplingFieldDoubleServant(_rtn_cpp);\n"\ + "\t_rtn_cpp->decrRef();\n"\ + "\tSALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n" + cpp_impl_b["ParaMEDMEM::MEDCouplingUMesh*"]=\ + "\tParaMEDMEM::MEDCouplingUMeshServant * _rtn_mesh_i = new ParaMEDMEM::MEDCouplingUMeshServant(_rtn_cpp);\n"\ + "\t_rtn_cpp->decrRef();\n"\ + "\tSALOME_MED::MEDCouplingUMeshCorbaInterface_ptr _rtn_ior = _rtn_mesh_i->_this();\n" # cpp_impl_b["std::vector*"]=\ # "\tSALOME::SenderInt_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n" @@ -289,6 +302,7 @@ BEGIN { cpp_impl_c["const MEDMEM::MESH*"]="\t_%s->removeReference();\n" cpp_impl_c["const MEDMEM::SUPPORT&"]="\t_%s->removeReference();\n" cpp_impl_c["const MEDMEM::SUPPORT*"]="\t_%s->removeReference();\n" + cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\t_%s->decrRef();\n" # # # record sep is ");\n" whith blanks all around, and optional "(" at the beginning