+ fix various warnings
This commit is contained in:
parent
cac09437c8
commit
32bcbda232
|
@ -886,6 +886,8 @@ int Sketch::addConstraint(const Constraint *constraint)
|
|||
case EllipseFocus2:
|
||||
rtn = addInternalAlignmentEllipseFocus2(constraint->First,constraint->Second);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SnellsLaw:
|
||||
|
@ -1233,8 +1235,6 @@ int Sketch::addTangentConstraint(int geoId1, int geoId2)
|
|||
return ConstraintsCounter;
|
||||
}
|
||||
} else if (Geoms[geoId1].type == Ellipse) {
|
||||
GCS::Ellipse &e = Ellipses[Geoms[geoId1].index];
|
||||
|
||||
if (Geoms[geoId2].type == Circle) {
|
||||
Base::Console().Error("Direct tangency constraint between circle and ellipse is not supported. Use tangent-via-point instead.");
|
||||
return -1;
|
||||
|
@ -1748,7 +1748,6 @@ int Sketch::addSnellsLawConstraint(int geoIdRay1, PointPos posRay1,
|
|||
return -1;
|
||||
}
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
GCS::Point &p2 = Points[pointId2];
|
||||
|
||||
// add the parameters (refractive indexes)
|
||||
// n1 uses the place hold by n2divn1, so that is retrivable in updateNonDrivingConstraints
|
||||
|
@ -2097,10 +2096,10 @@ int Sketch::solve(void)
|
|||
isFine = true;
|
||||
}
|
||||
|
||||
int ret;
|
||||
int ret = -1;
|
||||
bool valid_solution;
|
||||
std::string solvername;
|
||||
int defaultsoltype;
|
||||
int defaultsoltype = -1;
|
||||
|
||||
if(isInitMove){
|
||||
solvername = "DogLeg"; // DogLeg is used for dragging (same as before)
|
||||
|
|
|
@ -615,7 +615,7 @@ int SketchObject::addConstraints(const std::vector<Constraint *> &ConstraintList
|
|||
|
||||
//test if tangent constraints have been added; AutoLockTangency.
|
||||
std::vector< Constraint * > tbd;//list of temporary copies that need to be deleted
|
||||
for(int i = newVals.size()-ConstraintList.size(); i<newVals.size(); i++){
|
||||
for(std::size_t i = newVals.size()-ConstraintList.size(); i<newVals.size(); i++){
|
||||
if( newVals[i]->Type == Tangent || newVals[i]->Type == Perpendicular ){
|
||||
Constraint *constNew = newVals[i]->clone();
|
||||
AutoLockTangencyAndPerpty(constNew);
|
||||
|
@ -627,7 +627,7 @@ int SketchObject::addConstraints(const std::vector<Constraint *> &ConstraintList
|
|||
this->Constraints.setValues(newVals);
|
||||
|
||||
//clean up - delete temporary copies of constraints that were made to affect the constraints
|
||||
for(int i=0; i<tbd.size(); i++){
|
||||
for(std::size_t i=0; i<tbd.size(); i++){
|
||||
delete (tbd[i]);
|
||||
}
|
||||
|
||||
|
@ -1626,12 +1626,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
bool minor=false;
|
||||
bool focus1=false;
|
||||
bool focus2=false;
|
||||
|
||||
int majorelementindex=-1;
|
||||
int minorelementindex=-1;
|
||||
int focus1elementindex=-1;
|
||||
int focus2elementindex=-1;
|
||||
|
||||
|
||||
const std::vector< Sketcher::Constraint * > &vals = Constraints.getValues();
|
||||
|
||||
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();
|
||||
|
@ -1641,19 +1636,15 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
switch((*it)->AlignmentType){
|
||||
case Sketcher::EllipseMajorDiameter:
|
||||
major=true;
|
||||
majorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseMinorDiameter:
|
||||
minor=true;
|
||||
minorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus1:
|
||||
focus1=true;
|
||||
focus1elementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus2:
|
||||
focus2=true;
|
||||
focus2elementindex=(*it)->First;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -1794,12 +1785,7 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
const Part::Geometry *geo = getGeometry(GeoId);
|
||||
// Only for supported types
|
||||
if(geo->getTypeId() == Part::GeomEllipse::getClassTypeId() || geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
// First we search what has to be deleted
|
||||
bool major=false;
|
||||
bool minor=false;
|
||||
bool focus1=false;
|
||||
bool focus2=false;
|
||||
|
||||
|
||||
int majorelementindex=-1;
|
||||
int minorelementindex=-1;
|
||||
int focus1elementindex=-1;
|
||||
|
@ -1813,19 +1799,15 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
{
|
||||
switch((*it)->AlignmentType){
|
||||
case Sketcher::EllipseMajorDiameter:
|
||||
major=true;
|
||||
majorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseMinorDiameter:
|
||||
minor=true;
|
||||
minorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus1:
|
||||
focus1=true;
|
||||
focus1elementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus2:
|
||||
focus2=true;
|
||||
focus2elementindex=(*it)->First;
|
||||
break;
|
||||
default:
|
||||
|
@ -1840,8 +1822,6 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
int focus1constraints=0;
|
||||
int focus2constraints=0;
|
||||
|
||||
int decrgeo=0;
|
||||
|
||||
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();
|
||||
it != vals.end(); ++it) {
|
||||
|
||||
|
@ -2224,7 +2204,6 @@ void SketchObject::rebuildExternalGeometry(void)
|
|||
|
||||
//gp_Dir normal = e.Axis().Direction();
|
||||
gp_Dir normal = gp_Dir(0,0,1);
|
||||
gp_Dir xdir = e.XAxis().Direction();
|
||||
gp_Ax2 xdirref(p, normal);
|
||||
|
||||
if (P1.SquareDistance(P2) < Precision::Confusion()) {
|
||||
|
@ -2521,9 +2500,6 @@ bool SketchObject::evaluateConstraints() const
|
|||
|
||||
void SketchObject::validateConstraints()
|
||||
{
|
||||
int intGeoCount = getHighestCurveIndex() + 1;
|
||||
int extGeoCount = getExternalGeometryCount();
|
||||
|
||||
std::vector<Part::Geometry *> geometry = getCompleteGeometry();
|
||||
const std::vector<Sketcher::Constraint *>& constraints = Constraints.getValues();
|
||||
|
||||
|
@ -2624,7 +2600,7 @@ double SketchObject::calculateConstraintError(int ConstrId)
|
|||
GeoIdList.push_back(cstr->Third);
|
||||
|
||||
//add only necessary geometry to the sketch
|
||||
for(int i=0; i<GeoIdList.size(); i++){
|
||||
for(std::size_t i=0; i<GeoIdList.size(); i++){
|
||||
g = GeoIdList[i];
|
||||
if (g != Constraint::GeoUndef){
|
||||
GeoIdList[i] = sk.addGeometry(this->getGeometry(g));
|
||||
|
@ -2724,7 +2700,7 @@ void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId)
|
|||
|
||||
int SketchObject::getVertexIndexGeoPos(int GeoId, PointPos PosId) const
|
||||
{
|
||||
for(int i=0;i<VertexId2GeoId.size();i++) {
|
||||
for(std::size_t i=0;i<VertexId2GeoId.size();i++) {
|
||||
if(VertexId2GeoId[i]==GeoId && VertexId2PosId[i]==PosId)
|
||||
return i;
|
||||
}
|
||||
|
@ -2751,7 +2727,7 @@ int SketchObject::changeConstraintsLocking(bool bLock)
|
|||
|
||||
std::vector< Constraint * > tbd;//list of temporary Constraint copies that need to be deleted later
|
||||
|
||||
for(int i = 0; i<newVals.size(); i++){
|
||||
for(std::size_t i = 0; i<newVals.size(); i++){
|
||||
if( newVals[i]->Type == Tangent || newVals[i]->Type == Perpendicular ){
|
||||
//create a constraint copy, affect it, replace the pointer
|
||||
cntToBeAffected++;
|
||||
|
@ -2768,7 +2744,7 @@ int SketchObject::changeConstraintsLocking(bool bLock)
|
|||
this->Constraints.setValues(newVals);
|
||||
|
||||
//clean up - delete temporary copies of constraints that were made to affect the constraints
|
||||
for(int i=0; i<tbd.size(); i++){
|
||||
for(std::size_t i=0; i<tbd.size(); i++){
|
||||
delete (tbd[i]);
|
||||
}
|
||||
|
||||
|
@ -2786,7 +2762,6 @@ int SketchObject::changeConstraintsLocking(bool bLock)
|
|||
*/
|
||||
int SketchObject::port_reversedExternalArcs(bool justAnalyze)
|
||||
{
|
||||
int cntSuccess = 0;
|
||||
int cntToBeAffected = 0;//==cntSuccess+cntFail
|
||||
const std::vector< Constraint * > &vals = this->Constraints.getValues();
|
||||
|
||||
|
@ -2794,7 +2769,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze)
|
|||
|
||||
std::vector< Constraint * > tbd;//list of temporary Constraint copies that need to be deleted later
|
||||
|
||||
for(int ic = 0; ic<newVals.size(); ic++){//ic = index of constraint
|
||||
for(std::size_t ic = 0; ic<newVals.size(); ic++){//ic = index of constraint
|
||||
bool affected=false;
|
||||
Constraint *constNew = 0;
|
||||
for(int ig=1; ig<=3; ig++){//cycle through constraint.first, second, third
|
||||
|
@ -2850,7 +2825,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze)
|
|||
}
|
||||
|
||||
//clean up - delete temporary copies of constraints that were made to affect the constraints
|
||||
for(int i=0; i<tbd.size(); i++){
|
||||
for(std::size_t i=0; i<tbd.size(); i++){
|
||||
delete (tbd[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -617,7 +617,6 @@ PyObject* SketchObjectPy::getDriving(PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "i", &constrid))
|
||||
return 0;
|
||||
|
||||
SketchObject* obj = this->getSketchObjectPtr();
|
||||
if (this->getSketchObjectPtr()->getDriving(constrid, driving)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid constraint id");
|
||||
return 0;
|
||||
|
|
|
@ -87,7 +87,7 @@ double Constraint::maxStep(MAP_pD_D &dir, double lim)
|
|||
int Constraint::findParamInPvec(double *param)
|
||||
{
|
||||
int ret = -1;
|
||||
for( int i=0 ; i<pvec.size() ; i++ ){
|
||||
for( std::size_t i=0 ; i<pvec.size() ; i++ ){
|
||||
if ( param == pvec[i] ) {
|
||||
ret = i;
|
||||
break;
|
||||
|
@ -1171,7 +1171,7 @@ void ConstraintInternalAlignmentPoint2Ellipse::errorgrad(double *err, double *gr
|
|||
a = e.getRadMaj(c,f1,b,db,da);
|
||||
|
||||
DeriVector2 poa;//point to align to
|
||||
bool by_y_not_by_x;//a flag to indicate if the alignment error function is for y (false - x, true - y).
|
||||
bool by_y_not_by_x = false;//a flag to indicate if the alignment error function is for y (false - x, true - y).
|
||||
|
||||
switch(AlignmentType){
|
||||
case EllipsePositiveMajorX:
|
||||
|
|
|
@ -167,20 +167,37 @@ typedef boost::adjacency_list <boost::vecS, boost::vecS, boost::undirectedS> Gra
|
|||
|
||||
// System
|
||||
System::System()
|
||||
: plist(0), clist(0),
|
||||
c2p(), p2c(),
|
||||
subSystems(0), subSystemsAux(0),
|
||||
reference(0),
|
||||
hasUnknowns(false), hasDiagnosis(false), isInit(false),
|
||||
maxIter(100), maxIterRedundant(100),
|
||||
sketchSizeMultiplier(true), sketchSizeMultiplierRedundant(true),
|
||||
convergence(1e-10), convergenceRedundant(1e-10),
|
||||
qrAlgorithm(EigenSparseQR), debugMode(Minimal),
|
||||
LM_eps(1E-10), LM_eps1(1E-80), LM_tau(1E-3),
|
||||
DL_tolg(1E-80), DL_tolx(1E-80), DL_tolf(1E-10),
|
||||
LM_epsRedundant(1E-10), LM_eps1Redundant(1E-80), LM_tauRedundant(1E-3),
|
||||
DL_tolgRedundant(1E-80), DL_tolxRedundant(1E-80), DL_tolfRedundant(1E-10),
|
||||
qrpivotThreshold(1E-13)
|
||||
: plist(0)
|
||||
, clist(0)
|
||||
, c2p()
|
||||
, p2c()
|
||||
, subSystems(0)
|
||||
, subSystemsAux(0)
|
||||
, reference(0)
|
||||
, hasUnknowns(false)
|
||||
, hasDiagnosis(false)
|
||||
, isInit(false)
|
||||
, maxIter(100)
|
||||
, maxIterRedundant(100)
|
||||
, sketchSizeMultiplier(true)
|
||||
, sketchSizeMultiplierRedundant(true)
|
||||
, convergence(1e-10)
|
||||
, convergenceRedundant(1e-10)
|
||||
, qrAlgorithm(EigenSparseQR)
|
||||
, qrpivotThreshold(1E-13)
|
||||
, debugMode(Minimal)
|
||||
, LM_eps(1E-10)
|
||||
, LM_eps1(1E-80)
|
||||
, LM_tau(1E-3)
|
||||
, DL_tolg(1E-80)
|
||||
, DL_tolx(1E-80)
|
||||
, DL_tolf(1E-10)
|
||||
, LM_epsRedundant(1E-10)
|
||||
, LM_eps1Redundant(1E-80)
|
||||
, LM_tauRedundant(1E-3)
|
||||
, DL_tolgRedundant(1E-80)
|
||||
, DL_tolxRedundant(1E-80)
|
||||
, DL_tolfRedundant(1E-10)
|
||||
{
|
||||
// currently Eigen only supports multithreading for multiplications
|
||||
// There is no appreciable gain from using more threads
|
||||
|
@ -877,7 +894,7 @@ double System::calculateConstraintErrorByTag(int tagId)
|
|||
|
||||
void System::rescaleConstraint(int id, double coeff)
|
||||
{
|
||||
if (id >= clist.size() || id < 0)
|
||||
if (id >= static_cast<int>(clist.size()) || id < 0)
|
||||
return;
|
||||
if (clist[id])
|
||||
clist[id]->rescale(coeff);
|
||||
|
@ -999,7 +1016,7 @@ void System::initSolution(Algorithm alg)
|
|||
|
||||
// calculates subSystems and subSystemsAux from clists, plists and reductionmaps
|
||||
clearSubSystems();
|
||||
for (int cid=0; cid < clists.size(); cid++) {
|
||||
for (std::size_t cid=0; cid < clists.size(); cid++) {
|
||||
std::vector<Constraint *> clist0, clist1;
|
||||
for (std::vector<Constraint *>::const_iterator constr=clists[cid].begin();
|
||||
constr != clists[cid].end(); ++constr) {
|
||||
|
@ -1830,9 +1847,9 @@ int System::diagnose(Algorithm alg)
|
|||
#endif
|
||||
|
||||
Eigen::MatrixXd R;
|
||||
int paramsNum;
|
||||
int constrNum;
|
||||
int rank;
|
||||
int paramsNum = 0;
|
||||
int constrNum = 0;
|
||||
int rank = 0;
|
||||
Eigen::FullPivHouseholderQR<Eigen::MatrixXd> qrJT;
|
||||
|
||||
if(qrAlgorithm==EigenDenseQR){
|
||||
|
@ -1940,7 +1957,7 @@ int System::diagnose(Algorithm alg)
|
|||
for (int j=rank; j < constrNum; j++) {
|
||||
for (int row=0; row < rank; row++) {
|
||||
if (fabs(R(row,j)) > 1e-10) {
|
||||
int origCol;
|
||||
int origCol = 0;
|
||||
|
||||
if(qrAlgorithm==EigenDenseQR)
|
||||
origCol=qrJT.colsPermutation().indices()[row];
|
||||
|
@ -1952,7 +1969,7 @@ int System::diagnose(Algorithm alg)
|
|||
conflictGroups[j-rank].push_back(clist[origCol]);
|
||||
}
|
||||
}
|
||||
int origCol;
|
||||
int origCol = 0;
|
||||
|
||||
if(qrAlgorithm==EigenDenseQR)
|
||||
origCol=qrJT.colsPermutation().indices()[j];
|
||||
|
@ -1972,9 +1989,9 @@ int System::diagnose(Algorithm alg)
|
|||
SET_I satisfiedGroups;
|
||||
while (1) {
|
||||
std::map< Constraint *, SET_I > conflictingMap;
|
||||
for (int i=0; i < conflictGroups.size(); i++) {
|
||||
for (std::size_t i=0; i < conflictGroups.size(); i++) {
|
||||
if (satisfiedGroups.count(i) == 0) {
|
||||
for (int j=0; j < conflictGroups[i].size(); j++) {
|
||||
for (std::size_t j=0; j < conflictGroups[i].size(); j++) {
|
||||
Constraint *constr = conflictGroups[i][j];
|
||||
if (constr->getTag() != 0) // exclude constraints tagged with zero
|
||||
conflictingMap[constr].insert(i);
|
||||
|
@ -1988,8 +2005,8 @@ int System::diagnose(Algorithm alg)
|
|||
Constraint *mostPopular = NULL;
|
||||
for (std::map< Constraint *, SET_I >::const_iterator it=conflictingMap.begin();
|
||||
it != conflictingMap.end(); it++) {
|
||||
if (it->second.size() > maxPopularity ||
|
||||
(it->second.size() == maxPopularity && mostPopular &&
|
||||
if (static_cast<int>(it->second.size()) > maxPopularity ||
|
||||
(static_cast<int>(it->second.size()) == maxPopularity && mostPopular &&
|
||||
it->first->getTag() > mostPopular->getTag())) {
|
||||
mostPopular = it->first;
|
||||
maxPopularity = it->second.size();
|
||||
|
@ -2049,7 +2066,7 @@ int System::diagnose(Algorithm alg)
|
|||
conflictGroups.clear();
|
||||
for (int i=conflictGroupsOrig.size()-1; i >= 0; i--) {
|
||||
bool isRedundant = false;
|
||||
for (int j=0; j < conflictGroupsOrig[i].size(); j++) {
|
||||
for (std::size_t j=0; j < conflictGroupsOrig[i].size(); j++) {
|
||||
if (redundant.count(conflictGroupsOrig[i][j]) > 0) {
|
||||
isRedundant = true;
|
||||
break;
|
||||
|
@ -2065,8 +2082,8 @@ int System::diagnose(Algorithm alg)
|
|||
|
||||
// simplified output of conflicting tags
|
||||
SET_I conflictingTagsSet;
|
||||
for (int i=0; i < conflictGroups.size(); i++) {
|
||||
for (int j=0; j < conflictGroups[i].size(); j++) {
|
||||
for (std::size_t i=0; i < conflictGroups.size(); i++) {
|
||||
for (std::size_t j=0; j < conflictGroups[i].size(); j++) {
|
||||
conflictingTagsSet.insert(conflictGroups[i][j]->getTag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,8 @@ bool Cell::getStringContent(std::string & s) const
|
|||
s = static_cast<StringExpression*>(expression)->getText();
|
||||
char * end;
|
||||
errno = 0;
|
||||
strtod(s.c_str(), &end);
|
||||
double d = strtod(s.c_str(), &end);
|
||||
(void)d; // fix gcc warning
|
||||
if (!*end && errno == 0)
|
||||
s = "'" + s;
|
||||
}
|
||||
|
|
|
@ -897,7 +897,7 @@ void ColorPickerPopup::regenerateGrid()
|
|||
*/
|
||||
void ColorPickerPopup::getColorFromDialog()
|
||||
{
|
||||
bool ok;
|
||||
//bool ok;
|
||||
//QRgb rgb = QColorDialog::getRgba(lastSel.rgba(), &ok, parentWidget());
|
||||
QColor col = QColorDialog::getColor(lastSel,parentWidget(),0,QColorDialog::ShowAlphaChannel);
|
||||
if (!col.isValid())
|
||||
|
|
Loading…
Reference in New Issue
Block a user