42 #ifndef TEUCHOS_SERIAL_COMM_HPP
43 #define TEUCHOS_SERIAL_COMM_HPP
57 template<
class OrdinalType>
75 template<
typename Ordinal>
107 const int rootRank,
const Ordinal bytes,
char buffer[]
111 gather (
const Ordinal sendBytes,
const char sendBuffer[],
112 const Ordinal recvBytes,
char recvBuffer[],
113 const int root)
const;
116 const Ordinal sendBytes,
const char sendBuffer[]
117 ,
const Ordinal recvBytes,
char recvBuffer[]
122 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
127 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
131 const Ordinal bytes,
const char sendBuffer[],
const int destRank
135 send (
const Ordinal bytes,
136 const char sendBuffer[],
138 const int tag)
const;
141 const Ordinal bytes,
const char sendBuffer[],
const int destRank
145 ssend (
const Ordinal bytes,
146 const char sendBuffer[],
148 const int tag)
const;
151 const int sourceRank,
const Ordinal bytes,
char recvBuffer[]
161 const char sendBuffer[],
163 const int tag)
const;
173 const int tag)
const;
182 const int sourceRank,
183 const int tag)
const;
220 template<
typename Ordinal>
234 template<
typename Ordinal>
238 template<
typename Ordinal>
246 template<
typename Ordinal>
253 template<
typename Ordinal>
260 template<
typename Ordinal>
267 template<
typename Ordinal>
269 const int ,
const Ordinal ,
char []
276 template<
typename Ordinal>
278 const Ordinal sendBytes,
const char sendBuffer[]
279 ,
const Ordinal recvBytes,
char recvBuffer[]
289 std::copy(sendBuffer,sendBuffer+sendBytes,recvBuffer);
293 template<
typename Ordinal>
296 const char sendBuffer[],
297 const Ordinal recvBytes,
299 const int root)
const
309 std::copy (sendBuffer, sendBuffer + sendBytes, recvBuffer);
313 template<
typename Ordinal>
316 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
320 std::copy(sendBuffer,sendBuffer+bytes,globalReducts);
324 template<
typename Ordinal>
327 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
331 std::copy(sendBuffer,sendBuffer+bytes,scanReducts);
335 template<
typename Ordinal>
337 const Ordinal ,
const char [],
const int
341 true, std::logic_error
342 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
343 " only have one process!"
347 template<
typename Ordinal>
355 true, std::logic_error
356 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
357 " only have one process!"
361 template<
typename Ordinal>
363 const Ordinal ,
const char [],
const int
367 true, std::logic_error
368 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
369 " only have one process!"
373 template<
typename Ordinal>
381 true, std::logic_error
382 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
383 " only have one process!"
387 template<
typename Ordinal>
389 const int ,
const Ordinal ,
char []
393 true, std::logic_error
394 ,
"SerialComm<Ordinal>::receive(...): Error, you can not call receive(...) when you"
395 " only have one process!"
400 template<
typename Ordinal>
407 true, std::logic_error
408 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
409 " only have one process!"
413 template<
typename Ordinal>
416 const char sendBuffer[],
426 true, std::logic_error
427 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
428 " only have one process!"
432 template<
typename Ordinal>
438 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
442 template<
typename Ordinal>
449 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
453 template<
typename Ordinal>
459 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
463 template<
typename Ordinal>
470 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
474 template<
typename Ordinal>
482 template<
typename Ordinal>
489 std::invalid_argument,
"Teuchos::SerialComm::waitAll: There are not enough "
490 "entries in the statuses array to hold all the results of the communication"
491 " requests. requests.size() = " << requests.size() <<
" > statuses.size() "
492 "= " << statuses.size() <<
".");
495 it != requests.end(); ++it) {
500 template<
typename Ordinal>
506 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
515 template<
typename Ordinal>
522 template<
typename Ordinal>
533 template<
typename Ordinal>
537 if ((ranks.
size()) == 1 && (ranks[0] == 0)) {
547 template<
typename Ordinal>
550 std::ostringstream oss;
559 #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