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