Epetra_MpiDistributor.h

Go to the documentation of this file.
00001 //@HEADER
00002 /*
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 */
00029 //@HEADER
00030 
00031 #ifndef EPETRA_MPIDISTRIBUTOR_H
00032 #define EPETRA_MPIDISTRIBUTOR_H
00033 #include "Epetra_Object.h"
00034 #include "Epetra_Distributor.h"
00035 class Epetra_MpiComm;
00036 #include <mpi.h>
00037 
00039 
00046 class Epetra_MpiDistributor: public Epetra_Object, public virtual Epetra_Distributor {
00047     
00048   public:
00049 
00051 
00052 
00054   Epetra_MpiDistributor(const Epetra_MpiComm & Comm);
00055 
00057   Epetra_MpiDistributor(const Epetra_MpiDistributor & Distributor);
00058 
00060   Epetra_Distributor * Clone(){return(dynamic_cast<Epetra_Distributor *>(new Epetra_MpiDistributor(*this)));};
00061 
00063   virtual ~Epetra_MpiDistributor();
00065 
00066   
00068 
00069 
00070 
00081   int CreateFromSends( const int & NumExportIDs,
00082                        const int * ExportPIDs,
00083            bool Deterministic,
00084                        int & NumRemoteIDs );
00085 
00087 
00104   int CreateFromRecvs( const int & NumRemoteIDs,
00105                        const int * RemoteGIDs,
00106                        const int * RemotePIDs,
00107            bool Deterministic,
00108                        int & NumExportIDs,
00109                        int *& ExportGIDs,
00110                        int *& ExportPIDs);
00112 
00114 
00115 
00117   int Do( char * export_objs,
00118           int obj_size,
00119           int & len_import_objs,
00120           char *& import_objs );
00121 
00123   int DoReverse( char * export_objs,
00124                  int obj_size,
00125                  int & len_import_objs,
00126                  char *& import_objs );
00127 
00129   int DoPosts( char * export_objs,
00130                int obj_size,
00131                int & len_import_objs,
00132                char *& import_objs );
00134   int DoWaits();
00135 
00137   int DoReversePosts( char * export_objs,
00138                       int obj_size,
00139                       int & len_import_objs,
00140                       char *& import_objs );
00141 
00143   int DoReverseWaits();
00145 
00147 
00148 
00150   int Do( char * export_objs,
00151           int obj_size,
00152           int *& sizes,
00153           int & len_import_objs,
00154           char *& import_objs );
00155   
00157   int DoReverse( char * export_objs,
00158                  int obj_size,
00159                  int *& sizes,
00160                  int & len_import_objs,
00161                  char *& import_objs );
00162   
00164   int DoPosts( char * export_objs,
00165                int obj_size,
00166                int *& sizes,
00167                int & len_import_objs,
00168                char *& import_objs);
00169   
00171   int DoReversePosts( char * export_objs,
00172                       int obj_size,
00173                       int *& sizes,
00174                       int & len_import_objs,
00175                       char *& import_objs );
00177   
00179 
00180   void Print(ostream & os) const;
00182   private:
00183 
00184     int ComputeRecvs_( int my_proc,
00185                  int nprocs );
00186 
00187     int ComputeSends_( int num_imports,
00188            const int *& import_ids,
00189            const int *& import_procs,
00190            int & num_exports,
00191            int *& export_ids,
00192            int *& export_procs,
00193            int my_proc );
00194 
00195 
00196     int Resize_(int *sizes);
00197 
00198     int Sort_ints_( int *vals, int *other, int nvals );
00199 
00200   private:
00201     Epetra_MpiDistributor& operator=(const Epetra_MpiDistributor& src);
00202 
00203     int * lengths_to_;
00204     int * procs_to_;
00205     int * indices_to_;
00206     int   size_indices_to_;
00207 
00208     int * lengths_from_;
00209     int * procs_from_;
00210     int * indices_from_;
00211     int   size_indices_from_;
00212 
00213     bool  resized_;
00214     int * sizes_;
00215 
00216     int * sizes_to_;
00217     int * starts_to_;
00218     int * starts_to_ptr_;
00219     int * indices_to_ptr_;
00220 
00221     int * sizes_from_;
00222     int * starts_from_;
00223     int * starts_from_ptr_;
00224     int * indices_from_ptr_;
00225 
00226     int   nrecvs_;
00227     int   nsends_;
00228     int   nexports_;
00229 
00230     int   self_msg_;
00231 
00232     int   max_send_length_;
00233     int   total_recv_length_;
00234 
00235     int   tag_;
00236 
00237     const Epetra_MpiComm * epComm_;
00238     const MPI_Comm      comm_;
00239 
00240     MPI_Request * request_;
00241     MPI_Status  * status_;
00242 
00243     bool no_delete_;
00244 
00245     char * send_array_;
00246     int send_array_size_;
00247 
00248     Epetra_MpiDistributor * comm_plan_reverse_;
00249 
00250 };
00251 #endif /* EPETRA_MPIDISTRIBUTOR_H */

Generated on Thu Sep 18 12:37:58 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1