1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
20 // File : param_double_port_uses.cxx
21 // Author : André RIBES (EDF)
24 #include "Param_Double_Port_uses_i.hxx"
26 Param_Double_Port_uses_i::Param_Double_Port_uses_i(Engines_ParallelDSC_i * par_compo,
27 std::string port_name,
30 _orb = CORBA::ORB::_duplicate(orb);
31 _fake_properties = new PortProperties_i();
32 _fake_prop_ref = _fake_properties->_this();
33 _fake_properties->_remove_ref();
35 _par_compo = par_compo;
36 _port_name = port_name;
37 _provides_port = NULL;
39 paco_fabrique_manager * pfm = paco_getFabriqueManager();
40 pfm->register_comScheduling("Param_Double_Port_uses_i_direct", new paco_direct_fabrique());
41 pfm->register_distribution("Param_Double_Port_uses_i_GaBro", new GaBro_fab());
42 pfm->register_distribution("Param_Double_Port_uses_i_BasicBC", new BasicBC_fab());
45 Param_Double_Port_uses_i::~Param_Double_Port_uses_i()
49 _provides_port->stop();
50 delete _provides_port;
55 Param_Double_Port_uses_i::add_port_to_component()
57 _par_compo->add_uses_port("IDL:Ports/Param_Double_Port:1.0",
63 Param_Double_Port_uses_i::start_port()
65 Engines::DSC::uses_port * uport = _par_compo->get_uses_port(_port_name.c_str());
66 _proxy_port = Ports::Param_Double_Port::_narrow((*uport)[0]);
67 _provides_port = Ports::PaCO_Param_Double_Port::PaCO_narrow(_proxy_port, _orb);
68 _provides_port->copyClientGlobalContext(_par_compo);
69 _provides_port->init(_par_compo->getMyRank(), _par_compo->getTotalNode());
71 // Il faut maintenant configurer les bibliothèques
72 // de redistributions de la fonction put
73 ParallelMethodContext * method_ptr;
74 method_ptr = _provides_port->getParallelMethodContext("put");
75 method_ptr->setLibComScheduling("Param_Double_Port_uses_i_direct");
76 method_ptr->setDistLibArg("param_data", "Param_Double_Port_uses_i_BasicBC", "in");
77 BasicBC * dislib = (BasicBC *) method_ptr->getDistLibArg("param_data", "in");
78 dislib->setEltSize(sizeof(CORBA::Double));
79 dislib->setBlocSize(0); // BLOC
80 dislib->setNodeRank(_par_compo->getMyRank());
82 // Il faut maintenant configurer les bibliothèques
83 // de redistributions de la fonction get_results
84 method_ptr = _provides_port->getParallelMethodContext("get_results");
85 method_ptr->setLibComScheduling("Param_Double_Port_uses_i_direct");
86 method_ptr->setDistLibArg("param_results", "Param_Double_Port_uses_i_GaBro", "out");
87 GaBro * dislib_gabro = (GaBro *) method_ptr->getDistLibArg("param_results", "out");
88 dislib_gabro->setEltSize(sizeof(CORBA::Double));
90 _provides_port->start();
95 Param_Double_Port_uses_i::configure_port_method_put(int totalNbElt)
97 ParallelMethodContext * method_ptr;
98 method_ptr = _provides_port->getParallelMethodContext("put");
99 BasicBC * dislib = (BasicBC *) method_ptr->getDistLibArg("param_data", "in");
100 dislib->setTotalNbElt(totalNbElt);
104 Param_Double_Port_uses_i::put(const Ports::Param_Double_Port::seq_double & param_data)
106 _provides_port->put(param_data);
110 Param_Double_Port_uses_i::get_results(Ports::Param_Double_Port::seq_double_out param_results)
112 _provides_port->get_results(param_results);