update and bug corection

This commit is contained in:
Stefan Tröger 2013-06-08 19:19:03 +02:00 committed by Stefan Tröger
parent 3058d86b23
commit 661e3bba8d
6 changed files with 86 additions and 8 deletions

View File

@ -58,6 +58,7 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void)
{
Base::Console().Message("Execute ItemAssembly\n");
try{
//create a solver and init all child assemblys with subsolvers
m_solver = boost::shared_ptr<Solver>(new Solver);
init(boost::shared_ptr<Solver>());
@ -74,6 +75,10 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void)
//solve the system
m_solver->solve();
}
catch(std::exception& e) {
Base::Console().Message("Solver exeption: %s", e.what());
}
this->touch();
return App::DocumentObject::StdReturn;

View File

@ -99,6 +99,7 @@ struct gp_lin_accessor {
break;
case 2:
p.SetZ(value);
break;
case 3:
d.SetX(value);
break;
@ -148,6 +149,7 @@ struct gp_pln_accessor {
break;
case 2:
p.SetZ(value);
break;
case 3:
d.SetX(value);
break;
@ -198,6 +200,7 @@ struct gp_cylinder_accessor {
break;
case 2:
p.SetZ(value);
break;
case 3:
d.SetX(value);
break;
@ -209,6 +212,7 @@ struct gp_cylinder_accessor {
break;
case 6:
t.SetRadius(value);
break;
};
t.SetAxis(gp_Ax1(p,d));
};

View File

@ -439,7 +439,7 @@ void Geometry<Sys, Derived, GeometrieTypeList, Dim>::finishCalculation() {
//recalculate(1.); //remove scaling to get right global value
m_global = m_rotated;
#ifdef USE_LOGGING
BOOST_LOG(log) << "Finish cluster calculation";
BOOST_LOG(log) << "Finish cluster calculation: "<<m_global.transpose();
#endif
}
//TODO:non cluster paramter scaling
@ -447,7 +447,7 @@ void Geometry<Sys, Derived, GeometrieTypeList, Dim>::finishCalculation() {
m_global = m_parameter;
normalize();
#ifdef USE_LOGGING
BOOST_LOG(log) << "Finish calculation";
BOOST_LOG(log) << "Finish calculation: "<<m_global.transpose();
#endif
};
apply_visitor v(m_global);

View File

@ -240,12 +240,12 @@ void ClusterMath<Sys>::transformToMaps(typename ClusterMath<Sys>::Kernel::Transf
template<typename Sys>
void ClusterMath<Sys>::finishCalculation() {
mapsToTransform(m_transform);
init=false;
#ifdef USE_LOGGING
BOOST_LOG(log) << "Finish calculation";
#endif
mapsToTransform(m_transform);
init=false;
m_transform = m_ssrTransform*m_transform;

View File

@ -114,9 +114,78 @@ struct ci_orientation::type< Kernel, tag::plane3D, tag::cylinder3D > : public dc
template< typename Kernel >
struct ci_orientation::type< Kernel, tag::cylinder3D, tag::cylinder3D > : public dcm::Orientation::type< Kernel, tag::cylinder3D, tag::cylinder3D > {};
//we need a custom distance type to use point-distance functions instead of real geometry distance
struct ci_distance : public Equation<ci_distance, double> {
using Equation::operator=;
ci_distance() : Equation(0) {};
template< typename Kernel, typename Tag1, typename Tag2 >
struct type : public PseudoScale<Kernel> {
typedef typename Kernel::number_type Scalar;
typedef typename Kernel::VectorMap Vector;
typedef std::vector<typename Kernel::Vector3, Eigen::aligned_allocator<typename Kernel::Vector3> > Vec;
option_type value;
Scalar calculate(Vector& param1, Vector& param2) {
assert(false);
return 0;
};
Scalar calculateGradientFirst(Vector& param1, Vector& param2, Vector& dparam1) {
assert(false);
return 0;
};
Scalar calculateGradientSecond(Vector& param1, Vector& param2, Vector& dparam2) {
assert(false);
return 0;
};
void calculateGradientFirstComplete(Vector& param1, Vector& param2, Vector& gradient) {
assert(false);
};
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
assert(false);
};
};
};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::point3D, tag::point3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::point3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::point3D, tag::line3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::line3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::point3D, tag::plane3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::plane3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::point3D, tag::cylinder3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::cylinder3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::line3D, tag::line3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::line3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::line3D, tag::plane3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::plane3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::line3D, tag::cylinder3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::cylinder3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::plane3D, tag::plane3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::plane3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::plane3D, tag::cylinder3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::cylinder3D > {};
template< typename Kernel >
struct ci_distance::type< Kernel, tag::cylinder3D, tag::cylinder3D > : public dcm::Distance::type< Kernel, tag::point3D, tag::line3D > {};
}//details
struct Coincidence : public dcm::constraint_sequence< fusion::vector2< Distance, details::ci_orientation > > {
struct Coincidence : public dcm::constraint_sequence< fusion::vector2< details::ci_distance, details::ci_orientation > > {
//allow to set the distance
Coincidence& operator()(Direction val) {
fusion::at_c<1>(*this) = val;
@ -128,7 +197,7 @@ struct Coincidence : public dcm::constraint_sequence< fusion::vector2< Distance,
};
};
struct Alignment : public dcm::constraint_sequence< fusion::vector2< Distance, details::ci_orientation > > {
struct Alignment : public dcm::constraint_sequence< fusion::vector2< details::ci_distance, details::ci_orientation > > {
//allow to set the distance
Alignment& operator()(Direction val) {
fusion::at_c<1>(*this) = val;

View File

@ -275,7 +275,7 @@ void SystemSolver<Sys>::solveCluster(boost::shared_ptr<Cluster> cluster, Sys& sy
if(params <= 0 || constraints <= 0) {
//TODO:throw
#ifdef USE_LOGGING
BOOST_LOG(log)<< "Error in system counting: params = " << params << " and constraints = "<<constraints;
BOOST_LOG(log)<< "Error in system counting: params = " << params << " and constraints = "<<constraints;
#endif
return;
}