Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_SPH_SOLVERS_SPH_BUOYANCY_H
00002 #define OPENTISSUE_DYNAMICS_SPH_SOLVERS_SPH_BUOYANCY_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/dynamics/sph/sph_solver.h>
00013 #include <OpenTissue/dynamics/sph/sph_particle.h>
00014
00015 namespace OpenTissue
00016 {
00017 namespace sph
00018 {
00019
00023 template< typename Types >
00024 class Buoyancy : Solver< Types, typename Types::vector >
00025 {
00026 public:
00027 typedef Solver<Types, typename Types::vector> base_type;
00028 typedef typename base_type::value value;
00029 typedef typename Types::real_type real_type;
00030 typedef typename Types::vector vector;
00031 typedef typename Types::particle particle;
00032 typedef typename Types::particle_cptr_container::const_iterator particle_cptr_container_citerator;
00033
00034 public:
00038 Buoyancy(const real_type& buoyancy, const real_type& rest_density, const vector& gravity) : base_type()
00039 , m_b(buoyancy)
00040 , m_r0(rest_density)
00041 , m_g(gravity)
00042 {
00043 }
00044
00048 ~Buoyancy()
00049 {
00050 }
00051
00055 Buoyancy& operator=(const Buoyancy&)
00056 {
00057 return *this;
00058 }
00059
00060 public:
00066 virtual value apply(const particle& par, particle_cptr_container_citerator, particle_cptr_container_citerator) const
00067 {
00068 return value(m_g*(m_b*(par.density()-m_r0)));
00069 }
00070
00076 value apply(const particle& par, const particle&) const
00077 {
00078 return value(m_g*(m_b*(par.density()-m_r0)));
00079 }
00080
00081 private:
00082 const real_type m_b;
00083 const real_type m_r0;
00084 const vector m_g;
00085
00086 };
00087
00088 }
00089 }
00090
00091
00092 #endif