Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MATH_COMPUTE_F_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MATH_COMPUTE_F_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/math_is_number.h>
00013
00014 #include <OpenTissue/dynamics/mbd/math/mbd_math_update_f.h>
00015
00016 #include <cassert>
00017
00018 namespace OpenTissue
00019 {
00020 namespace mbd
00021 {
00022 namespace math
00023 {
00024
00046 template<typename matrix_type, typename vector_type>
00047 void compute_f(matrix_type const & WJT,vector_type const & x,vector_type & f)
00048 {
00049 typedef typename matrix_type::size_type size_type;
00050
00051 assert( WJT.size1() >0 || !"compute_f(): WJT was empty?");
00052 assert( WJT.size2() >0 || !"compute_f(): WJT was empty?");
00053 assert( WJT.size1() == x.size() || !"compute_f(): Incorrect dimensions");
00054
00055 f.resize( WJT.size2(), false );
00056 f.clear();
00057
00058 for (size_type i = 0;i < x.size() ; ++i)
00059 update_f(WJT,i,x(i),f);
00060 }
00061
00062
00063 }
00064 }
00065 }
00066
00067 #endif