Skip to content

Commit

Permalink
fix #61 (at least for now no issues have been found) and fix #62 (VFs…
Browse files Browse the repository at this point in the history
… are loaded even for piecewise data, no more segfaults when trying to add new VFs after loading)
  • Loading branch information
oscarsaleta committed Jul 12, 2018
1 parent b6e16ef commit f1998f3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 32 deletions.
41 changes: 16 additions & 25 deletions QtCreator/p4/P4InputVF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,18 +543,6 @@ bool P4InputVF::load()
curveRegions_.emplace_back(indx, std::move(sgns));
}

numeric_.clear();
precision_.clear();
epsilon_.clear();
testsep_.clear();
taylorlevel_.clear();
numericlevel_.clear();
maxlevel_.clear();
weakness_.clear();
xdot_.clear();
ydot_.clear();
gcf_.clear();
// parvalue_.clear();
for (unsigned int k = 0; k < numVF_; k++) {
if (fscanf(fp, "%d\n", &flag_numeric) != 1 ||
fscanf(fp, "%d\n", &aux) != 1 ||
Expand All @@ -564,58 +552,58 @@ bool P4InputVF::load()
fclose(fp);
return false;
} else {
numeric_.push_back(((flag_numeric == 0) ? false : true));
precision_.push_back(aux);
epsilon_.emplace_back(scanbuf);
testsep_.push_back(((flag_testsep == 0) ? false : true));
numeric_[k] = ((flag_numeric == 0) ? false : true);
precision_[k] = aux;
epsilon_[k] = QString{scanbuf};
testsep_[k] = ((flag_testsep == 0) ? false : true);
}
if (fscanf(fp, "%d\n", &aux) != 1) {
reset(1);
fclose(fp);
return false;
} else {
taylorlevel_.push_back(aux);
taylorlevel_[k] = aux;
}
if (fscanf(fp, "%d\n", &aux) != 1) {
reset(1);
fclose(fp);
return false;
} else {
numericlevel_.push_back(aux);
numericlevel_[k] = aux;
}
if (fscanf(fp, "%d\n", &aux) != 1) {
reset(1);
fclose(fp);
return false;
} else {
maxlevel_.push_back(aux);
maxlevel_[k] = aux;
}
if (fscanf(fp, "%d\n", &aux) != 1) {
reset(1);
fclose(fp);
return false;
} else {
weakness_.push_back(aux);
weakness_[k] = aux;
}

if (fscanf(fp, "%[^\n]\n", scanbuf) != 1) {
reset(1);
fclose(fp);
return false;
}
xdot_.emplace_back(scanbuf);
xdot_[k] = QString{scanbuf};
if (fscanf(fp, "%[^\n]\n", scanbuf) != 1) {
reset(1);
fclose(fp);
return false;
}
ydot_.emplace_back(scanbuf);
ydot_[k] = QString{scanbuf};
if (fscanf(fp, "%[^\n]\n", scanbuf) != 1) {
reset(1);
fclose(fp);
return false;
}
gcf_.emplace_back(scanbuf);
gcf_[k] = QString{scanbuf};

if (xdot_[k] == "(null)")
xdot_[k] = "";
Expand All @@ -636,10 +624,13 @@ bool P4InputVF::load()
auxvec.emplace_back(scanbuf);
}
parvalue_[k] = auxvec;
/*for (i = numParams_; i < MAXNUMPARAMS; i++)
parvalue_[k].push_back(QString{});*/
for (unsigned int i = numParams_; i < MAXNUMPARAMS; i++)
parvalue_[k].push_back(QString{});
}
}
selected_.clear();
selected_.push_back(0);
numSelected_ = 1;

fclose(fp);

Expand Down
11 changes: 7 additions & 4 deletions QtCreator/p4/P4SeparatingCurvesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

#include "P4Application.hpp"
#include "P4FindDlg.hpp"
#include "P4InputSphere.hpp"
#include "P4InputVF.hpp"
#include "P4ParentStudy.hpp"
#include "P4ViewDlg.hpp"
#include "P4InputSphere.hpp"
#include "main.hpp"

P4SeparatingCurvesDlg::P4SeparatingCurvesDlg(P4FindDlg *parent)
Expand Down Expand Up @@ -184,10 +184,13 @@ P4SeparatingCurvesDlg::P4SeparatingCurvesDlg(P4FindDlg *parent)
QObject::connect(edt_numpoints_, &QLineEdit::editingFinished, this,
&P4SeparatingCurvesDlg::onNumpointsEditingFinished);

QObject::connect(gThisVF, &P4InputVF::loadSignal, this,
&P4SeparatingCurvesDlg::updateDlgData);

#ifdef TOOLTIPS
btn_add_->setToolTip(
"Adds a new separating curve to the list.\nEnter a Maple expression "
"after pressing the button.");
btn_add_->setToolTip("Adds a new separating curve to the list.\nEnter "
"a Maple expression "
"after pressing the button.");
btn_del_->setToolTip(
"Deletes the selected separating curve from the list.");
btn_edit_->setToolTip("Edits the separating curve Maple expression.");
Expand Down
9 changes: 6 additions & 3 deletions QtCreator/p4/P4VectorFieldDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ void P4VectorFieldDlg::getDataFromDlg()

void P4VectorFieldDlg::updateDlgData()
{
edt_xprime_->setText(gThisVF->xdot_.back());
edt_yprime_->setText(gThisVF->ydot_.back());
edt_gcf_->setText(gThisVF->gcf_.back());
if (!gThisVF->xdot_.empty())
edt_xprime_->setText(gThisVF->xdot_[0]);
if (!gThisVF->ydot_.empty())
edt_yprime_->setText(gThisVF->ydot_[0]);
if (!gThisVF->gcf_.empty())
edt_gcf_->setText(gThisVF->gcf_[0]);
// setLineEditCommonValue(edt_xprime_, gThisVF->xdot_);
// setLineEditCommonValue(edt_yprime_, gThisVF->ydot_);
// setLineEditCommonValue(edt_gcf_, gThisVF->gcf_);
Expand Down

0 comments on commit f1998f3

Please sign in to comment.