Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_FACTORS_VECTOR_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_FACTORS_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 {
00044 template<typename group_type, typename vector_type>
00045 void get_factors_vector(
00046 group_type const & group
00047 , size_t const & m
00048 , vector_type & mu
00049 )
00050 {
00051 typedef typename group_type::math_policy math_policy;
00052 typedef typename group_type::const_indirect_constraint_iterator const_indirect_constraint_iterator;
00053 typedef typename group_type::const_indirect_contact_iterator const_indirect_contact_iterator;
00054 typedef typename vector_type::size_type size_type;
00055 typedef typename math_policy::vector_range vector_range;
00056
00057 math_policy::resize( mu, m);
00058
00059 for(const_indirect_constraint_iterator constraint = group.constraint_begin();constraint!=group.constraint_end();++constraint)
00060 {
00061 if(constraint->is_active())
00062 {
00063 size_type const start = constraint->get_jacobian_index();
00064 size_type const end = start + constraint->get_number_of_jacobian_rows();
00065 vector_range tmp_vector_range = math_policy::subrange(mu,start,end);
00066 constraint->get_dependency_factors( tmp_vector_range );
00067 }
00068 }
00069 for(const_indirect_contact_iterator contact = group.contact_begin();contact!=group.contact_end();++contact)
00070 {
00071 if(contact->is_active())
00072 {
00073 size_type const start = contact->get_jacobian_index();
00074 size_type const end = start + contact->get_number_of_jacobian_rows();
00075 vector_range tmp_vector_range = math_policy::subrange(mu,start,end);
00076 contact->get_dependency_factors( tmp_vector_range );
00077 }
00078 }
00079 }
00080
00081 }
00082 }
00083 }
00084
00085 #endif