10 #ifndef TEUCHOS_SERIAL_COMM_HPP
11 #define TEUCHOS_SERIAL_COMM_HPP
25 template<
class OrdinalType>
43 template<
typename Ordinal>
75 const int rootRank,
const Ordinal bytes,
char buffer[]
79 gather (
const Ordinal sendBytes,
const char sendBuffer[],
80 const Ordinal recvBytes,
char recvBuffer[],
81 const int root)
const;
84 const Ordinal sendBytes,
const char sendBuffer[]
85 ,
const Ordinal recvBytes,
char recvBuffer[]
90 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
95 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
99 const Ordinal bytes,
const char sendBuffer[],
const int destRank
103 send (
const Ordinal bytes,
104 const char sendBuffer[],
106 const int tag)
const;
109 const Ordinal bytes,
const char sendBuffer[],
const int destRank
113 ssend (
const Ordinal bytes,
114 const char sendBuffer[],
116 const int tag)
const;
119 const int sourceRank,
const Ordinal bytes,
char recvBuffer[]
129 const char sendBuffer[],
131 const int tag)
const;
141 const int tag)
const;
150 const int sourceRank,
151 const int tag)
const;
188 template<
typename Ordinal>
202 template<
typename Ordinal>
206 template<
typename Ordinal>
214 template<
typename Ordinal>
221 template<
typename Ordinal>
228 template<
typename Ordinal>
235 template<
typename Ordinal>
237 const int ,
const Ordinal ,
char []
244 template<
typename Ordinal>
246 const Ordinal sendBytes,
const char sendBuffer[]
247 ,
const Ordinal recvBytes,
char recvBuffer[]
257 std::copy(sendBuffer,sendBuffer+sendBytes,recvBuffer);
261 template<
typename Ordinal>
264 const char sendBuffer[],
265 const Ordinal recvBytes,
267 const int root)
const
277 std::copy (sendBuffer, sendBuffer + sendBytes, recvBuffer);
281 template<
typename Ordinal>
284 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
288 std::copy(sendBuffer,sendBuffer+bytes,globalReducts);
292 template<
typename Ordinal>
295 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
299 std::copy(sendBuffer,sendBuffer+bytes,scanReducts);
303 template<
typename Ordinal>
305 const Ordinal ,
const char [],
const int
309 true, std::logic_error
310 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
311 " only have one process!"
315 template<
typename Ordinal>
323 true, std::logic_error
324 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
325 " only have one process!"
329 template<
typename Ordinal>
331 const Ordinal ,
const char [],
const int
335 true, std::logic_error
336 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
337 " only have one process!"
341 template<
typename Ordinal>
349 true, std::logic_error
350 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
351 " only have one process!"
355 template<
typename Ordinal>
357 const int ,
const Ordinal ,
char []
361 true, std::logic_error
362 ,
"SerialComm<Ordinal>::receive(...): Error, you can not call receive(...) when you"
363 " only have one process!"
368 template<
typename Ordinal>
375 true, std::logic_error
376 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
377 " only have one process!"
381 template<
typename Ordinal>
384 const char sendBuffer[],
394 true, std::logic_error
395 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
396 " only have one process!"
400 template<
typename Ordinal>
406 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
410 template<
typename Ordinal>
417 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
421 template<
typename Ordinal>
427 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
431 template<
typename Ordinal>
438 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
442 template<
typename Ordinal>
450 template<
typename Ordinal>
457 std::invalid_argument,
"Teuchos::SerialComm::waitAll: There are not enough "
458 "entries in the statuses array to hold all the results of the communication"
459 " requests. requests.size() = " << requests.size() <<
" > statuses.size() "
460 "= " << statuses.size() <<
".");
463 it != requests.end(); ++it) {
468 template<
typename Ordinal>
474 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
483 template<
typename Ordinal>
490 template<
typename Ordinal>
501 template<
typename Ordinal>
505 if ((ranks.
size()) == 1 && (ranks[0] == 0)) {
515 template<
typename Ordinal>
518 std::ostringstream oss;
527 #endif // TEUCHOS_SERIAL_COMM_HPP
virtual RCP< CommStatus< Ordinal > > wait(const Ptr< RCP< CommRequest< Ordinal > > > &request) const
virtual void barrier() const
int getTag() const
The current tag.
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &Buffer, const int sourceRank) const
virtual int receive(const int sourceRank, const Ordinal bytes, char recvBuffer[]) const
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
size_type size() const
The total number of items in the managed array.
Concrete serial communicator subclass.
virtual void broadcast(const int rootRank, const Ordinal bytes, char buffer[]) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests) const
Encapsulation of the result of a receive (blocking or nonblocking).
virtual void scan(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char scanReducts[]) const
std::string description() const
Implementation of CommStatus for a serial communicator.
OrdinalType getTag()
The tag of the received message.
virtual RCP< Comm< Ordinal > > createSubcommunicator(const ArrayView< const int > &ranks) const
Abstract interface for distributed-memory communication.
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const
Defines basic traits for the ordinal field type.
virtual RCP< Comm< Ordinal > > split(const int color, const int key) const
virtual void gather(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[], const int root) const
Gather values from all processes to the root process.
OrdinalType getSourceRank()
The source rank that sent the message (must be zero).
static std::string name()
Returns name of this ordinal type.
virtual void reduceAll(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char globalReducts[]) const
Smart reference counting pointer class for automatic garbage collection.
virtual void gatherAll(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[]) const
Encapsulation of a pending nonblocking communication operation.
SerialCommStatus()
Default constructor.
virtual RCP< Comm< Ordinal > > duplicate() const
virtual int getRank() const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank) const
RCP< SerialComm< Ordinal > > createSerialComm()
Nonmember constructor.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call...
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank) const
virtual int getSize() const