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 sendBytes,
const char sendBuffer[]
128 ,
const Ordinal recvCounts[],
char myGlobalReducts[]
133 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
137 const Ordinal bytes,
const char sendBuffer[],
const int destRank
141 send (
const Ordinal bytes,
142 const char sendBuffer[],
144 const int tag)
const;
147 const Ordinal bytes,
const char sendBuffer[],
const int destRank
151 ssend (
const Ordinal bytes,
152 const char sendBuffer[],
154 const int tag)
const;
157 const int sourceRank,
const Ordinal bytes,
char recvBuffer[]
167 const char sendBuffer[],
169 const int tag)
const;
179 const int tag)
const;
188 const int sourceRank,
189 const int tag)
const;
226 template<
typename Ordinal>
240 template<
typename Ordinal>
244 template<
typename Ordinal>
252 template<
typename Ordinal>
259 template<
typename Ordinal>
266 template<
typename Ordinal>
273 template<
typename Ordinal>
275 const int ,
const Ordinal ,
char []
282 template<
typename Ordinal>
284 const Ordinal sendBytes,
const char sendBuffer[]
285 ,
const Ordinal recvBytes,
char recvBuffer[]
295 std::copy(sendBuffer,sendBuffer+sendBytes,recvBuffer);
299 template<
typename Ordinal>
302 const char sendBuffer[],
303 const Ordinal recvBytes,
305 const int root)
const
315 std::copy (sendBuffer, sendBuffer + sendBytes, recvBuffer);
319 template<
typename Ordinal>
322 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
326 std::copy(sendBuffer,sendBuffer+bytes,globalReducts);
330 template<
typename Ordinal>
333 ,
const Ordinal sendBytes,
const char sendBuffer[]
334 ,
const Ordinal recvCounts[],
char myGlobalReducts[]
342 (void)myGlobalReducts;
347 std::copy(sendBuffer,sendBuffer+sendBytes,myGlobalReducts);
351 template<
typename Ordinal>
354 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
358 std::copy(sendBuffer,sendBuffer+bytes,scanReducts);
362 template<
typename Ordinal>
364 const Ordinal ,
const char [],
const int
368 true, std::logic_error
369 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
370 " only have one process!"
374 template<
typename Ordinal>
382 true, std::logic_error
383 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
384 " only have one process!"
388 template<
typename Ordinal>
390 const Ordinal ,
const char [],
const int
394 true, std::logic_error
395 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
396 " only have one process!"
400 template<
typename Ordinal>
403 const char sendBuffer[],
408 true, std::logic_error
409 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
410 " only have one process!"
414 template<
typename Ordinal>
416 const int ,
const Ordinal ,
char []
420 true, std::logic_error
421 ,
"SerialComm<Ordinal>::receive(...): Error, you can not call receive(...) when you"
422 " only have one process!"
429 template<
typename Ordinal>
436 true, std::logic_error
437 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
438 " only have one process!"
442 template<
typename Ordinal>
445 const char sendBuffer[],
455 true, std::logic_error
456 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
457 " only have one process!"
461 template<
typename Ordinal>
472 template<
typename Ordinal>
484 template<
typename Ordinal>
495 template<
typename Ordinal>
507 template<
typename Ordinal>
515 template<
typename Ordinal>
522 std::invalid_argument,
"Teuchos::SerialComm::waitAll: There are not enough "
523 "entries in the statuses array to hold all the results of the communication"
524 " requests. requests.size() = " << requests.size() <<
" > statuses.size() "
525 "= " << statuses.size() <<
".");
528 it != requests.end(); ++it) {
533 template<
typename Ordinal>
539 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
548 template<
typename Ordinal>
555 template<
typename Ordinal>
566 template<
typename Ordinal>
570 if ((ranks.
size()) == 1 && (ranks[0] == 0)) {
580 template<
typename Ordinal>
583 std::ostringstream oss;
592 #endif // TEUCHOS_SERIAL_COMM_HPP
bool is_null(const boost::shared_ptr< T > &p)
Returns true if p.get()==NULL.
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
virtual void reduceAllAndScatter(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvCounts[], char myGlobalReducts[]) const
#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