src/Particle/ParticleUniformLayout.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef PARTICLE_UNIFORM_LAYOUT_H
00012 #define PARTICLE_UNIFORM_LAYOUT_H
00013 
00014 /*
00015  * ParticleUniformLayout - particle layout based on uniform distribution.
00016  *
00017  * This is a specialized version of ParticleLayout, which places particles
00018  * on processors simply based on their global index.  The total number
00019  * of atoms on each processor is kept as uniform as possible, with no
00020  * regard as to the relative location of each atom.
00021  */
00022 
00023 // include files
00024 #include "Particle/ParticleLayout.h"
00025 #include "Particle/ParticleBase.h"
00026 
00027 #ifdef IPPL_USE_STANDARD_HEADERS
00028 #include <iostream>
00029 using namespace std;
00030 #else
00031 #include <iostream.h>
00032 #endif
00033 
00034 // forward declarations
00035 class Inform;
00036 template<class T, unsigned Dim> class ParticleUniformLayout;
00037 template<class T, unsigned Dim>
00038 ostream& operator<<(ostream&, const ParticleUniformLayout<T,Dim>&);
00039 
00040 
00041 // ParticleUniformLayout class definition.  Template parameters are the type
00042 // and dimension of the ParticlePos object used for the particles.
00043 template<class T, unsigned Dim>
00044 class ParticleUniformLayout : public ParticleLayout<T, Dim> {
00045 
00046 public:
00047   // pair iterator definition ... this layout does not allow for pairlists
00048   typedef int pair_t;
00049   typedef pair_t* pair_iterator;
00050 
00051   typedef typename ParticleLayout<T, Dim>::SingleParticlePos_t
00052     SingleParticlePos_t;
00053   typedef typename ParticleLayout<T, Dim>::Index_t Index_t;
00054 
00055   // type of attributes this layout should use for position and ID
00056   typedef ParticleAttrib<SingleParticlePos_t> ParticlePos_t;
00057   typedef ParticleAttrib<Index_t>             ParticleIndex_t;
00058 
00059 public:
00060   // constructor and destructor
00061   ParticleUniformLayout();
00062   ~ParticleUniformLayout();
00063 
00064   //
00065   // Particle swapping/update routines
00066   //
00067 
00068   // Update the location and indices of all atoms in the given ParticleBase
00069   // object.  This handles swapping particles among processors if
00070   // needed, and handles create and destroy requests.  When complete,
00071   // all nodes have correct layout information.
00072   void update(ParticleBase< ParticleUniformLayout<T,Dim> >& p,
00073               const ParticleAttrib<char>* canSwap = 0);
00074 
00075   //
00076   // I/O
00077   //
00078 
00079   // Print out information for debugging purposes.
00080   void printDebug(Inform&);
00081 
00082 private:
00083   // Particle redistribution data for each node; used in update
00084   int *LocalSize;
00085   int *Change;
00086   int *MsgCount;
00087 };
00088 
00089 #include "Particle/ParticleUniformLayout.cpp"
00090 
00091 #endif // PARTICLE_UNIFORM_LAYOUT_H
00092 
00093 /***************************************************************************
00094  * $RCSfile: ParticleUniformLayout.h,v $   $Author: adelmann $
00095  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:29 $
00096  * IPPL_VERSION_ID: $Id: ParticleUniformLayout.h,v 1.1.1.1 2003/01/23 07:40:29 adelmann Exp $ 
00097  ***************************************************************************/

Generated on Mon Jan 16 13:23:53 2006 for IPPL by  doxygen 1.4.6