diff --git a/src/Mod/Assembly/App/opendcm/core/constraint.hpp b/src/Mod/Assembly/App/opendcm/core/constraint.hpp index 5d5cf88b7..c9cc12259 100644 --- a/src/Mod/Assembly/App/opendcm/core/constraint.hpp +++ b/src/Mod/Assembly/App/opendcm/core/constraint.hpp @@ -447,7 +447,7 @@ Constraint::holder::OptionSetter::op typedef typename mpl::find::type iterator; typedef typename mpl::distance::type, iterator>::type distance; BOOST_MPL_ASSERT((mpl::not_::type > >)); - val.m_eq.value = fusion::at(objects).value; + fusion::copy(fusion::at(objects).values, val.m_eq.values); val.pure_rotation = fusion::at(objects).pure_rotation; }; diff --git a/src/Mod/Assembly/App/opendcm/core/equations.hpp b/src/Mod/Assembly/App/opendcm/core/equations.hpp index 0bca86134..2b345f9e2 100644 --- a/src/Mod/Assembly/App/opendcm/core/equations.hpp +++ b/src/Mod/Assembly/App/opendcm/core/equations.hpp @@ -34,6 +34,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -44,12 +48,18 @@ namespace mpl = boost::mpl; namespace dcm { +//the possible directions +enum Direction { parallel, equal, opposite, perpendicular }; + +//the possible solution spaces +enum SolutionSpace {unidirectional, positiv_directional, negative_directional}; + struct no_option {}; template struct Pseudo { typedef std::vector > Vec; - + template void calculatePseudo(const E::MatrixBase& param1, Vec& v1, const E::MatrixBase& param2, Vec& v2) {}; }; @@ -62,7 +72,7 @@ struct Scale { template struct PseudoScale { typedef std::vector > Vec; - + template void calculatePseudo(const E::MatrixBase& param1, Vec& v1, const E::MatrixBase& param2, Vec& v2) {}; void setScale(typename Kernel::number_type scale) {}; @@ -83,8 +93,8 @@ struct constraint_sequence : public seq { typedef typename pushed_seq::type Sequence; typedef typename fusion::result_of::begin::type Begin; - typedef typename fusion::result_of::end::type End; - typedef typename fusion::result_of::prior::type EndOld; + typedef typename fusion::result_of::find::S1>::type >::type EndOld; + //create the new sequence Sequence vec; @@ -97,7 +107,7 @@ struct constraint_sequence : public seq { fusion::copy(*this, range); //insert this object at the end of the sequence - fusion::back(vec) = val; + *fusion::find(vec) = val; //and return our new extendet sequence return vec; @@ -114,27 +124,31 @@ struct constraint_sequence : public seq { typedef typename pushed_seq::type Sequence; typedef typename fusion::result_of::begin::type Begin; - typedef typename fusion::result_of::end::type End; + typedef typename fusion::result_of::find::S1>::type >::type EndF; - typedef typename mpl::distance< typename mpl::begin::type, typename mpl::end::type >::type distanceF; - typedef typename fusion::result_of::advance::type EndF; //create the new sequence Sequence vec; - //copy the given values into the new sequence Begin b(vec); EndF ef(vec); fusion::iterator_range range(b, ef); fusion::copy(val, range); - //copy the objects value into the new sequence - EndF bb(vec); - End e(vec); - fusion::iterator_range range2(bb, e); - fusion::copy(*this, range2); + //to copy the types of the second sequence is not as easy as before. If types were already present in + //the original sequence they are not added again. therefore we need to find all types of the second sequence + //in the new one and assign the objects to this positions. + + //get a index vector for all second-sequence-elements + typedef typename mpl::transform::S2, + fusion::result_of::distance::type, + fusion::result_of::find > >::type position_vector; + + //and copy the types in + fusion::nview view(vec); + fusion::copy(*this, view); //and return our new extendet sequence return vec; @@ -145,45 +159,82 @@ template struct pushed_seq { typedef typename mpl::if_, Seq, fusion::vector1 >::type S1; typedef typename mpl::if_, T, fusion::vector1 >::type S2; - typedef typename fusion::result_of::as_vector >::type >::type vec; + + typedef typename mpl::fold< S2, S1, mpl::if_< boost::is_same< + mpl::find, mpl::end >, mpl::push_back, mpl::_1> >::type unique_vector; + + typedef typename fusion::result_of::as_vector< unique_vector >::type vec; typedef constraint_sequence type; }; template struct Equation : public EQ { - typedef Option option_type; - option_type value; + typedef typename mpl::if_, Option, mpl::vector