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