|
preCICE
|
Implements Communication by using sockets. More...
#include <SocketCommunication.hpp>
Public Member Functions | |
| SocketCommunication (unsigned short portNumber=0, bool reuseAddress=false, std::string networkName=utils::networking::loopbackInterfaceName(), std::string addressDirectory=".") | |
| SocketCommunication (std::string const &addressDirectory) | |
| ~SocketCommunication () override | |
| size_t | getRemoteCommunicatorSize () override |
| void | acceptConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int rankOffset=0) override |
| void | acceptConnectionAsServer (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int requesterCommunicatorSize) override |
| void | requestConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int requesterRank, int requesterCommunicatorSize) override |
| void | requestConnectionAsClient (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, std::set< int > const &acceptorRanks, int requesterRank) override |
| void | closeConnection () override |
| void | send (std::string const &itemToSend, Rank rankReceiver) override |
| Sends a std::string to process with given rank. | |
| void | send (precice::span< const int > itemsToSend, Rank rankReceiver) override |
| Sends an array of integer values. | |
| PtrRequest | aSend (precice::span< const int > itemsToSend, Rank rankReceiver) override |
| Asynchronously sends an array of integer values. | |
| void | send (precice::span< const double > itemsToSend, Rank rankReceiver) override |
| Sends an array of double values. | |
| PtrRequest | aSend (precice::span< const double > itemsToSend, Rank rankReceiver) override |
| Asynchronously sends an array of double values. | |
| void | send (double itemToSend, Rank rankReceiver) override |
| Sends a double to process with given rank. | |
| PtrRequest | aSend (const double &itemToSend, Rank rankReceiver) override |
| Asynchronously sends a double to process with given rank. | |
| void | send (int itemToSend, Rank rankReceiver) override |
| Sends an int to process with given rank. | |
| PtrRequest | aSend (const int &itemToSend, Rank rankReceiver) override |
| Asynchronously sends an int to process with given rank. | |
| void | send (bool itemToSend, Rank rankReceiver) override |
| Sends a bool to process with given rank. | |
| PtrRequest | aSend (const bool &itemToSend, Rank rankReceiver) override |
| Asynchronously sends a bool to process with given rank. | |
| void | receive (std::string &itemToReceive, Rank rankSender) override |
| Receives a std::string from process with given rank. | |
| void | receive (precice::span< int > itemsToReceive, Rank rankSender) override |
| Receives an array of integer values. | |
| void | receive (precice::span< double > itemsToReceive, Rank rankSender) override |
| Receives an array of double values. | |
| PtrRequest | aReceive (precice::span< double > itemsToReceive, int rankSender) override |
| Asynchronously receives an array of double values. | |
| void | receive (double &itemToReceive, Rank rankSender) override |
| Receives a double from process with given rank. | |
| PtrRequest | aReceive (double &itemToReceive, Rank rankSender) override |
| Asynchronously receives a double from process with given rank. | |
| void | receive (int &itemToReceive, Rank rankSender) override |
| Receives an int from process with given rank. | |
| PtrRequest | aReceive (int &itemToReceive, Rank rankSender) override |
| Asynchronously receives an int from process with given rank. | |
| void | receive (bool &itemToReceive, Rank rankSender) override |
| Receives a bool from process with given rank. | |
| PtrRequest | aReceive (bool &itemToReceive, Rank rankSender) override |
| Asynchronously receives a bool from process with given rank. | |
| void | prepareEstablishment (std::string const &acceptorName, std::string const &requesterName) override |
| void | cleanupEstablishment (std::string const &acceptorName, std::string const &requesterName) override |
Private Types | |
| using | IOContext = boost::asio::io_context |
| using | Socket = boost::asio::ip::tcp::socket |
| using | WorkGuard = boost::asio::executor_work_guard<IOContext::executor_type> |
Private Member Functions | |
| bool | isClient () |
| bool | isServer () |
| std::string | getIpAddress () |
Private Attributes | |
| logging::Logger | _log {"com::SocketCommunication"} |
| unsigned short | _portNumber |
| Port used for socket connection. | |
| bool | _reuseAddress |
| std::string | _networkName |
| Name of network to communicate over. | |
| std::string | _addressDirectory |
| Directory where IP address is exchanged by file. | |
| std::shared_ptr< IOContext > | _ioContext |
| std::unique_ptr< WorkGuard > | _workGuard |
| std::thread | _thread |
| std::map< int, std::shared_ptr< Socket > > | _sockets |
| Remote rank -> socket map. | |
| SocketSendQueue | _queue |
Implements Communication by using sockets.
Definition at line 20 of file SocketCommunication.hpp.
|
private |
Definition at line 143 of file SocketCommunication.hpp.
|
private |
Definition at line 144 of file SocketCommunication.hpp.
|
private |
Definition at line 145 of file SocketCommunication.hpp.
| precice::com::SocketCommunication::SocketCommunication | ( | unsigned short | portNumber = 0, |
| bool | reuseAddress = false, | ||
| std::string | networkName = utils::networking::loopbackInterfaceName(), | ||
| std::string | addressDirectory = "." ) |
Definition at line 24 of file SocketCommunication.cpp.
|
explicit |
|
override |
|
override |
|
override |
|
override |
Asynchronously receives a bool from process with given rank.
Definition at line 699 of file SocketCommunication.cpp.
|
override |
Asynchronously receives a double from process with given rank.
Definition at line 637 of file SocketCommunication.cpp.
|
override |
Asynchronously receives an int from process with given rank.
Definition at line 658 of file SocketCommunication.cpp.
|
override |
Asynchronously receives an array of double values.
Definition at line 596 of file SocketCommunication.cpp.
|
override |
Asynchronously sends a bool to process with given rank.
Definition at line 524 of file SocketCommunication.cpp.
|
override |
Asynchronously sends a double to process with given rank.
Definition at line 482 of file SocketCommunication.cpp.
|
override |
Asynchronously sends an int to process with given rank.
Definition at line 503 of file SocketCommunication.cpp.
|
override |
Asynchronously sends an array of double values.
Definition at line 447 of file SocketCommunication.cpp.
|
override |
Asynchronously sends an array of integer values.
Definition at line 412 of file SocketCommunication.cpp.
|
override |
|
override |
Definition at line 325 of file SocketCommunication.cpp.
|
private |
Definition at line 774 of file SocketCommunication.cpp.
|
override |
Definition at line 50 of file SocketCommunication.cpp.
|
private |
|
private |
|
override |
|
override |
Receives a bool from process with given rank.
Definition at line 683 of file SocketCommunication.cpp.
|
override |
Receives a double from process with given rank.
Definition at line 621 of file SocketCommunication.cpp.
|
override |
Receives an int from process with given rank.
Definition at line 642 of file SocketCommunication.cpp.
|
override |
Receives an array of double values.
Definition at line 580 of file SocketCommunication.cpp.
|
override |
Receives an array of integer values.
Definition at line 564 of file SocketCommunication.cpp.
|
override |
Receives a std::string from process with given rank.
Definition at line 543 of file SocketCommunication.cpp.
|
override |
|
override |
|
override |
Sends a bool to process with given rank.
Definition at line 508 of file SocketCommunication.cpp.
|
override |
Sends a double to process with given rank.
Definition at line 466 of file SocketCommunication.cpp.
|
override |
Sends an int to process with given rank.
Definition at line 487 of file SocketCommunication.cpp.
|
override |
Sends an array of double values.
Definition at line 431 of file SocketCommunication.cpp.
|
override |
Sends an array of integer values.
Definition at line 370 of file SocketCommunication.cpp.
|
override |
Sends a std::string to process with given rank.
Definition at line 352 of file SocketCommunication.cpp.
|
private |
Directory where IP address is exchanged by file.
Definition at line 141 of file SocketCommunication.hpp.
|
private |
Definition at line 147 of file SocketCommunication.hpp.
|
private |
Definition at line 130 of file SocketCommunication.hpp.
|
private |
Name of network to communicate over.
Definition at line 138 of file SocketCommunication.hpp.
|
private |
Port used for socket connection.
Definition at line 133 of file SocketCommunication.hpp.
|
private |
Definition at line 154 of file SocketCommunication.hpp.
|
private |
Definition at line 135 of file SocketCommunication.hpp.
|
private |
Remote rank -> socket map.
Definition at line 152 of file SocketCommunication.hpp.
|
private |
Definition at line 149 of file SocketCommunication.hpp.
|
private |
Definition at line 148 of file SocketCommunication.hpp.