00001 #ifndef OPENTISSUE_DYNAMICS_MESHLESS_DEFORMATION_MESHLESS_DEFORMATION_PARTICLE_H 00002 #define OPENTISSUE_DYNAMICS_MESHLESS_DEFORMATION_MESHLESS_DEFORMATION_PARTICLE_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 namespace OpenTissue 00013 { 00014 namespace meshless_deformation 00015 { 00016 namespace detail 00017 { 00018 00019 template<typename math_types> 00020 class Particle 00021 { 00022 public: 00023 00024 typedef typename math_types::value_traits value_traits; 00025 typedef typename math_types::real_type real_type; 00026 typedef typename math_types::vector3_type vector3_type; 00027 typedef typename math_types::matrix3x3_type matrix3x3_type; 00028 00029 private: 00030 00031 vector3_type * m_x; 00032 00033 public: //should be protected? 00034 00035 vector3_type m_x0; 00036 vector3_type m_v; 00037 00038 vector3_type m_f_ext; 00039 vector3_type m_f_goal; 00040 real_type m_mass; 00041 bool m_fixed; 00042 00043 public: //should be protected? 00044 00045 //--- Shared by all clusters (if not clusters could be computed in parallel!) 00046 00047 vector3_type m_g; 00048 vector3_type m_q[3]; 00049 00050 00051 00052 vector3_type m_p; 00053 00054 public: 00055 00056 Particle() 00057 : m_x(0) 00058 , m_v( value_traits::zero(),value_traits::zero(),value_traits::zero() ) 00059 , m_mass( value_traits::one() ) 00060 , m_fixed(false) 00061 {} 00062 00063 public: 00064 00065 bool & fixed() { return m_fixed; } 00066 00067 real_type & mass() { return m_mass; } 00068 00069 vector3_type & f_ext() { return m_f_ext; } 00070 00071 void bind(vector3_type & x) { m_x = &x; m_x0 = x; } 00072 00073 vector3_type & x(){ return *m_x; } 00074 00075 vector3_type & v(){ return m_v; } 00076 00077 }; 00078 00079 } // namespace detail 00080 } // namespace meshless_deformation 00081 } // namespace OpenTissue 00082 00083 //OPENTISSUE_DYNAMICS_MESHLESS_DEFORMATION_MESHLESS_DEFORMATION_PARTICLE_H 00084 #endif