10#ifndef TEUCHOS_SERIAL_COMM_HPP
11#define TEUCHOS_SERIAL_COMM_HPP
13#include "Teuchos_Comm.hpp"
25template<
class OrdinalType>
43template<
typename Ordinal>
79 const int rootRank,
const Ordinal bytes,
char buffer[]
83 gather (
const Ordinal sendBytes,
const char sendBuffer[],
84 const Ordinal recvBytes,
char recvBuffer[],
85 const int root)
const;
88 const Ordinal sendBytes,
const char sendBuffer[]
89 ,
const Ordinal recvBytes,
char recvBuffer[]
94 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
99 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
103 const Ordinal bytes,
const char sendBuffer[],
const int destRank
107 send (
const Ordinal bytes,
108 const char sendBuffer[],
110 const int tag)
const;
113 const Ordinal bytes,
const char sendBuffer[],
const int destRank
118 const char sendBuffer[],
120 const int tag)
const;
123 const int sourceRank,
const Ordinal bytes,
char recvBuffer[]
133 const char sendBuffer[],
135 const int tag)
const;
145 const int tag)
const;
154 const int sourceRank,
155 const int tag)
const;
192template<
typename Ordinal>
206template<
typename Ordinal>
210template<
typename Ordinal>
218template<
typename Ordinal>
225template<
typename Ordinal>
232template<
typename Ordinal>
239template<
typename Ordinal>
241 const int ,
const Ordinal ,
char []
248template<
typename Ordinal>
250 const Ordinal sendBytes,
const char sendBuffer[]
251 ,
const Ordinal recvBytes,
char recvBuffer[]
261 std::copy(sendBuffer,sendBuffer+sendBytes,recvBuffer);
265template<
typename Ordinal>
268 const char sendBuffer[],
269 const Ordinal recvBytes,
271 const int root)
const
281 std::copy (sendBuffer, sendBuffer + sendBytes, recvBuffer);
285template<
typename Ordinal>
288 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
292 std::copy(sendBuffer,sendBuffer+bytes,globalReducts);
296template<
typename Ordinal>
299 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
303 std::copy(sendBuffer,sendBuffer+bytes,scanReducts);
307template<
typename Ordinal>
309 const Ordinal ,
const char [],
const int
313 true, std::logic_error
314 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
315 " only have one process!"
319template<
typename Ordinal>
327 true, std::logic_error
328 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
329 " only have one process!"
333template<
typename Ordinal>
335 const Ordinal ,
const char [],
const int
339 true, std::logic_error
340 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
341 " only have one process!"
345template<
typename Ordinal>
353 true, std::logic_error
354 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
355 " only have one process!"
359template<
typename Ordinal>
361 const int ,
const Ordinal ,
char []
365 true, std::logic_error
366 ,
"SerialComm<Ordinal>::receive(...): Error, you can not call receive(...) when you"
367 " only have one process!"
372template<
typename Ordinal>
379 true, std::logic_error
380 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
381 " only have one process!"
385template<
typename Ordinal>
388 const char sendBuffer[],
398 true, std::logic_error
399 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
400 " only have one process!"
404template<
typename Ordinal>
410 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
414template<
typename Ordinal>
421 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
425template<
typename Ordinal>
431 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
435template<
typename Ordinal>
442 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
446template<
typename Ordinal>
454template<
typename Ordinal>
461 std::invalid_argument,
"Teuchos::SerialComm::waitAll: There are not enough "
462 "entries in the statuses array to hold all the results of the communication"
463 " requests. requests.size() = " << requests.size() <<
" > statuses.size() "
464 "= " << statuses.size() <<
".");
467 it != requests.end(); ++it) {
472template<
typename Ordinal>
478 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
487template<
typename Ordinal>
494template<
typename Ordinal>
505template<
typename Ordinal>
509 if ((ranks.
size()) == 1 && (ranks[0] == 0)) {
519template<
typename Ordinal>
522 std::ostringstream oss;
Defines basic traits for the ordinal field type.
size_type size() const
The total number of items in the managed array.
Abstract interface for distributed-memory communication.
Encapsulation of a pending nonblocking communication operation.
Encapsulation of the result of a receive (blocking or nonblocking).
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
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
int incrementTag()
Increments the tag and then returns it.
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
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.
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.