From 7c1c56a550770dc0f0ed45455fac1812c6eab3f2 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 20 Nov 2015 06:35:19 +0100 Subject: [PATCH] Sketcher: Solver Debug functionality: Ability to export a subsystem =================================================================== It allows to export the c++ code to create a subsystem with the same information as the one solved using LM/DL/BGFS. In this commit the functionality is disabled (for production). To enable the functionality uncomment this line in planegcs/Constraints.h: //#define _GCS_EXTRACT_SOLVER_SUBSYSTEM_ When enabled, upon solving with LM/DL/BGFS, the c++ code to generate the subsystem is added to a subsystem.txt that is created in the FreeCAD execution directory. Note that the file is created in append mode, so it will append all normal/redundant solvings until the file is deleted. The resulting code can be directly pasted into a project similar to: https://github.com/abdullahtahiriyo/Eigen_LUPiv_Convergence Such a project only has libeigen as external dependency. --- src/Mod/Sketcher/App/planegcs/Constraints.h | 44 +- src/Mod/Sketcher/App/planegcs/GCS.cpp | 1552 ++++++++++++++++++- src/Mod/Sketcher/App/planegcs/GCS.h | 4 + src/Mod/Sketcher/App/planegcs/SubSystem.cpp | 5 + src/Mod/Sketcher/App/planegcs/SubSystem.h | 2 + 5 files changed, 1605 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/planegcs/Constraints.h b/src/Mod/Sketcher/App/planegcs/Constraints.h index a47aaf988..6f7208ab7 100644 --- a/src/Mod/Sketcher/App/planegcs/Constraints.h +++ b/src/Mod/Sketcher/App/planegcs/Constraints.h @@ -26,6 +26,14 @@ #include "Geo.h" #include "Util.h" +//#define _GCS_EXTRACT_SOLVER_SUBSYSTEM_ // This enables debuging code intended to extract information to file bug reports against Eigen, not for production code + +#ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ +#define _PROTECTED_UNLESS_EXTRACT_MODE_ public +#else +#define _PROTECTED_UNLESS_EXTRACT_MODE_ protected +#endif + namespace GCS { @@ -71,7 +79,7 @@ namespace GCS class Constraint { - protected: + _PROTECTED_UNLESS_EXTRACT_MODE_: VEC_pD origpvec; // is used only as a reference for redirecting and reverting pvec VEC_pD pvec; double scale; @@ -137,6 +145,9 @@ namespace GCS inline double* distance() { return pvec[4]; } public: ConstraintP2PDistance(Point &p1, Point &p2, double *d); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintP2PDistance(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -156,6 +167,9 @@ namespace GCS double da; public: ConstraintP2PAngle(Point &p1, Point &p2, double *a, double da_=0.); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintP2PAngle(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -176,6 +190,9 @@ namespace GCS inline double* distance() { return pvec[6]; } public: ConstraintP2LDistance(Point &p, Line &l, double *d); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintP2LDistance(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -197,6 +214,9 @@ namespace GCS public: ConstraintPointOnLine(Point &p, Line &l); ConstraintPointOnLine(Point &p, Point &lp1, Point &lp2); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintPointOnLine(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -216,6 +236,9 @@ namespace GCS public: ConstraintPointOnPerpBisector(Point &p, Line &l); ConstraintPointOnPerpBisector(Point &p, Point &lp1, Point &lp2); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintPointOnPerpBisector(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -236,6 +259,9 @@ namespace GCS inline double* l2p2y() { return pvec[7]; } public: ConstraintParallel(Line &l1, Line &l2); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintParallel(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -257,6 +283,9 @@ namespace GCS public: ConstraintPerpendicular(Line &l1, Line &l2); ConstraintPerpendicular(Point &l1p1, Point &l1p2, Point &l2p1, Point &l2p2); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintPerpendicular(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -280,6 +309,9 @@ namespace GCS ConstraintL2LAngle(Line &l1, Line &l2, double *a); ConstraintL2LAngle(Point &l1p1, Point &l1p2, Point &l2p1, Point &l2p2, double *a); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintL2LAngle(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -302,6 +334,9 @@ namespace GCS public: ConstraintMidpointOnLine(Line &l1, Line &l2); ConstraintMidpointOnLine(Point &l1p1, Point &l1p2, Point &l2p1, Point &l2p2); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintMidpointOnLine(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -322,6 +357,10 @@ namespace GCS public: ConstraintTangentCircumf(Point &p1, Point &p2, double *rd1, double *rd2, bool internal_=false); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintTangentCircumf(bool internal_){internal=internal_;}; + #endif + inline bool getInternal() {return internal;}; virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); @@ -341,6 +380,9 @@ namespace GCS public: ConstraintPointOnEllipse(Point &p, Ellipse &e); ConstraintPointOnEllipse(Point &p, ArcOfEllipse &a); + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + inline ConstraintPointOnEllipse(){}; + #endif virtual ConstraintType getTypeId(); virtual void rescale(double coef=1.); virtual double error(); diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 4cc104ed7..7a43ef3ca 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -57,7 +57,13 @@ #endif #undef _GCS_DEBUG -#undef _GCS_DEBUG_SOLVER_JACOBIAN_QR_DECOMPOSITION_TRIANGULAR_MATRIX +#undef _GCS_DEBUG_SOLVER_JACOBIAN_QR_DECOMPOSITION_TRIANGULAR_MATRIX + +#ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ // this is to be enabled in Constraints.h when needed. +#include + +#define CASE_NOT_IMP(X) case X: { subsystemfile << "//" #X "not yet implemented" << std::endl; break; } +#endif #include #include @@ -1122,6 +1128,10 @@ int System::solve(SubSystem *subsys, bool isFine, Algorithm alg, bool isRedundan int System::solve_BFGS(SubSystem *subsys, bool isFine, bool isRedundantsolving) { + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + extractSubsystem(subsys, isRedundantsolving); + #endif + int xsize = subsys->pSize(); if (xsize == 0) return Success; @@ -1246,6 +1256,10 @@ int System::solve_BFGS(SubSystem *subsys, bool isFine, bool isRedundantsolving) int System::solve_LM(SubSystem* subsys, bool isRedundantsolving) { + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + extractSubsystem(subsys, isRedundantsolving); + #endif + int xsize = subsys->pSize(); int csize = subsys->cSize(); @@ -1414,6 +1428,10 @@ int System::solve_LM(SubSystem* subsys, bool isRedundantsolving) int System::solve_DL(SubSystem* subsys, bool isRedundantsolving) { + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + extractSubsystem(subsys, isRedundantsolving); + #endif + double tolg=(isRedundantsolving?DL_tolgRedundant:DL_tolg); double tolx=(isRedundantsolving?DL_tolxRedundant:DL_tolx); double tolf=(isRedundantsolving?DL_tolfRedundant:DL_tolf); @@ -1604,6 +1622,1538 @@ int System::solve_DL(SubSystem* subsys, bool isRedundantsolving) return (stop == 1) ? Success : Failed; } +#ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ +void System::extractSubsystem(SubSystem *subsys, bool isRedundantsolving) +{ + VEC_pD plistout; //std::vector + std::vector clist_; + VEC_pD clist_params_; + + subsys->getParamList(plistout); + subsys->getConstraintList(clist_); + + std::ofstream subsystemfile; + subsystemfile.open("subsystemfile.txt", std::ofstream::out | std::ofstream::app); + subsystemfile << std::endl; + subsystemfile << std::endl; + subsystemfile << "Solving: " << (isRedundantsolving?"Redundant":"Normal") << " Subsystem Dump starts here................................" << std::endl; + + int ip=0; + + subsystemfile << "GCS::VEC_pD plist_;" << std::endl; // all SYSTEM params + subsystemfile << "std::vector clist_;" << std::endl; // SUBSYSTEM constraints + subsystemfile << "GCS::VEC_pD plistsub_;" << std::endl; // all SUBSYSTEM params + subsystemfile << "GCS::VEC_pD clist_params_;" << std::endl; // constraint params not within SYSTEM params + + // these are all the parameters, including those not in the subsystem to + // which constraints in the subsystem may make reference. + for( VEC_pD::iterator it = plist.begin(); it != plist.end(); ++it, ++ip) { + subsystemfile << "plist_.push_back(new double("<< *(*it) <<")); // "<< ip <<" address: " << (void *)(*it) << std::endl; + } + + int ips=0; + for( VEC_pD::iterator it = plistout.begin(); it != plistout.end(); ++it, ++ips) { + VEC_pD::iterator p = std::find(plist.begin(), plist.end(),(*it)); + size_t p_index = std::distance(plist.begin(), p); + + if(p_index == plist.size()) { + subsystemfile << "// Error: Subsystem parameter not in system params" << "address: " << (void *)(*it) << std::endl; + } + + subsystemfile << "plistsub_.push_back(plist_[" << p_index <<"]); // "<< ips << std::endl; + } + + int ic=0; // constraint index + int icp=0; // index of constraint params not within SYSTEM params + for( std::vector::iterator it = clist_.begin(); it != clist_.end(); ++it,++ic) { + + switch((*it)->getTypeId()) + { + case Equal: + { // 2 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + subsystemfile << "clist_.push_back(new ConstraintEqual(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) << "]," \ + << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) << "])); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << std::endl; + break; + } + case Difference: + { // 3 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + subsystemfile << "clist_.push_back(new ConstraintDifference(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) << "]," \ + << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) << "]," \ + << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) << "])); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << std::endl; + break; + } + case P2PDistance: + { // 5 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + subsystemfile << "ConstraintP2PDistance * c" << ic <<"=new ConstraintP2PDistance();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << std::endl; + break; + } + case P2PAngle: + { // 5 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + subsystemfile << "ConstraintP2PAngle * c" << ic <<"=new ConstraintP2PAngle();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << std::endl; + break; + } + case P2LDistance: + { // 7 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + subsystemfile << "ConstraintP2LDistance * c" << ic <<"=new ConstraintP2LDistance();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << std::endl; + break; + } + case PointOnLine: + { // 6 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + subsystemfile << "ConstraintPointOnLine * c" << ic <<"=new ConstraintPointOnLine();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << std::endl; + break; + } + case PointOnPerpBisector: + { // 6 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + subsystemfile << "ConstraintPointOnPerpBisector * c" << ic <<"=new ConstraintPointOnPerpBisector();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << std::endl; + break; + } + case Parallel: + { // 8 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + VEC_pD::iterator p8 = std::find(plist.begin(), plist.end(),(*it)->pvec[7]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + size_t i8 = std::distance(plist.begin(), p8); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + bool npb8=false; + VEC_pD::iterator np8 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[7]); + size_t ni8 = std::distance(clist_params_.begin(), np8); + + if(i8 == plist.size()) { + if(ni8 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[7]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[7]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[7] << std::endl; + icp++; + } + npb8=true; + } + + subsystemfile << "ConstraintParallel * c" << ic <<"=new ConstraintParallel();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb8?("clist_params_["):("plist_[")) << (npb8?ni8:i8) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << "," << (*it)->pvec[7] << std::endl; + break; + } + case Perpendicular: + { // 8 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + VEC_pD::iterator p8 = std::find(plist.begin(), plist.end(),(*it)->pvec[7]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + size_t i8 = std::distance(plist.begin(), p8); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + bool npb8=false; + VEC_pD::iterator np8 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[7]); + size_t ni8 = std::distance(clist_params_.begin(), np8); + + if(i8 == plist.size()) { + if(ni8 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[7]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[7]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[7] << std::endl; + icp++; + } + npb8=true; + } + + subsystemfile << "ConstraintPerpendicular * c" << ic <<"=new ConstraintPerpendicular();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb8?("clist_params_["):("plist_[")) << (npb8?ni8:i8) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << "," << (*it)->pvec[7] << std::endl; + break; + } + case L2LAngle: + { // 9 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + VEC_pD::iterator p8 = std::find(plist.begin(), plist.end(),(*it)->pvec[7]); + VEC_pD::iterator p9 = std::find(plist.begin(), plist.end(),(*it)->pvec[8]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + size_t i8 = std::distance(plist.begin(), p8); + size_t i9 = std::distance(plist.begin(), p9); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + bool npb8=false; + VEC_pD::iterator np8 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[7]); + size_t ni8 = std::distance(clist_params_.begin(), np8); + + if(i8 == plist.size()) { + if(ni8 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[7]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[7]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[7] << std::endl; + icp++; + } + npb8=true; + } + + bool npb9=false; + VEC_pD::iterator np9 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[8]); + size_t ni9 = std::distance(clist_params_.begin(), np9); + + if(i9 == plist.size()) { + if(ni9 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[8]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[8]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[8] << std::endl; + icp++; + } + npb9=true; + } + + subsystemfile << "ConstraintL2LAngle * c" << ic <<"=new ConstraintL2LAngle();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb8?("clist_params_["):("plist_[")) << (npb8?ni8:i8) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb9?("clist_params_["):("plist_[")) << (npb9?ni9:i9) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << "," << (*it)->pvec[7] << "," << (*it)->pvec[8] << std::endl; + break; + } + case MidpointOnLine: + { // 8 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + VEC_pD::iterator p8 = std::find(plist.begin(), plist.end(),(*it)->pvec[7]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + size_t i8 = std::distance(plist.begin(), p8); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + bool npb8=false; + VEC_pD::iterator np8 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[7]); + size_t ni8 = std::distance(clist_params_.begin(), np8); + + if(i8 == plist.size()) { + if(ni8 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[7]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[7]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[7] << std::endl; + icp++; + } + npb8=true; + } + + subsystemfile << "ConstraintMidpointOnLine * c" << ic <<"=new ConstraintMidpointOnLine();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb8?("clist_params_["):("plist_[")) << (npb8?ni8:i8) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << "," << (*it)->pvec[7] << std::endl; + break; + } + case TangentCircumf: + { // 6 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + subsystemfile << "ConstraintTangentCircumf * c" << ic <<"=new ConstraintTangentCircumf(" << (static_cast(*it)->getInternal()?"true":"false") <<");" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << std::endl; + break; + } + case PointOnEllipse: + { // 7 + VEC_pD::iterator p1 = std::find(plist.begin(), plist.end(),(*it)->pvec[0]); + VEC_pD::iterator p2 = std::find(plist.begin(), plist.end(),(*it)->pvec[1]); + VEC_pD::iterator p3 = std::find(plist.begin(), plist.end(),(*it)->pvec[2]); + VEC_pD::iterator p4 = std::find(plist.begin(), plist.end(),(*it)->pvec[3]); + VEC_pD::iterator p5 = std::find(plist.begin(), plist.end(),(*it)->pvec[4]); + VEC_pD::iterator p6 = std::find(plist.begin(), plist.end(),(*it)->pvec[5]); + VEC_pD::iterator p7 = std::find(plist.begin(), plist.end(),(*it)->pvec[6]); + size_t i1 = std::distance(plist.begin(), p1); + size_t i2 = std::distance(plist.begin(), p2); + size_t i3 = std::distance(plist.begin(), p3); + size_t i4 = std::distance(plist.begin(), p4); + size_t i5 = std::distance(plist.begin(), p5); + size_t i6 = std::distance(plist.begin(), p6); + size_t i7 = std::distance(plist.begin(), p7); + + bool npb1=false; + VEC_pD::iterator np1 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[0]); + size_t ni1 = std::distance(clist_params_.begin(), np1); + + if(i1 == plist.size()) { + if(ni1 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[0]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[0]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[0] << std::endl; + icp++; + } + npb1=true; + } + + bool npb2=false; + VEC_pD::iterator np2 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[1]); + size_t ni2 = std::distance(clist_params_.begin(), np2); + + if(i2 == plist.size()) { + if(ni2 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[1]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[1]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[1] << std::endl; + icp++; + } + npb2=true; + } + + bool npb3=false; + VEC_pD::iterator np3 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[2]); + size_t ni3 = std::distance(clist_params_.begin(), np3); + + if(i3 == plist.size()) { + if(ni3 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[2]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[2]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[2] << std::endl; + icp++; + } + npb3=true; + } + + bool npb4=false; + VEC_pD::iterator np4 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[3]); + size_t ni4 = std::distance(clist_params_.begin(), np4); + + if(i4 == plist.size()) { + if(ni4 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[3]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[3]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[3] << std::endl; + icp++; + } + npb4=true; + } + + bool npb5=false; + VEC_pD::iterator np5 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[4]); + size_t ni5 = std::distance(clist_params_.begin(), np5); + + if(i5 == plist.size()) { + if(ni5 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[4]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[4]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[4] << std::endl; + icp++; + } + npb5=true; + } + + bool npb6=false; + VEC_pD::iterator np6 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[5]); + size_t ni6 = std::distance(clist_params_.begin(), np6); + + if(i6 == plist.size()) { + if(ni6 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[5]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[5]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[5] << std::endl; + icp++; + } + npb6=true; + } + + bool npb7=false; + VEC_pD::iterator np7 = std::find(clist_params_.begin(), clist_params_.end(),(*it)->pvec[6]); + size_t ni7 = std::distance(clist_params_.begin(), np7); + + if(i7 == plist.size()) { + if(ni7 == clist_params_.size()) { + subsystemfile << "// Address not in System params...rebuilding into clist_params_" << std::endl; + clist_params_.push_back((*it)->pvec[6]); + subsystemfile << "clist_params_.push_back(new double("<< *((*it)->pvec[6]) <<")); // "<< icp <<" address: " << (void *)(*it)->pvec[6] << std::endl; + icp++; + } + npb7=true; + } + + subsystemfile << "ConstraintPointOnEllipse * c" << ic <<"=new ConstraintPointOnEllipse();" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb1?("clist_params_["):("plist_[")) << (npb1?ni1:i1) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb2?("clist_params_["):("plist_[")) << (npb2?ni2:i2) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb3?("clist_params_["):("plist_[")) << (npb3?ni3:i3) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb4?("clist_params_["):("plist_[")) << (npb4?ni4:i4) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb5?("clist_params_["):("plist_[")) << (npb5?ni5:i5) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb6?("clist_params_["):("plist_[")) << (npb6?ni6:i6) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->pvec.push_back(" << (npb7?("clist_params_["):("plist_[")) << (npb7?ni7:i7) <<"]);" << std::endl; + subsystemfile << "c" << ic << "->origpvec=c" << ic << "->pvec;" << std::endl; + subsystemfile << "c" << ic << "->rescale();" << std::endl; + subsystemfile << "clist_.push_back(c" << ic << "); // addresses = "<< (*it)->pvec[0] << "," << (*it)->pvec[1] << "," << (*it)->pvec[2] << "," << (*it)->pvec[3] << "," << (*it)->pvec[4] << "," << (*it)->pvec[5] << "," << (*it)->pvec[6] << std::endl; + break; + } + CASE_NOT_IMP(TangentEllipseLine) + CASE_NOT_IMP(InternalAlignmentPoint2Ellipse) + CASE_NOT_IMP(EqualMajorAxesEllipse) + CASE_NOT_IMP(EllipticalArcRangeToEndPoints) + CASE_NOT_IMP(AngleViaPoint) + CASE_NOT_IMP(Snell) + CASE_NOT_IMP(None) + + } + + } + + subsystemfile.close(); +} +#endif + // The following solver variant solves a system compound of two subsystems // treating the first of them as of higher priority than the second int System::solve(SubSystem *subsysA, SubSystem *subsysB, bool isFine, bool isRedundantsolving) diff --git a/src/Mod/Sketcher/App/planegcs/GCS.h b/src/Mod/Sketcher/App/planegcs/GCS.h index 0363361e3..7224ca5b7 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.h +++ b/src/Mod/Sketcher/App/planegcs/GCS.h @@ -96,6 +96,10 @@ namespace GCS int solve_BFGS(SubSystem *subsys, bool isFine=true, bool isRedundantsolving=false); int solve_LM(SubSystem *subsys, bool isRedundantsolving=false); int solve_DL(SubSystem *subsys, bool isRedundantsolving=false); + + #ifdef _GCS_EXTRACT_SOLVER_SUBSYSTEM_ + void extractSubsystem(SubSystem *subsys, bool isRedundantsolving); + #endif public: int maxIter; int maxIterRedundant; diff --git a/src/Mod/Sketcher/App/planegcs/SubSystem.cpp b/src/Mod/Sketcher/App/planegcs/SubSystem.cpp index 3143ae277..2f99a4e26 100644 --- a/src/Mod/Sketcher/App/planegcs/SubSystem.cpp +++ b/src/Mod/Sketcher/App/planegcs/SubSystem.cpp @@ -200,6 +200,11 @@ void SubSystem::setParams(Eigen::VectorXd &xIn) pvals[i] = xIn[i]; } +void SubSystem::getConstraintList(std::vector &clist_) +{ + clist_= clist; +} + double SubSystem::error() { double err = 0.; diff --git a/src/Mod/Sketcher/App/planegcs/SubSystem.h b/src/Mod/Sketcher/App/planegcs/SubSystem.h index c2a2b6a2f..b140fe01a 100644 --- a/src/Mod/Sketcher/App/planegcs/SubSystem.h +++ b/src/Mod/Sketcher/App/planegcs/SubSystem.h @@ -63,6 +63,8 @@ namespace GCS void getParams(Eigen::VectorXd &xOut); void setParams(VEC_pD ¶ms, Eigen::VectorXd &xIn); void setParams(Eigen::VectorXd &xIn); + + void getConstraintList(std::vector &clist_); double error(); void calcResidual(Eigen::VectorXd &r);