From: Ovidiu Mircescu Date: Fri, 12 Aug 2016 13:52:40 +0000 (+0200) Subject: Deal with the fact that MEDCoupling is now an extern tool. X-Git-Tag: V8_1_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=08e399c0fcb71dc93f691f30898023fddf2f25d5;p=tools%2Fyacsgen.git Deal with the fact that MEDCoupling is now an extern tool. --- diff --git a/Examples/hxx1/CALCUL/src/CALCUL.cxx b/Examples/hxx1/CALCUL/src/CALCUL.cxx new file mode 100644 index 0000000..703a469 --- /dev/null +++ b/Examples/hxx1/CALCUL/src/CALCUL.cxx @@ -0,0 +1,57 @@ +#include "CALCUL.hxx" + +int CALCUL::add(int i1, int i2) +{ + return i1+i2; +} + +int CALCUL::mul(int i1, int i2) +{ + return i1*i2; +} + +double CALCUL::addi(double i1, double i2) +{ + return i1+i2; +} + +double CALCUL::multi(double i1, double i2) +{ + return i1*i2; +} + +double CALCUL::sqr(double i1) +{ + return i1*i1; +} + +double CALCUL::sqr2(double i1,double& result) +{ + result=i1*i1; + return result; +} + +void CALCUL::return_3_int(int n, int& f1, int& f2, int& f3) +{ + f1=n+1; + f2=n+2; + f3=n+3; +} + +unsigned CALCUL::fact(unsigned n) +{ + int factorielle=1; + for (unsigned i=n; i!=1; --i) + factorielle*=i; + return factorielle; +} + +bool CALCUL::And(bool i1, bool i2) +{ + return i1&&i2; +} + +bool CALCUL::Or(bool i1, bool i2) +{ + return i1||i2; +} diff --git a/Examples/hxx1/CALCUL/src/CALCUL.hxx b/Examples/hxx1/CALCUL/src/CALCUL.hxx new file mode 100644 index 0000000..42469f2 --- /dev/null +++ b/Examples/hxx1/CALCUL/src/CALCUL.hxx @@ -0,0 +1,21 @@ +#ifndef _CALCUL_HXX_ +#define _CALCUL_HXX_ + + +class CALCUL +{ +// Méthodes publiques +public: + int add(int i1, int i2); + int mul(int i1, int i2); + unsigned fact(unsigned n); + double addi(double i1, double i2); + double multi(double i1, double i2); + double sqr(double i1); + double sqr2(double i1,double& result); + void return_3_int(int n, int& f1, int& f2, int& f3); + bool And(bool i1, bool i2); + bool Or(bool i1, bool i2); +}; + +#endif diff --git a/Examples/hxx1/CALCUL/src/CMakeLists.txt b/Examples/hxx1/CALCUL/src/CMakeLists.txt new file mode 100644 index 0000000..c350410 --- /dev/null +++ b/Examples/hxx1/CALCUL/src/CMakeLists.txt @@ -0,0 +1,20 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +PROJECT(CALCUL C CXX) + + +SET(BUILD_SHARED_LIBS TRUE) + +SET(_lib_HEADERS + CALCUL.hxx +) + +SET(_lib_SOURCES + CALCUL.cxx +) + +ADD_LIBRARY(CALCULCXX ${_lib_SOURCES}) +TARGET_LINK_LIBRARIES(CALCULCXX ) + +INSTALL(TARGETS CALCULCXX DESTINATION lib) +INSTALL(FILES ${_lib_HEADERS} DESTINATION include) + diff --git a/Examples/hxx1/CALCUL/src/main.cxx b/Examples/hxx1/CALCUL/src/main.cxx new file mode 100644 index 0000000..26e5c81 --- /dev/null +++ b/Examples/hxx1/CALCUL/src/main.cxx @@ -0,0 +1,11 @@ +#include "CALCUL.hxx" +#include + +using namespace std; +int main(int argc, char ** argv) +{ + if (getenv("SALOME_trace") == NULL ) + setenv("SALOME_trace","local",0); + CALCUL myCalc; + // test myCalc component ... +} diff --git a/Examples/hxx1/ICOCO/src/CMakeLists.txt b/Examples/hxx1/ICOCO/src/CMakeLists.txt new file mode 100644 index 0000000..2ca0a2f --- /dev/null +++ b/Examples/hxx1/ICOCO/src/CMakeLists.txt @@ -0,0 +1,46 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +PROJECT(MEDExample C CXX) + +# =================== +SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") +IF(EXISTS ${CONFIGURATION_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") + INCLUDE(SalomeMacros) +ELSE() + MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") +ENDIF() + +# Find MEDCoupling (required) +# ========================== +SET(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} CACHE PATH "Path to the MEDCoupling tool") +IF(EXISTS ${MEDCOUPLING_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${MEDCOUPLING_ROOT_DIR}/cmake_files") + FIND_PACKAGE(SalomeMEDCoupling REQUIRED) # will reload HDF5, MEDFile, XDR, etc ... +ELSE(EXISTS ${MEDCOUPLING_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need the MEDCoupling tool, please define MEDCOUPLING_ROOT_DIR !") +ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) + +SET(BUILD_SHARED_LIBS TRUE) +INCLUDE_DIRECTORIES( + ${MEDCOUPLING_INCLUDE_DIRS} +) + +SET(_link_LIBRARIES + ${MEDCoupling_medcoupling} + ${MEDCoupling_interpkernel} +) + +SET(_lib_HEADERS + ICOCO.hxx +) + +SET(_lib_SOURCES + ICOCO.cxx +) + +ADD_LIBRARY(ICOCOCXX ${_lib_SOURCES}) +TARGET_LINK_LIBRARIES(ICOCOCXX ${_link_LIBRARIES} ) + +INSTALL(TARGETS ICOCOCXX DESTINATION lib) +INSTALL(FILES ${_lib_HEADERS} DESTINATION include) + diff --git a/Examples/hxx1/ICOCO/src/ICOCO.cxx b/Examples/hxx1/ICOCO/src/ICOCO.cxx new file mode 100644 index 0000000..a1dcaee --- /dev/null +++ b/Examples/hxx1/ICOCO/src/ICOCO.cxx @@ -0,0 +1,202 @@ +#include "ICOCO.hxx" + +#include "MEDCouplingUMesh.hxx" +#include "MEDCouplingMemArray.hxx" +#include "MEDCouplingFieldDouble.hxx" +#include +#include + +using namespace std; + +const char ICOCO::FIELD_NAME1[]="SourceField"; +const char ICOCO::FIELD_NAME2[]="TargetField"; + +ICOCO::ICOCO():_field_source(0),_field_target(0) +{ +} + +ICOCO::~ICOCO() +{ + if(_field_source) + _field_source->decrRef(); + if(_field_target) + _field_target->decrRef(); +} + +bool ICOCO::solve() +{ + if(!_field_source) + _field_source=buildSourceField(); + else + { + double *values=_field_source->getArray()->getPointer(); + int nbOfValues=_field_source->getNumberOfTuples()*_field_source->getNumberOfComponents(); + std::transform(values,values+nbOfValues,values,std::bind2nd(std::multiplies(),2.)); + _field_source->declareAsNew(); + } + if(!_field_target) + _field_target=buildTargetField(); + else + { + double *values=_field_target->getArray()->getPointer(); + int nbOfValues=_field_target->getNumberOfTuples()*_field_target->getNumberOfComponents(); + std::transform(values,values+nbOfValues,values,std::bind2nd(std::multiplies(),3.)); + _field_target->declareAsNew(); + } +} + +void ICOCO::initialize() +{ + if(_field_source) + _field_source->decrRef(); + _field_source=0; + if(_field_target) + _field_target->decrRef(); + _field_target=0; +} + +std::vector ICOCO::getInputFieldsNames() +{ + std::vector ret; + ret.push_back(FIELD_NAME1); + ret.push_back(FIELD_NAME2); + return ret; +} + +MEDCoupling::MEDCouplingUMesh *ICOCO::getInputFieldTemplate(const char *name) +{ + std::string nameCpp(name); + if(nameCpp==FIELD_NAME1) + return buildSourceUMesh(); + if(nameCpp==FIELD_NAME2) + return buildTargetUMesh(); + return 0; +} + +MEDCoupling::MEDCouplingFieldDouble *ICOCO::getOutputField(const char *fieldName) +{ + std::string fieldNameCpp(fieldName); + if(fieldNameCpp==FIELD_NAME1) + { + if(_field_source) + _field_source->incrRef(); + return _field_source; + } + if(fieldNameCpp==FIELD_NAME2) + { + if(_field_target) + _field_target->incrRef(); + return _field_target; + } + return 0; +} + +void ICOCO::printField(const MEDCoupling::MEDCouplingFieldDouble *field) +{ + std::copy(field->getArray()->getConstPointer(),field->getArray()->getConstPointer()+field->getArray()->getNbOfElems(),std::ostream_iterator(cout," ")); + std::cout << endl; +} + +void ICOCO::setInputField(const char *name, const MEDCoupling::MEDCouplingFieldDouble *field) +{ + std::string nameCpp(name); + if(nameCpp==FIELD_NAME1) + { + if(_field_source) + _field_source->decrRef(); + _field_source=(MEDCoupling::MEDCouplingFieldDouble *)field; + if(_field_source) + _field_source->incrRef(); + } + if(nameCpp==FIELD_NAME2) + { + if(_field_target) + _field_target->decrRef(); + _field_target=(MEDCoupling::MEDCouplingFieldDouble *)field; + if(_field_target) + _field_target->incrRef(); + } +} + +MEDCoupling::MEDCouplingUMesh *ICOCO::buildSourceUMesh() +{ + double sourceCoords[27]={ 0.0, 0.0, 200.0, 0.0, 0.0, 0.0, 0.0, 200.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0, + 200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0 }; + int sourceConn[48]={8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2}; + MEDCoupling::MEDCouplingUMesh *sourceMesh=MEDCoupling::MEDCouplingUMesh::New(); + sourceMesh->setMeshDimension(3); + sourceMesh->allocateCells(12); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+4); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+8); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+12); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+16); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+20); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+24); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+28); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+32); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+36); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+40); + sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,sourceConn+44); + sourceMesh->finishInsertingCells(); + MEDCoupling::DataArrayDouble *myCoords=MEDCoupling::DataArrayDouble::New(); + myCoords->alloc(9,3); + std::copy(sourceCoords,sourceCoords+27,myCoords->getPointer()); + sourceMesh->setCoords(myCoords); + myCoords->decrRef(); + return sourceMesh; +} + +MEDCoupling::MEDCouplingUMesh *ICOCO::buildTargetUMesh() +{ + double targetCoords[81]={ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. , + 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. , + 0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200. }; + int targetConn[64]={0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16, + 9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,23,26,25}; + MEDCoupling::MEDCouplingUMesh *targetMesh=MEDCoupling::MEDCouplingUMesh::New(); + targetMesh->setMeshDimension(3); + targetMesh->allocateCells(12); + for(int i=0;i<8;i++) + targetMesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,targetConn+8*i); + targetMesh->finishInsertingCells(); + MEDCoupling::DataArrayDouble *myCoords=MEDCoupling::DataArrayDouble::New(); + myCoords->alloc(27,3); + std::copy(targetCoords,targetCoords+81,myCoords->getPointer()); + targetMesh->setCoords(myCoords); + myCoords->decrRef(); + return targetMesh; +} + +MEDCoupling::MEDCouplingFieldDouble *ICOCO::buildSourceField() +{ + MEDCoupling::MEDCouplingUMesh *mesh=buildSourceUMesh(); + MEDCoupling::MEDCouplingFieldDouble *fieldOnCells=MEDCoupling::MEDCouplingFieldDouble::New(MEDCoupling::ON_CELLS); + fieldOnCells->setMesh(mesh); + MEDCoupling::DataArrayDouble *array=MEDCoupling::DataArrayDouble::New(); + array->alloc(mesh->getNumberOfCells(),1); + fieldOnCells->setArray(array); + double *values=array->getPointer(); + for(int i=0;igetNumberOfCells();i++) + values[i]=2.*((double)i); + mesh->decrRef(); + array->decrRef(); + return fieldOnCells; +} + +MEDCoupling::MEDCouplingFieldDouble *ICOCO::buildTargetField() +{ + MEDCoupling::MEDCouplingUMesh *mesh=buildTargetUMesh(); + MEDCoupling::MEDCouplingFieldDouble *fieldOnCells=MEDCoupling::MEDCouplingFieldDouble::New(MEDCoupling::ON_CELLS); + fieldOnCells->setMesh(mesh); + MEDCoupling::DataArrayDouble *array=MEDCoupling::DataArrayDouble::New(); + array->alloc(mesh->getNumberOfCells(),1); + fieldOnCells->setArray(array); + double *values=array->getPointer(); + for(int i=0;igetNumberOfCells();i++) + values[i]=7.*((double)i); + mesh->decrRef(); + array->decrRef(); + return fieldOnCells; +} + diff --git a/Examples/hxx1/ICOCO/src/ICOCO.hxx b/Examples/hxx1/ICOCO/src/ICOCO.hxx new file mode 100644 index 0000000..93aa815 --- /dev/null +++ b/Examples/hxx1/ICOCO/src/ICOCO.hxx @@ -0,0 +1,40 @@ +#ifndef _ICOCO_HXX_ +#define _ICOCO_HXX_ + +// forward declaration +#include +#include + +namespace MEDCoupling +{ + class MEDCouplingUMesh; + class MEDCouplingFieldDouble; +} + +class ICOCO +{ +// Méthodes publiques +public: + ICOCO(); + ~ICOCO(); + void initialize(); + bool solve(); + std::vector getInputFieldsNames(); + MEDCoupling::MEDCouplingUMesh *getInputFieldTemplate(const char *name); + MEDCoupling::MEDCouplingFieldDouble *getOutputField(const char *fieldName); + void printField(const MEDCoupling::MEDCouplingFieldDouble *field); + void setInputField(const char *name, const MEDCoupling::MEDCouplingFieldDouble *field); +private: + MEDCoupling::MEDCouplingUMesh *buildSourceUMesh(); + MEDCoupling::MEDCouplingUMesh *buildTargetUMesh(); + MEDCoupling::MEDCouplingFieldDouble *buildSourceField(); + MEDCoupling::MEDCouplingFieldDouble *buildTargetField(); +private: + MEDCoupling::MEDCouplingFieldDouble *_field_source; + MEDCoupling::MEDCouplingFieldDouble *_field_target; +private: + static const char FIELD_NAME1[]; + static const char FIELD_NAME2[]; +}; + +#endif diff --git a/Examples/hxx1/ICOCO/src/main.cxx b/Examples/hxx1/ICOCO/src/main.cxx new file mode 100644 index 0000000..b7b3b0f --- /dev/null +++ b/Examples/hxx1/ICOCO/src/main.cxx @@ -0,0 +1,11 @@ +#include "ICOCO.hxx" +#include + +using namespace std; +int main(int argc, char ** argv) +{ + if (getenv("SALOME_trace") == NULL ) + setenv("SALOME_trace","local",0); + ICOCO myCalc; + // test myCalc component ... +} diff --git a/Examples/hxx1/Makefile b/Examples/hxx1/Makefile index 9034fee..eed0de1 100644 --- a/Examples/hxx1/Makefile +++ b/Examples/hxx1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak *.err *.log + rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak *.err *.log *_build diff --git a/Examples/hxx1/build.sh b/Examples/hxx1/build.sh index 23792fd..734de46 100755 --- a/Examples/hxx1/build.sh +++ b/Examples/hxx1/build.sh @@ -1,15 +1,18 @@ - # build COMPONENTCPP lib -tar -xzvf cpp_component.tgz -mkdir COMPONENTCPP_BUILD -export HXXTESTPATH=`pwd` -cd COMPONENTCPP_SRC -../../exec.sh ./build_configure -cd ../COMPONENTCPP_BUILD -../../exec.sh ../COMPONENTCPP_SRC/configure --prefix=$HXXTESTPATH/COMPONENTCPP_INSTALL +mkdir CALCUL_build +cd CALCUL_build +../../exec.sh cmake -DCMAKE_INSTALL_PREFIX:PATH=../COMPONENTCPP_INSTALL ../CALCUL/src/ +../../exec.sh make +../../exec.sh make install +cd .. + +mkdir ICOCO_build +cd ICOCO_build +../../exec.sh cmake -DCMAKE_INSTALL_PREFIX:PATH=../COMPONENTCPP_INSTALL ../ICOCO/src/ ../../exec.sh make ../../exec.sh make install cd .. + # build & test SALOME component ../exec.sh python component.py diff --git a/Examples/hxx1/cpp_component.tgz b/Examples/hxx1/cpp_component.tgz deleted file mode 100644 index 92c7422..0000000 Binary files a/Examples/hxx1/cpp_component.tgz and /dev/null differ diff --git a/module_generator/gener.py b/module_generator/gener.py index dc63939..d164938 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -484,8 +484,29 @@ class Generator(object): prefix = os.path.abspath(self.module.prefix) component_libs = "".join(map(lambda x: x.libraryName()+" ", module.components)) - add_modules = "".join(map(lambda x:cmake_find_module.substitute(module=x), - self.used_modules)) + add_modules = "" + for x in self.used_modules: + cmake_text = cmake_find_module.substitute(module=x) + if x == "MED": + cmake_text = cmake_text + """ +##################################### +# FIND MEDCOUPLING +##################################### +SET(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} CACHE PATH "Path to MEDCOUPLING module") +IF(EXISTS ${MEDCOUPLING_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${MEDCOUPLING_ROOT_DIR}/cmake_files") + FIND_PACKAGE(SalomeMEDCoupling REQUIRED) + ADD_DEFINITIONS(${MEDCOUPLING_DEFINITIONS}) + INCLUDE_DIRECTORIES(${MEDCOUPLING_INCLUDE_DIRS}) +ELSE(EXISTS ${MEDCOUPLING_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need MEDCOUPLING module, please define MEDCOUPLING_ROOT_DIR") +ENDIF(EXISTS ${MEDCOUPLING_ROOT_DIR}) +##################################### + +""" + add_modules = add_modules + cmake_text + pass + self.makeFiles({"CMakeLists.txt":cmake_root_cpp.substitute( module=self.module.name, module_min=self.module.name.lower(), diff --git a/module_generator/hxx_awk.py b/module_generator/hxx_awk.py index a850248..df7c7ea 100644 --- a/module_generator/hxx_awk.py +++ b/module_generator/hxx_awk.py @@ -51,10 +51,10 @@ cpp2idl_mapping["const MEDMEM::FIELD&"]="in SALOME_MED::FIELDINT" cpp2idl_mapping["MEDMEM::FIELD*&"]="out SALOME_MED::FIELDINT" cpp2idl_mapping["const std::vector&"]="in %(module)s::intvec" cpp2idl_mapping["std::vector*&"]="out %(module)s::intvec" -cpp2idl_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" -cpp2idl_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" -cpp2idl_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" -cpp2idl_mapping["const ParaMEDMEM::MEDCouplingUMesh*"]="in SALOME_MED::MEDCouplingUMeshCorbaInterface" +cpp2idl_mapping["const MEDCoupling::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" +cpp2idl_mapping["const MEDCoupling::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" +cpp2idl_mapping["MEDCoupling::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" +cpp2idl_mapping["const MEDCoupling::MEDCouplingUMesh*"]="in SALOME_MED::MEDCouplingUMeshCorbaInterface" # ['stringvec', 'string', 'double', 'long', 'dblevec', 'file', 'intvec', 'dataref', 'GEOM_Object', 'SMESH_Mesh', 'SMESH_Hypothesis', 'SALOME_MED/MED', 'SALOME_MED/MESH', 'SALOME_MED/SUPPORT', 'SALOME_MED/FIELD', 'SALOME_MED/FIELDDOUBLE', 'SALOME_MED/FIELDINT'] cpp2yacs_mapping={} @@ -111,13 +111,13 @@ cpp2yacs_mapping["std::vector*"]="intvec" cpp2yacs_mapping["std::vector >*"]="SALOME/Matrix" cpp2yacs_mapping["std::vector"]="stringvec" -cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" -cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" -cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingUMesh*"]="SALOME_MED/MEDCouplingUMeshCorbaInterface" -cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" -cpp2yacs_mapping["ParaMEDMEM::MEDCouplingUMesh*"]="SALOME_MED/MEDCouplingUMeshCorbaInterface" -cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" -cpp2yacs_mapping["ParaMEDMEM::DataArrayDouble*"]="SALOME_MED/DataArrayDoubleCorbaInterface" +cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" +cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" +cpp2yacs_mapping["const MEDCoupling::MEDCouplingUMesh*"]="SALOME_MED/MEDCouplingUMeshCorbaInterface" +cpp2yacs_mapping["MEDCoupling::MEDCouplingFieldDouble*&"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" +cpp2yacs_mapping["MEDCoupling::MEDCouplingUMesh*"]="SALOME_MED/MEDCouplingUMeshCorbaInterface" +cpp2yacs_mapping["MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED/MEDCouplingFieldDoubleCorbaInterface" +cpp2yacs_mapping["MEDCoupling::DataArrayDouble*"]="SALOME_MED/DataArrayDoubleCorbaInterface" # table for c++ code generation : argument's processing cpp_impl_a={} cpp_impl_a["int"]="\tint _%(arg)s(%(arg)s);\n" @@ -158,11 +158,11 @@ cpp_impl_a["const std::vector&"]="\tlong _%(arg)s_size=%(arg)s.length();\n" "\tstd::vector _%(arg)s(_%(arg)s_size);\n"\ "\tfor (int i=0; i!=_%(arg)s_size; ++i)\n\t _%(arg)s[i]=%(arg)s[i];" cpp_impl_a["std::vector*&"]="\tstd::vector* _%(arg)s;\n" -cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%(arg)s);\n" -cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble&"]="\tParaMEDMEM::MEDCouplingFieldDouble* __%(arg)s=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(%(arg)s);\n"\ - "\tParaMEDMEM::MEDCouplingFieldDouble& _%(arg)s=*__%(arg)s;\n" -cpp_impl_a["ParaMEDMEM::MEDCouplingFieldDouble*&"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s;\n" -cpp_impl_a["const ParaMEDMEM::MEDCouplingUMesh*"]="\tParaMEDMEM::MEDCouplingUMesh* _%(arg)s=ParaMEDMEM::MEDCouplingUMeshClient::New(%(arg)s);\n" +cpp_impl_a["const MEDCoupling::MEDCouplingFieldDouble*"]="\tMEDCoupling::MEDCouplingFieldDouble* _%(arg)s=MEDCoupling::MEDCouplingFieldDoubleClient::New(%(arg)s);\n" +cpp_impl_a["const MEDCoupling::MEDCouplingFieldDouble&"]="\tMEDCoupling::MEDCouplingFieldDouble* __%(arg)s=MEDCoupling::MEDCouplingFieldDoubleClient::New(%(arg)s);\n"\ + "\tMEDCoupling::MEDCouplingFieldDouble& _%(arg)s=*__%(arg)s;\n" +cpp_impl_a["MEDCoupling::MEDCouplingFieldDouble*&"]="\tMEDCoupling::MEDCouplingFieldDouble* _%(arg)s;\n" +cpp_impl_a["const MEDCoupling::MEDCouplingUMesh*"]="\tMEDCoupling::MEDCouplingUMesh* _%(arg)s=MEDCoupling::MEDCouplingUMeshClient::New(%(arg)s);\n" # table for c++ code generation : returned value processing @@ -215,13 +215,13 @@ cpp_impl_b["std::vector"]="""\t%(module)s::stringvec * _rtn_ior = n \t_rtn_ior->length(_rtn_cpp_length); \tfor (int i=0; i<_rtn_cpp_length; ++i) \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); +cpp_impl_b["MEDCoupling::MEDCouplingFieldDouble*"]="""\tMEDCoupling::MEDCouplingFieldDoubleServant * _rtn_field_i = new MEDCoupling::MEDCouplingFieldDoubleServant(_rtn_cpp); \t_rtn_cpp->decrRef(); \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); +cpp_impl_b["MEDCoupling::MEDCouplingUMesh*"]="""\tMEDCoupling::MEDCouplingUMeshServant * _rtn_mesh_i = new MEDCoupling::MEDCouplingUMeshServant(_rtn_cpp); \t_rtn_cpp->decrRef(); \tSALOME_MED::MEDCouplingUMeshCorbaInterface_ptr _rtn_ior = _rtn_mesh_i->_this();\n""" -cpp_impl_b["ParaMEDMEM::DataArrayDouble*"]="""\tParaMEDMEM::DataArrayDoubleServant * _rtn_field_i = new ParaMEDMEM::DataArrayDoubleServant(_rtn_cpp); +cpp_impl_b["MEDCoupling::DataArrayDouble*"]="""\tMEDCoupling::DataArrayDoubleServant * _rtn_field_i = new MEDCoupling::DataArrayDoubleServant(_rtn_cpp); \t_rtn_cpp->decrRef(); \tSALOME_MED::DataArrayDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n""" # @@ -250,10 +250,10 @@ cpp_impl_c["const MEDMEM::MESH&"]="\t_%(arg)s->removeReference();\n" cpp_impl_c["const MEDMEM::MESH*"]="\t_%(arg)s->removeReference();\n" cpp_impl_c["const MEDMEM::SUPPORT&"]="\t_%(arg)s->removeReference();\n" cpp_impl_c["const MEDMEM::SUPPORT*"]="\t_%(arg)s->removeReference();\n" -cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\t_%(arg)s->decrRef();\n" -cpp_impl_c["const ParaMEDMEM::MEDCouplingUMesh*"]="\t_%(arg)s->decrRef();\n" -cpp_impl_c["const ParaMEDMEM::MEDCouplingFieldDouble&"]="\t__%(arg)s->decrRef();\n" -cpp_impl_c["ParaMEDMEM::MEDCouplingFieldDouble*&"]="""\tParaMEDMEM::MEDCouplingFieldDoubleServant * %(arg)s_out=new ParaMEDMEM::MEDCouplingFieldDoubleServant(_%(arg)s); +cpp_impl_c["const MEDCoupling::MEDCouplingFieldDouble*"]="\t_%(arg)s->decrRef();\n" +cpp_impl_c["const MEDCoupling::MEDCouplingUMesh*"]="\t_%(arg)s->decrRef();\n" +cpp_impl_c["const MEDCoupling::MEDCouplingFieldDouble&"]="\t__%(arg)s->decrRef();\n" +cpp_impl_c["MEDCoupling::MEDCouplingFieldDouble*&"]="""\tMEDCoupling::MEDCouplingFieldDoubleServant * %(arg)s_out=new MEDCoupling::MEDCouplingFieldDoubleServant(_%(arg)s); \t_%(arg)s->decrRef(); \t%(arg)s = %(arg)s_out->_this();\n""" @@ -375,10 +375,10 @@ 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" - idl_arg_type["const ParaMEDMEM::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" - idl_arg_type["ParaMEDMEM::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" - idl_arg_type["const ParaMEDMEM::MEDCouplingUMesh*"]="in SALOME_MED::MEDCouplingUMeshCorbaInterface" + idl_arg_type["const MEDCoupling::MEDCouplingFieldDouble*"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" + idl_arg_type["const MEDCoupling::MEDCouplingFieldDouble&"]="in SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" + idl_arg_type["MEDCoupling::MEDCouplingFieldDouble*&"]="out SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" + idl_arg_type["const MEDCoupling::MEDCouplingUMesh*"]="in SALOME_MED::MEDCouplingUMeshCorbaInterface" # # # mapping for returned types @@ -411,9 +411,9 @@ 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" - idl_rtn_type["ParaMEDMEM::DataArrayDouble*"]="SALOME_MED::DataArrayDoubleServantCorbaInterface" + idl_rtn_type["MEDCoupling::MEDCouplingUMesh*"]="SALOME_MED::MEDCouplingUMeshCorbaInterface" + idl_rtn_type["MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED::MEDCouplingFieldDoubleCorbaInterface" + idl_rtn_type["MEDCoupling::DataArrayDouble*"]="SALOME_MED::DataArrayDoubleServantCorbaInterface" # # # record sep is ");\\n" whith blanks all around, and optional "(" at the beginning diff --git a/module_generator/hxx_para_tmpl.py b/module_generator/hxx_para_tmpl.py index f2558ba..1496c8c 100644 --- a/module_generator/hxx_para_tmpl.py +++ b/module_generator/hxx_para_tmpl.py @@ -131,7 +131,7 @@ class ${component}; // forward declaration class ${component}_i: ${inheritedclass} public POA_${module}_ORB::${component}_Gen, - public ParaMEDMEM::ParaMEDMEMComponent_i + public MEDCoupling::ParaMEDMEMComponent_i { public: diff --git a/module_generator/hxxparacompo.py b/module_generator/hxxparacompo.py index dacd623..059dbce 100644 --- a/module_generator/hxxparacompo.py +++ b/module_generator/hxxparacompo.py @@ -103,10 +103,10 @@ class HXX2SALOMEParaComponent(Component): # The information relative to a service (called service_name) is stored in the dictionnary service_definition[service_name] from hxx_awk import cpp2idl_mapping from hxx_awk import cpp2yacs_mapping - cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" - cpp2yacs_mapping["const ParaMEDMEM::MEDCouplingFieldDouble&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" - cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" - cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" + cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" + cpp2yacs_mapping["const MEDCoupling::MEDCouplingFieldDouble&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" + cpp2yacs_mapping["MEDCoupling::MEDCouplingFieldDouble*&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" + cpp2yacs_mapping["MEDCoupling::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface" list_of_services=[] service_definition={} result_parsing=open("parse_type_result","r") @@ -147,10 +147,10 @@ class HXX2SALOMEParaComponent(Component): # store it in service_definition[serv]["impl"] # from hxx_awk import cpp_impl_a,cpp_impl_b,cpp_impl_c # these tables contain the part of code which depends upon c++ types - cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]="""\tParaMEDMEM::MPIMEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::MPIMEDCouplingFieldDoubleServant(_orb,_poa,this,_rtn_cpp); + cpp_impl_b["MEDCoupling::MEDCouplingFieldDouble*"]="""\tMEDCoupling::MPIMEDCouplingFieldDoubleServant * _rtn_field_i = new MEDCoupling::MPIMEDCouplingFieldDoubleServant(_orb,_poa,this,_rtn_cpp); \t_rtn_cpp->decrRef(); \tSALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr _rtn_ior = _rtn_field_i->_this();\n""" - cpp_impl_a["const ParaMEDMEM::MEDCouplingFieldDouble*"]="\tParaMEDMEM::MEDCouplingFieldDouble* _%(arg)s=cppCompo_->getInputFieldTemplate();\n\t_setInputField(%(arg)s,_%(arg)s);\n\t_initializeCoupling(%(arg)s);\n" + cpp_impl_a["const MEDCoupling::MEDCouplingFieldDouble*"]="\tMEDCoupling::MEDCouplingFieldDouble* _%(arg)s=cppCompo_->getInputFieldTemplate();\n\t_setInputField(%(arg)s,_%(arg)s);\n\t_initializeCoupling(%(arg)s);\n" from yacstypes import corbaTypes,corbaOutTypes format_thread_signature="void * th_%s(void * st);" # this thread declaration will be included in servant's header