Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Teuchos_Comm.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 //
00004 //                    Teuchos: Common Tools Package
00005 //                 Copyright (2004) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef TEUCHOS_COMM_HPP
00030 #define TEUCHOS_COMM_HPP
00031 
00032 #include "Teuchos_ReductionOp.hpp"
00033 #include "Teuchos_ArrayRCP.hpp"
00034 
00035 namespace Teuchos {
00036 
00037 
00039 class CommRequest : public Teuchos::Describable {};
00040 
00041 
00058 template<typename Ordinal>
00059 class Comm : virtual public Describable {
00060 public:
00061   
00063 
00064 
00071   virtual int getRank() const = 0;
00072 
00079   virtual int getSize() const = 0;
00080   
00082 
00084 
00085 
00089   virtual void barrier() const = 0;
00090   
00105   virtual void broadcast(
00106     const int rootRank, const Ordinal bytes, char buffer[]
00107     ) const = 0;
00108 
00131   virtual void gatherAll(
00132     const Ordinal sendBytes, const char sendBuffer[]
00133     ,const Ordinal recvBytes, char recvBuffer[]
00134     ) const = 0;
00135 
00149   virtual void reduceAll(
00150     const ValueTypeReductionOp<Ordinal,char> &reductOp
00151     ,const Ordinal bytes, const char sendBuffer[], char globalReducts[]
00152     ) const = 0;
00153 
00177   virtual void reduceAllAndScatter(
00178     const ValueTypeReductionOp<Ordinal,char> &reductOp
00179     ,const Ordinal sendBytes, const char sendBuffer[]
00180     ,const Ordinal recvCounts[], char myGlobalReducts[]
00181     ) const = 0;
00182 
00196   virtual void scan(
00197     const ValueTypeReductionOp<Ordinal,char> &reductOp
00198     ,const Ordinal bytes, const char sendBuffer[], char scanReducts[]
00199     ) const = 0;
00200 
00202 
00203 
00220   virtual void send(
00221     const Ordinal bytes, const char sendBuffer[], const int destRank
00222     ) const = 0;
00223 
00244   virtual int receive(
00245     const int sourceRank, const Ordinal bytes, char recvBuffer[]
00246     ) const = 0;
00247 
00248 
00260   virtual void readySend(
00261     const ArrayView<const char> &sendBuffer,
00262     const int destRank
00263     ) const = 0;
00264   
00265 
00267 
00268 
00270 
00271 
00272 
00284   virtual RCP<CommRequest> isend(
00285     const ArrayView<const char> &sendBuffer,
00286     const int destRank
00287     ) const = 0;
00288 
00289 
00304   virtual RCP<CommRequest> ireceive(
00305     const ArrayView<char> &recvBuffer,
00306     const int sourceRank
00307     ) const = 0;
00308 
00309 
00320   virtual void waitAll(
00321     const ArrayView<RCP<CommRequest> > &requests
00322     ) const = 0;
00323 
00324 
00335   virtual void wait(
00336     const Ptr<RCP<CommRequest> > &request
00337     ) const = 0;
00338 
00339 
00341   
00342 }; // class Comm
00343 
00344 } // namespace Teuchos
00345 
00346 #endif // TEUCHOS_COMM_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines