Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_STABILIZATION_VECTOR_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_STABILIZATION_VECTOR_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace mbd
00015 {
00016 namespace detail
00017 {
00055 template<typename group_type,typename vector_type>
00056 void get_stabilization_vector(
00057 group_type const & group
00058 , size_t const & m
00059 , vector_type & b
00060 )
00061 {
00062 typedef typename group_type::math_policy math_policy;
00063 typedef typename group_type::const_indirect_constraint_iterator const_indirect_constraint_iterator;
00064 typedef typename group_type::const_indirect_contact_iterator const_indirect_contact_iterator;
00065 typedef typename vector_type::size_type size_type;
00066 typedef typename math_policy::vector_range vector_range;
00067
00068 math_policy::resize( b, m);
00069
00070 for(const_indirect_constraint_iterator constraint = group.constraint_begin();constraint != group.constraint_end();++constraint)
00071 {
00072 if(constraint->is_active())
00073 {
00074 size_type const start = constraint->get_jacobian_index();
00075 size_type const end = start + constraint->get_number_of_jacobian_rows();
00076 vector_range tmp_vector_range = math_policy::subrange( b,start,end );
00077 constraint->get_stabilization_term( tmp_vector_range );
00078 }
00079 }
00080 for(const_indirect_contact_iterator contact = group.contact_begin();contact != group.contact_end();++contact)
00081 {
00082 if(contact->is_active())
00083 {
00084 size_type const start = contact->get_jacobian_index();
00085 size_type const end = start + contact->get_number_of_jacobian_rows();
00086 vector_range tmp_vector_range = math_policy::subrange( b,start,end );
00087 contact->get_stabilization_term( tmp_vector_range );
00088 }
00089 }
00090 }
00091
00092 }
00093 }
00094 }
00095
00096 #endif