Epetra_SerialDistributor.cpp

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright (2001) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ************************************************************************
00028 //@HEADER
00029 
00030 #include "Epetra_SerialDistributor.h"
00031 #include "Epetra_SerialComm.h"
00032 
00033 
00034 //==============================================================================
00035 // Epetra_SerialDistributor constructor
00036 Epetra_SerialDistributor::Epetra_SerialDistributor(const Epetra_SerialComm & Comm)
00037   : Epetra_Object("Epetra::SerialDistributor"),
00038     nrecvs_(0),
00039     nsends_(0)
00040 {
00041   (void)Comm;
00042 }
00043 
00044 //==============================================================================
00045 Epetra_SerialDistributor::Epetra_SerialDistributor(const Epetra_SerialDistributor & Plan)
00046   : Epetra_Object("Epetra::SerialDistributor"),
00047     nrecvs_(Plan.nrecvs_),
00048     nsends_(Plan.nsends_)
00049 {
00050 }
00051 
00052 //==============================================================================
00053 // Epetra_SerialDistributor destructor
00054 Epetra_SerialDistributor::~Epetra_SerialDistributor() {
00055 }
00056 
00057 
00058 //==============================================================================
00059 //---------------------------------------------------------------------------
00060 //CreateFromSends Method
00061 // - create communication plan given a known list of procs to send to
00062 //---------------------------------------------------------------------------
00063 int Epetra_SerialDistributor::CreateFromSends( const int & NumExportIDs,
00064                  const int * ExportPIDs,
00065                  bool Deterministic,
00066                  int & NumRemoteIDs )
00067 {
00068   (void)Deterministic;
00069   NumRemoteIDs = 0;
00070 
00071   //In a SerialDistributor, myproc == 0 by definition.
00072   int myproc = 0;
00073 
00074   //basically just do a sanity check.
00075   for(int i=0; i<NumExportIDs; ++i) {
00076     if (ExportPIDs[i] != myproc) {
00077       cerr << "Epetra_SerialDistributor::CreateFromSends: ExportPIDs["<<i
00078           <<"]=="<<ExportPIDs[i]<<", not allowed for serial case."<<endl;
00079       return(-1);
00080     }
00081     ++NumRemoteIDs;
00082   }
00083 
00084   nrecvs_ = NumRemoteIDs;
00085 
00086   return(0);
00087 }
00088 
00089 //==============================================================================
00090 //---------------------------------------------------------------------------
00091 //CreateFromRecvs Method
00092 // - create communication plan given a known list of procs to recv from
00093 //---------------------------------------------------------------------------
00094 int Epetra_SerialDistributor::CreateFromRecvs( const int & NumRemoteIDs,
00095            const int * RemoteGIDs,
00096                  const int * RemotePIDs,
00097            bool Deterministic,
00098                  int & NumExportIDs,
00099            int *& ExportGIDs,
00100            int *& ExportPIDs )
00101 {
00102   (void)NumRemoteIDs;
00103   (void)RemoteGIDs;
00104   (void)RemotePIDs;
00105   (void)Deterministic;
00106   (void)NumExportIDs;
00107   (void)ExportGIDs;
00108   (void)ExportPIDs;
00109   EPETRA_CHK_ERR(-1); // This method should never be called 
00110   return(-1);
00111 }
00112 
00113 //==============================================================================
00114 // GSComm_Comm Do method
00115 int Epetra_SerialDistributor::Do(char * export_objs,
00116                                  int obj_size,
00117                                  int & len_import_objs,
00118                                  char *& import_objs )
00119 {
00120   len_import_objs = obj_size*nrecvs_;
00121   if (len_import_objs > 0) {
00122     import_objs = new char[len_import_objs];
00123   }
00124 
00125   for(int i=0; i<len_import_objs; ++i) import_objs[i] = export_objs[i];
00126 
00127   return(0);
00128 }
00129 
00130 //==============================================================================
00131 // GSComm_Comm DoReverse method
00132 int Epetra_SerialDistributor::DoReverse(char * export_objs,
00133                                         int obj_size,
00134                                         int & len_import_objs,
00135                                         char *& import_objs )
00136 {
00137   (void)export_objs;
00138   (void)obj_size;
00139   (void)len_import_objs;
00140   (void)import_objs;
00141   EPETRA_CHK_ERR(-1); // This method should never be called 
00142   return(-1);
00143 }
00144 //==============================================================================
00145 //---------------------------------------------------------------------------
00146 //Do_Posts Method
00147 //---------------------------------------------------------------------------
00148 int Epetra_SerialDistributor::DoPosts(char * export_objs,
00149                                       int obj_size,
00150                                       int & len_import_objs,
00151                                       char *& import_objs )
00152 {
00153   (void)export_objs;
00154   (void)obj_size;
00155   (void)len_import_objs;
00156   (void)import_objs;
00157   EPETRA_CHK_ERR(-1); // This method should never be called 
00158   return(-1);
00159 }
00160 //==============================================================================
00161 //---------------------------------------------------------------------------
00162 //Do_Waits Method
00163 //---------------------------------------------------------------------------
00164 int Epetra_SerialDistributor::DoWaits()
00165 {
00166   EPETRA_CHK_ERR(-1); // This method should never be called 
00167   return(-1);
00168 }
00169 
00170 //==============================================================================
00171 //---------------------------------------------------------------------------
00172 //DoReverse_Posts Method
00173 //---------------------------------------------------------------------------
00174 int Epetra_SerialDistributor::DoReversePosts(char * export_objs,
00175                                              int obj_size,
00176                                              int & len_import_objs,
00177                                              char *& import_objs )
00178 {
00179   (void)export_objs;
00180   (void)obj_size;
00181   (void)len_import_objs;
00182   (void)import_objs;
00183   EPETRA_CHK_ERR(-1); // This method should never be called 
00184   return(-1);
00185 }
00186 
00187 //==============================================================================
00188 //---------------------------------------------------------------------------
00189 //DoReverse_Waits Method
00190 //---------------------------------------------------------------------------
00191 int Epetra_SerialDistributor::DoReverseWaits()
00192 {
00193   EPETRA_CHK_ERR(-1); // This method should never be called 
00194   return(-1);
00195 }
00196 
00197 //==============================================================================
00198 // GSComm_Comm Do method
00199 int Epetra_SerialDistributor::Do(char * export_objs,
00200                                  int obj_size,
00201                                  int *& sizes,
00202                                  int & len_import_objs,
00203                                  char *& import_objs )
00204 {
00205   (void)export_objs;
00206   (void)obj_size;
00207   (void)sizes;
00208   (void)len_import_objs;
00209   (void)import_objs;
00210   EPETRA_CHK_ERR(-1); // This method should never be called 
00211   return(-1);
00212 }
00213 
00214 //==============================================================================
00215 // GSComm_Comm DoReverse method
00216 int Epetra_SerialDistributor::DoReverse(char * export_objs,
00217                                         int obj_size,
00218                                         int *& sizes,
00219                                         int & len_import_objs,
00220                                         char *& import_objs )
00221 {
00222   (void)export_objs;
00223   (void)obj_size;
00224   (void)sizes;
00225   (void)len_import_objs;
00226   (void)import_objs;
00227   EPETRA_CHK_ERR(-1); // This method should never be called 
00228   return(-1);
00229 }
00230 //==============================================================================
00231 //---------------------------------------------------------------------------
00232 //Do_Posts Method
00233 //---------------------------------------------------------------------------
00234 int Epetra_SerialDistributor::DoPosts(char * export_objs,
00235                                       int obj_size,
00236                                       int *& sizes,
00237                                       int & len_import_objs,
00238                                       char *& import_objs )
00239 {
00240   (void)export_objs;
00241   (void)obj_size;
00242   (void)sizes;
00243   (void)len_import_objs;
00244   (void)import_objs;
00245   EPETRA_CHK_ERR(-1); // This method should never be called 
00246   return(-1);
00247 }
00248 
00249 //==============================================================================
00250 //---------------------------------------------------------------------------
00251 //DoReverse_Posts Method
00252 //---------------------------------------------------------------------------
00253 int Epetra_SerialDistributor::DoReversePosts(char * export_objs,
00254                                              int obj_size,
00255                                              int *& sizes,
00256                                              int & len_import_objs,
00257                                              char *& import_objs )
00258 {
00259   (void)export_objs;
00260   (void)obj_size;
00261   (void)sizes;
00262   (void)len_import_objs;
00263   (void)import_objs;
00264   EPETRA_CHK_ERR(-1); // This method should never be called 
00265   return(-1);
00266 }
00267 
00268 //==============================================================================
00269 void Epetra_SerialDistributor::Print( ostream & os) const
00270 {
00271   os << "Trivial Distributor" << endl;
00272   return;
00273 }

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7