00001 00002 #ifndef _MC_PARTICLE_ENGINE_HPP_ 00003 #define _MC_PARTICLE_ENGINE_HPP_ 00004 00005 #include <MC_sphere_physic.hpp> 00006 #include <MC_grid_index_spatial_hashing.hpp> 00007 00008 #include <vector> 00009 #include <map> 00010 #include <algorithm> 00011 00012 namespace mesh_conv 00013 { 00014 00016 class MC_particle_engine 00017 { 00018 public: 00019 00020 // ********************************************* // 00021 // ********************************************* // 00022 // CONSTRUCTORS 00023 // ********************************************* // 00024 // ********************************************* // 00025 00027 MC_particle_engine(); 00028 00029 // ********************************************* // 00030 // ********************************************* // 00031 // Particles handler 00032 // ********************************************* // 00033 // ********************************************* // 00034 00036 void add(const MC_sphere_physic& new_particle); 00037 00039 const std::map<unsigned int,MC_sphere_physic>& particle_system() const; 00040 00041 00042 // ********************************************* // 00043 // ********************************************* // 00044 // Spatial grid 00045 // ********************************************* // 00046 // ********************************************* // 00047 00049 MC_grid_index_spatial_hashing& grid_spatial_hash(); 00051 const MC_grid_index_spatial_hashing& grid_spatial_hash() const; 00052 00053 00054 // ********************************************* // 00055 // ********************************************* // 00056 // Evolve in time 00057 // ********************************************* // 00058 // ********************************************* // 00059 00061 void evolve(const bool& is_collision_detection=true,const bool& is_potential=false); 00062 00063 private: 00064 00066 std::map<unsigned int,MC_sphere_physic> particles; 00067 00069 double time_step; 00070 00072 MC_grid_index_spatial_hashing spatial_hash; 00074 MC_grid_index_spatial_hashing spatial_hash_proximity; 00075 00077 static unsigned int id_max; 00078 00080 unsigned int dim_spatial_hash; 00082 unsigned int dim_spatial_hash_proximity; 00083 00084 00085 00086 }; 00087 00088 } 00089 00090 #endif
1.6.1