Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

SPMD.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 //
00029 // These are the inevitable functions that people
00030 // can't avoid using when writing a SPMD program.
00031 // It is a minimal set from which more elaborate
00032 // functionality can be generated.  As always, a
00033 // user is free to utilize the entire MPI programming
00034 // on their own platform.  The functions are 
00035 // assured to work on all machines supported.
00036 //
00037 
00038 #ifndef SPMD_H
00039 #define SPMD_H
00040 
00041 #include "REAL.H"
00042 #include "Vector.H"
00043 #include "Box.H"
00044 #include "MayDay.H"
00045 #include "RealVect.H"
00046 class IntVectSet;
00047 
00048 
00050 
00054 int procID();
00055 
00057 
00060 unsigned int numProc();
00061 
00062 
00063 template <class T>
00064 int linearSize(const T& inputT); 
00065 
00066 template <class T>
00067 void linearIn(T& a_outputT, const void* const inBuf); 
00068 
00069 template <class T>
00070 void linearOut(void* const a_outBuf, const T& inputT); 
00071 
00072 #ifdef MPI
00073 
00074 
00088 template <class T>
00089 void gather(Vector<T>& a_outVec, const T& a_input, int a_dest);
00090 
00091 // this has to be here so that linearSize<IntVectSet>, linearIn<IntVectSet>, 
00092 //  and linearOut<IntVectSet> are defined.
00093 // template < >
00094 // void gather(Vector<IntVectSet>& a_outVec, 
00095 //             const IntVectSet& a_input, 
00096 //             int a_dest);
00097 #endif
00098 
00100 
00109 template <class T>
00110 void broadcast(T& a_inAndOut,  int a_src);
00111 
00112 //integer specialization of linearSize
00113 template < >
00114 int linearSize(const int& a_input); 
00115 
00116 //integer specialization of linearIn
00117 template < >
00118 void linearIn(int& a_outputT, const void* const inBuf); 
00119 
00120 //integer specialization of linearOut
00121 template < >
00122 void linearOut(void* const a_outBuf, const int& a_inputT); 
00123 
00124 //Real specialization of linearSize
00125 template < >
00126 int linearSize(const Real& a_input); 
00127 
00128 //Real specialization of linearIn
00129 template < >
00130 void linearIn(Real& a_outputT, const void* const a_inBuf); 
00131 
00132 //Real specialization of linearOut
00133 template < >
00134 void linearOut(void* const a_outBuf, const Real& a_inputT); 
00135 
00136 //Box specialization of linearSize
00137 template < >
00138 int linearSize(const Box& a_input); 
00139 
00140 //Box specialization of linearIn
00141 template < >
00142 void linearIn(Box& a_outputT, const void* const a_inBuf); 
00143 
00144 //Box specialization of linearOut
00145 template < >
00146 void linearOut(void* const a_outBuf, const Box& a_inputT); 
00147 
00148 //Vector<int>  specialization
00149 template < > 
00150 int linearSize(const Vector<int>& a_input); 
00151 template < > 
00152 void linearIn(Vector<int>& a_outputT, const void* const inBuf); 
00153 template < > 
00154 void linearOut(void* const a_outBuf, const Vector<int>& a_inputT); 
00155 
00156 
00157 //Vector<Real>  specialization
00158 template < > 
00159 int linearSize(const Vector<Real>& a_input); 
00160 template < > 
00161 void linearIn(Vector<Real>& a_outputT, const void* const inBuf); 
00162 template < > 
00163 void linearOut(void* const a_outBuf, const Vector<Real>& a_inputT); 
00164 
00165 //Vector<Box>  specialization
00166 template < > 
00167 int linearSize(const Vector<Box>& a_input); 
00168 template < > 
00169 void linearIn(Vector<Box>& a_outputT, const void* const inBuf); 
00170 template < > 
00171 void linearOut(void* const a_outBuf, const Vector<Box>& a_inputT); 
00172 
00173 //Vector<Vector<Box> > specialization
00174 template < > 
00175 int linearSize(const Vector<Vector<Box> >& a_input); 
00176 template < > 
00177 void linearIn(Vector<Vector<Box> >& a_outputT, const void* const inBuf); 
00178 template < > 
00179 void linearOut(void* const a_outBuf, const Vector<Vector<Box> >& a_inputT); 
00180 
00181 // RealVect spcializations of linearization
00182 template < >
00183 int linearSize(const RealVect& vindex);
00184 
00185 //VolIndex specialization of linearIn
00186 template < >
00187 void linearIn(RealVect& a_outputT, const void* const inBuf);
00188 
00189 //VolIndex specialization of linearOut
00190 template < >
00191 void linearOut(void* const a_outBuf, const RealVect& a_inputT);
00192 
00193 
00194 //Vector<Vector<int> > specialization
00195 template < > 
00196 int linearSize(const Vector<Vector<int> >& a_input);
00197 template < > 
00198 void linearIn(Vector<Vector<int> >& a_outputT, const void* const inBuf); 
00199 template < > 
00200 void linearOut(void* const a_outBuf, const Vector<Vector<int> >& a_inputT); 
00201 
00202 
00203 
00204 //Vector<T> specialization of linearSize
00205 template <class T>
00206 int linearListSize(const Vector<T>& a_input); 
00207 
00208 //Vector<T> specialization of linearIn
00209 template <class T>
00210 void linearListIn(Vector<T>& a_outputT, const void* const a_inBuf); 
00211 
00212 //Vector<T> specialization of linearOut
00213 template <class T>
00214 void linearListOut(void* const a_outBuf, const Vector<T>& a_inputT); 
00215 
00216 class SerialTask
00217 {
00218 public:
00219     enum task { compute=0 };
00220 };
00221 
00222 // return id of unique processor for special serial tasks
00223 int
00224 uniqueProc(const SerialTask::task& a_task);
00225 
00226 #ifdef MPI
00227 #include <mpi.h>
00228 struct Chombo_MPI{ static MPI_Comm comm;};
00229 void setChomboMPIErrorHandler();
00230 
00231 #else
00232 // this can be changed for debugging parallel code in serial
00233 extern int num_procs ;
00234 #endif
00235 
00236 #include "SPMDI.H"
00237 
00238 #endif // SPMD.H
00239 

Generated on Wed Jun 2 13:53:35 2004 for Chombo&INSwithParticles by doxygen 1.3.2