00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_SIMULATORS_MBD_EXPLICIT_FIXED_STEP_SIMULATOR_H 00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_SIMULATORS_MBD_EXPLICIT_FIXED_STEP_SIMULATOR_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 #include <OpenTissue/dynamics/mbd/interfaces/mbd_simulator_interface.h> 00013 00014 namespace OpenTissue 00015 { 00016 namespace mbd 00017 { 00026 template< typename mbd_types > 00027 class ExplicitFixedStepSimulator 00028 : public SimulatorInterface<mbd_types> 00029 { 00030 protected: 00031 00032 typedef typename mbd_types::math_policy::real_type real_type; 00033 typedef typename mbd_types::group_type group_type; 00034 typedef typename mbd_types::group_ptr_container group_ptr_container; 00035 00036 public: 00037 00038 class node_traits{}; 00039 class edge_traits{}; 00040 class constraint_traits{}; 00041 00042 protected: 00043 00044 group_ptr_container m_groups; 00045 00046 public: 00047 00048 ExplicitFixedStepSimulator(){} 00049 00050 virtual ~ExplicitFixedStepSimulator(){} 00051 00052 public: 00053 00054 void run(real_type const & time_step) 00055 { 00056 mbd::compute_scripted_motions(*(this->get_configuration()->get_all_body_group()),this->time()); 00057 00058 this->get_collision_detection()->run( m_groups ); 00059 00060 for(typename group_ptr_container::iterator tmp=m_groups.begin();tmp!=m_groups.end();++tmp) 00061 { 00062 group_type * group = (*tmp); 00063 00064 this->get_sleepy()->evaluate(group->body_begin(),group->body_end()); 00065 00066 if(!mbd::is_all_bodies_sleepy(*group)) 00067 this->get_stepper()->run(*group,time_step); 00068 } 00069 update_time(time_step); 00070 } 00071 00072 }; 00073 00074 } // namespace mbd 00075 } // namespace OpenTissue 00076 // OPENTISSUE_DYNAMICS_MBD_UTIL_SIMULATORS_MBD_EXPLICIT_FIXED_STEP_SIMULATOR_H 00077 #endif