10#ifndef TEUCHOS_SERIAL_COMM_HPP
11#define TEUCHOS_SERIAL_COMM_HPP
13#include "Teuchos_Comm.hpp"
25template<
class OrdinalType>
43template<
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
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;
188template<
typename Ordinal>
202template<
typename Ordinal>
206template<
typename Ordinal>
214template<
typename Ordinal>
221template<
typename Ordinal>
228template<
typename Ordinal>
235template<
typename Ordinal>
237 const int ,
const Ordinal ,
char []
244template<
typename Ordinal>
246 const Ordinal sendBytes,
const char sendBuffer[]
247 ,
const Ordinal recvBytes,
char recvBuffer[]
257 std::copy(sendBuffer,sendBuffer+sendBytes,recvBuffer);
261template<
typename Ordinal>
264 const char sendBuffer[],
265 const Ordinal recvBytes,
267 const int root)
const
277 std::copy (sendBuffer, sendBuffer + sendBytes, recvBuffer);
281template<
typename Ordinal>
284 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
288 std::copy(sendBuffer,sendBuffer+bytes,globalReducts);
292template<
typename Ordinal>
295 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
299 std::copy(sendBuffer,sendBuffer+bytes,scanReducts);
303template<
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!"
315template<
typename Ordinal>
323 true, std::logic_error
324 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
325 " only have one process!"
329template<
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!"
341template<
typename Ordinal>
349 true, std::logic_error
350 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
351 " only have one process!"
355template<
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!"
368template<
typename Ordinal>
375 true, std::logic_error
376 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
377 " only have one process!"
381template<
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!"
400template<
typename Ordinal>
406 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
410template<
typename Ordinal>
417 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
421template<
typename Ordinal>
427 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
431template<
typename Ordinal>
438 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
442template<
typename Ordinal>
450template<
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) {
468template<
typename Ordinal>
474 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
483template<
typename Ordinal>
490template<
typename Ordinal>
501template<
typename Ordinal>
505 if ((ranks.
size()) == 1 && (ranks[0] == 0)) {
515template<
typename Ordinal>
518 std::ostringstream oss;
Defines basic traits for the ordinal field type.
size_type size() const
The total number of items in the managed array.
Encapsulation of a pending nonblocking communication operation.
Encapsulation of the result of a receive (blocking or nonblocking).
Abstract interface for distributed-memory communication.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
Implementation of CommStatus for a serial communicator.
OrdinalType getSourceRank()
The source rank that sent the message (must be zero).
OrdinalType getTag()
The tag of the received message.
SerialCommStatus()
Default constructor.
Concrete serial communicator subclass.
virtual void barrier() const
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &Buffer, const int sourceRank) const
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual void broadcast(const int rootRank, const Ordinal bytes, char buffer[]) const
virtual RCP< Comm< Ordinal > > createSubcommunicator(const ArrayView< const int > &ranks) const
virtual void reduceAll(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char globalReducts[]) 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.
virtual int receive(const int sourceRank, const Ordinal bytes, char recvBuffer[]) const
int getTag() const
The current tag.
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual int getSize() const
RCP< SerialComm< Ordinal > > createSerialComm()
Nonmember constructor.
virtual RCP< Comm< Ordinal > > duplicate() const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank, const int tag) const
virtual void scan(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char scanReducts[]) const
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank) const
virtual RCP< CommStatus< Ordinal > > wait(const Ptr< RCP< CommRequest< Ordinal > > > &request) const
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests) const
virtual RCP< Comm< Ordinal > > split(const int color, const int key) const
virtual void gatherAll(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[]) const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank) const
std::string description() const
virtual int getRank() const
Base interface class for user-defined reduction operations for objects that use value semantics.
#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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
static std::string name()
Returns name of this ordinal type.