src/Particle/ParticleLayoutFromGrid.h

Go to the documentation of this file.
00001 //
00002 // C++ Interface: ParticleLayoutFromGrid
00003 //
00004 // Description: 
00005 //
00006 //
00007 // Author: Roman Geus <geus@maxwell>, (C) 2005
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 #ifndef ParticleLayoutFromGrid_H
00013 #define ParticleLayoutFromGrid_H
00014 
00015 #include "Ippl.h"
00016 #include "extpde.h"
00017 
00018 class ParticleLayoutFromGrid : public ParticleLayout<double,3> {
00019 public:
00020     typedef int pair_t;
00021     typedef pair_t* pair_iterator;
00022     typedef ParticleAttrib<SingleParticlePos_t> ParticlePos_t;
00023     typedef ParticleAttrib<Index_t>             ParticleIndex_t;
00024     typedef Vektor<double,3>                    Vector_t;
00032     ParticleLayoutFromGrid(Grid* grid, Domain* domain, D3vector& local_min, D3vector& local_max) :
00033         grid_(grid),
00034         geom_domain_(domain),
00035         my_corner_min_(local_min),
00036         my_corner_max_(local_max)
00037     {}    
00049     void update(ParticleBase< ParticleLayoutFromGrid >& particles);    
00055     inline bool is_local_pos(const Vector_t& x) const {
00056       const D3vector y(x[0],x[1],x[2]);      
00057       return is_inside_box(my_corner_min_, my_corner_max_, y);
00058     }    
00064     inline bool is_local_pos(const D3vector& x) const {
00065       return is_inside_box(my_corner_min_, my_corner_max_, x);
00066     }    
00067 
00073     bool is_in_domain(const D3vector& x) const {
00074         return geom_domain_->point_in_domain(x);
00075     }
00081     bool is_in_domain(const Vector_t& x) const {
00082       const D3vector y(x[0],x[1],x[2]);
00083       return geom_domain_->point_in_domain(y);
00084     }
00085 
00093     inline static bool is_inside_box(const D3vector& corner_min, const D3vector& corner_max, const D3vector& x) {
00094         return corner_min[0] <= x[0] && x[0] < corner_max[0] &&
00095                corner_min[1] <= x[1] && x[1] < corner_max[1] &&
00096                corner_min[2] <= x[2] && x[2] < corner_max[2];
00097     }
00098    
00099 private:
00104     void apply_bconds(ParticlePos_t& R);
00112     size_t redistribute_particles(ParticleBase< ParticleLayoutFromGrid >& particles);
00116     Grid* grid_;
00120     Domain* geom_domain_;
00124     D3vector my_corner_min_;
00128     D3vector my_corner_max_;
00129 };
00130 
00131 #endif

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