Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_CACHED_SOLUTION_VECTOR_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_GET_CACHED_SOLUTION_VECTOR_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace mbd
00015 {
00032 template<typename group_type,typename vector_type>
00033 void get_cached_solution_vector(
00034 group_type const & group
00035 , size_t const & m
00036 , vector_type & x
00037 )
00038 {
00039 typedef typename group_type::math_policy math_policy;
00040 typedef typename math_policy::vector_range vector_range;
00041 typedef typename group_type::const_indirect_constraint_iterator const_indirect_constraint_iterator;
00042 typedef typename group_type::const_indirect_contact_iterator const_indirect_contact_iterator;
00043 typedef typename vector_type::size_type size_type;
00044
00045 math_policy::resize( x, m);
00046
00047 for(const_indirect_constraint_iterator constraint = group.constraint_begin();constraint!=group.constraint_end();++constraint)
00048 {
00049 if(constraint->is_active())
00050 {
00051 size_type const start = constraint->get_jacobian_index();
00052 size_type const end = start + constraint->get_number_of_jacobian_rows();
00053 vector_range tmp_vector_range = math_policy::subrange(x,start,end);
00054 constraint->get_solution( tmp_vector_range );
00055 }
00056 }
00057 for(const_indirect_contact_iterator contact = group.contact_begin();contact!=group.contact_end();++contact)
00058 {
00059 if(contact->is_active())
00060 {
00061 size_type const start = contact->get_jacobian_index();
00062 size_type const end = start + contact->get_number_of_jacobian_rows();
00063 vector_range tmp_vector_range = math_policy::subrange(x,start,end);
00064 contact->get_solution( tmp_vector_range );
00065 }
00066 }
00067 }
00068
00069
00070 }
00071 }
00072
00073 #endif