]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
Generates Salome layers for MPI-parallel codes without additional parameters for...
authortajchman <tajchman>
Thu, 29 Mar 2012 13:26:56 +0000 (13:26 +0000)
committertajchman <tajchman>
Thu, 29 Mar 2012 13:26:56 +0000 (13:26 +0000)
module_generator/hxx_para_tmpl.py
module_generator/hxxparacompo.py

index 7df0ed7e17492fbfb824c63578a91398947df665..da20ba5c1247590887ebe44baec28fdf95eb30a2 100644 (file)
@@ -87,6 +87,14 @@ extern "C"
 
    bool regist;
    int numproc;
+   int flag;
+
+   MPI_Initialized(&flag);
+   if (!flag) {
+      int argc = 0;
+      char ** argv = NULL;
+      MPI_Init(&argc, &argv);
+   }
 
    MPI_Comm_rank( MPI_COMM_WORLD, &numproc );
    if( numproc == 0 )
index 89f5d80962aa9fdc51dfce9db7b0867cb4eb9e32..a8a3328592b0d07792e29a8459f21f1512a30bf1 100644 (file)
@@ -107,7 +107,6 @@ class HXX2SALOMEParaComponent(Component):
     cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*&"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
     cpp2yacs_mapping["ParaMEDMEM::MEDCouplingFieldDouble*"]="SALOME_MED/MPIMEDCouplingFieldDoubleCorbaInterface"
     list_of_services=[]
-    list_of_services_with_in_fields=[]
     service_definition={}
     result_parsing=open("parse_type_result","r")
     for line in result_parsing.readlines():
@@ -137,13 +136,8 @@ class HXX2SALOMEParaComponent(Component):
             assert inout=="in" or inout=="ou",'Error in table cpp2idl_mapping'
             if inout == "in":
                 service_definition[list_of_services[-1]]["inports"].append( (argname,typename) )
-                if typename=="const ParaMEDMEM::MEDCouplingFieldDouble*":
-                    list_of_services_with_in_fields.append(list_of_services[-1])
             else:
                 service_definition[list_of_services[-1]]["outports"].append( (argname,typename) )
-    for servNane in list_of_services_with_in_fields:
-        service_definition[servNane]["inports"].append(("coupling","const char*"))
-        service_definition[servNane]["ports"].append(("coupling","const char*"))
 
     if service_definition.has_key('getInputFieldTemplate'):
         del service_definition['getInputFieldTemplate']
@@ -152,10 +146,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,this,_rtn_cpp);
+    cpp_impl_b["ParaMEDMEM::MEDCouplingFieldDouble*"]="""\tParaMEDMEM::MPIMEDCouplingFieldDoubleServant * _rtn_field_i = new ParaMEDMEM::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(coupling,%(arg)s,_%(arg)s);\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"
 
     from yacstypes import corbaTypes,corbaOutTypes
     format_thread_signature="void * th_%s(void * st);" # this thread declaration will be included in servant's header
@@ -283,8 +277,7 @@ void *th_%(serv_name)s(void *s)
               if  argtype == "const MEDMEM::MESH&"  or  argtype == "const MEDMEM::SUPPORT&" : 
                   pre="*"  # we cannot create MESHClient on the stack (private constructor), so we create it on the heap and dereference it
               post+="," # separator between arguments
-              if(argname!="coupling"):  # coupling is a special argument added for input fields - it should not be transferred to the underlying c++ component
-                  s_call_cpp_function += " %s_%s%s" % ( pre,argname,post)
+              s_call_cpp_function += " %s_%s%s" % ( pre,argname,post)
         if s_call_cpp_function[-1]==',':
             s_call_cpp_function=s_call_cpp_function[0:-1] # get rid of trailing comma
         s_call_cpp_function=s_call_cpp_function+');\n'