Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_FEM_FEM_SIMULATE_H
00002 #define OPENTISSUE_DYNAMICS_FEM_FEM_SIMULATE_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/dynamics/fem/fem_clear_stiffness_assembly.h>
00013 #include <OpenTissue/dynamics/fem/fem_update_orientation.h>
00014 #include <OpenTissue/dynamics/fem/fem_reset_orientation.h>
00015 #include <OpenTissue/dynamics/fem/fem_stiffness_assembly.h>
00016 #include <OpenTissue/dynamics/fem/fem_add_plasticity_force.h>
00017 #include <OpenTissue/dynamics/fem/fem_dynamics_assembly.h>
00018 #include <OpenTissue/dynamics/fem/fem_conjugate_gradients.h>
00019 #include <OpenTissue/dynamics/fem/fem_position_update.h>
00020
00021 namespace OpenTissue
00022 {
00023 namespace fem
00024 {
00049 template < typename fem_mesh, typename real_type >
00050 inline void simulate(
00051 fem_mesh & mesh
00052 , real_type const & time_step
00053 , bool use_stiffness_warping
00054 )
00055 {
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 detail::clear_stiffness_assembly(mesh.node_begin(),mesh.node_end());
00095 if(use_stiffness_warping)
00096 detail::update_orientation(mesh.tetrahedron_begin(),mesh.tetrahedron_end());
00097 else
00098 detail::reset_orientation(mesh.tetrahedron_begin(),mesh.tetrahedron_end());
00099
00100 detail::stiffness_assembly(mesh.tetrahedron_begin(),mesh.tetrahedron_end());
00101
00102 detail::add_plasticity_force(mesh.tetrahedron_begin(),mesh.tetrahedron_end(),time_step);
00103
00104 real_type mass_damping = 2.0;
00105
00106 detail::dynamics_assembly(mesh,mass_damping,time_step);
00107
00108 unsigned int min_iterations = 20;
00109 unsigned int max_iterations = 20;
00110
00111 detail::conjugate_gradients(mesh, min_iterations, max_iterations);
00112 detail::position_update(mesh,time_step);
00113 }
00114
00115 }
00116 }
00117
00118
00119 #endif