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