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