Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_EDM_FORCES_EDM_GRAVITY_H
00002 #define OPENTISSUE_DYNAMICS_EDM_FORCES_EDM_GRAVITY_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012
00013 namespace OpenTissue
00014 {
00015
00016 namespace edm
00017 {
00018
00019 template<typename edm_types>
00020 class Gravity
00021 : public edm_types::force_type
00022 {
00023 public:
00024
00025 typedef typename edm_types::force_type base_type;
00026 typedef typename edm_types::value_traits value_traits;
00027 typedef typename edm_types::vector3_type vector3_type;
00028 typedef typename edm_types::Particle particle_type;
00029
00030 private:
00031
00032 vector3_type m_gravity;
00033
00034 public:
00035
00036 Gravity()
00037 : base_type()
00038 , m_gravity(value_traits::zero())
00039 {}
00040
00041 virtual ~Gravity() {}
00042
00043 void set(vector3_type const & g)
00044 {
00045 m_gravity = g;
00046 }
00047
00048 private:
00049
00050 vector3_type apply(particle_type const & a) const
00051 {
00052 return vector3_type(m_gravity*a.m);
00053 }
00054
00055 };
00056
00057 }
00058
00059 }
00060
00061
00062 #endif