1 // Copyright (C) 2009 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : param_double_port_uses.cxx
20 // Author : André RIBES (EDF)
23 #include "Param_Double_Port_uses_i.hxx"
25 Param_Double_Port_uses_i::Param_Double_Port_uses_i(Engines_ParallelDSC_i * par_compo,
26 std::string port_name,
29 _orb = CORBA::ORB::_duplicate(orb);
30 _fake_properties = new PortProperties_i();
31 _fake_prop_ref = _fake_properties->_this();
32 _fake_properties->_remove_ref();
34 _par_compo = par_compo;
35 _port_name = port_name;
36 _provides_port = NULL;
38 paco_fabrique_manager * pfm = paco_getFabriqueManager();
39 pfm->register_comScheduling("Param_Double_Port_uses_i_direct", new paco_direct_fabrique());
40 pfm->register_distribution("Param_Double_Port_uses_i_GaBro", new GaBro_fab());
41 pfm->register_distribution("Param_Double_Port_uses_i_BasicBC", new BasicBC_fab());
44 Param_Double_Port_uses_i::~Param_Double_Port_uses_i()
48 _provides_port->stop();
49 delete _provides_port;
54 Param_Double_Port_uses_i::add_port_to_component()
56 _par_compo->add_uses_port("IDL:Ports/Param_Double_Port:1.0",
62 Param_Double_Port_uses_i::start_port()
64 Engines::DSC::uses_port * uport = _par_compo->get_uses_port(_port_name.c_str());
65 _proxy_port = Ports::Param_Double_Port::_narrow((*uport)[0]);
66 _provides_port = Ports::PaCO_Param_Double_Port::PaCO_narrow(_proxy_port, _orb);
67 _provides_port->copyClientGlobalContext(_par_compo);
68 _provides_port->init(_par_compo->getMyRank(), _par_compo->getTotalNode());
70 // Il faut maintenant configurer les bibliothèques
71 // de redistributions de la fonction put
72 ParallelMethodContext * method_ptr;
73 method_ptr = _provides_port->getParallelMethodContext("put");
74 method_ptr->setLibComScheduling("Param_Double_Port_uses_i_direct");
75 method_ptr->setDistLibArg("param_data", "Param_Double_Port_uses_i_BasicBC", "in");
76 BasicBC * dislib = (BasicBC *) method_ptr->getDistLibArg("param_data", "in");
77 dislib->setEltSize(sizeof(CORBA::Double));
78 dislib->setBlocSize(0); // BLOC
79 dislib->setNodeRank(_par_compo->getMyRank());
81 // Il faut maintenant configurer les bibliothèques
82 // de redistributions de la fonction get_results
83 method_ptr = _provides_port->getParallelMethodContext("get_results");
84 method_ptr->setLibComScheduling("Param_Double_Port_uses_i_direct");
85 method_ptr->setDistLibArg("param_results", "Param_Double_Port_uses_i_GaBro", "out");
86 GaBro * dislib_gabro = (GaBro *) method_ptr->getDistLibArg("param_results", "out");
87 dislib_gabro->setEltSize(sizeof(CORBA::Double));
89 _provides_port->start();
94 Param_Double_Port_uses_i::configure_port_method_put(int totalNbElt)
96 ParallelMethodContext * method_ptr;
97 method_ptr = _provides_port->getParallelMethodContext("put");
98 BasicBC * dislib = (BasicBC *) method_ptr->getDistLibArg("param_data", "in");
99 dislib->setTotalNbElt(totalNbElt);
103 Param_Double_Port_uses_i::put(const Ports::Param_Double_Port::seq_double & param_data)
105 _provides_port->put(param_data);
109 Param_Double_Port_uses_i::get_results(Ports::Param_Double_Port::seq_double_out param_results)
111 _provides_port->get_results(param_results);