19 #include <QStringList>
20 #include <QStringListModel>
31 _allGeo(new QStringListModel),
32 _selGeo(new QStringListModel)
37 this->param1->setText(
"2");
38 this->param2->setText(
"0.3");
39 this->param3->setText(
"0.05");
40 this->param4->setText(
"0");
43 auto* max_number_of_points_in_quadtree_leaf_validator(
45 param1->setValidator(max_number_of_points_in_quadtree_leaf_validator);
47 auto* mesh_density_scaling_pnts_validator(
49 param2->setValidator(mesh_density_scaling_pnts_validator);
51 auto* mesh_density_scaling_stations_validator(
53 param3->setValidator(mesh_density_scaling_stations_validator);
58 std::vector<std::string> geo_station_names;
61 std::copy(geo_station_names.begin(), geo_station_names.end(),
62 std::back_inserter(geoNames));
64 std::size_t nGeoObjects(geoNames.size());
67 for (
unsigned i = 0; i < nGeoObjects; ++i)
69 list.append(QString::fromStdString(geoNames[i]));
74 this->selectGeoButton->setDisabled(
true);
75 this->deselectGeoButton->setDisabled(
true);
76 list.append(
"[No geometry available.]");
79 this->allGeoView->setModel(
_allGeo);
80 this->selectedGeoView->setModel(
_selGeo);
81 this->radioAdaptive->toggle();
93 QModelIndexList selected =
94 this->allGeoView->selectionModel()->selectedIndexes();
95 QStringList list =
_selGeo->stringList();
97 for (
auto& index : selected)
99 list.append(index.data().toString());
101 _allGeo->removeRow(index.row());
108 QModelIndexList selected =
109 this->selectedGeoView->selectionModel()->selectedIndexes();
110 QStringList list =
_allGeo->stringList();
112 for (
auto& index : selected)
114 list.append(index.data().toString());
116 _selGeo->removeRow(index.row());
125 this->param1->setEnabled(
true);
126 this->param2->setEnabled(
true);
127 this->param3->setEnabled(
true);
128 this->param4->setEnabled(
false);
132 this->param1->setEnabled(
false);
133 this->param2->setEnabled(
false);
134 this->param3->setEnabled(
false);
135 this->param4->setEnabled(
true);
141 if (this->
_selGeo->stringList().empty())
144 "No geometry selected. Geometric data\n is necessary for mesh "
149 std::vector<std::string> selectedObjects =
151 unsigned max_number_of_points_in_quadtree_leaf(10);
152 double mesh_density_scaling_pnts(0.5);
153 double mesh_density_scaling_stations(0.05);
156 if (this->radioAdaptive->isChecked())
158 double const min_scaling_factor(1e-10);
159 max_number_of_points_in_quadtree_leaf =
160 BaseLib::str2number<unsigned>(param1->text().toStdString());
161 if (max_number_of_points_in_quadtree_leaf == 0)
163 max_number_of_points_in_quadtree_leaf = 10;
165 mesh_density_scaling_pnts = fabs(param2->text().toDouble());
166 if (mesh_density_scaling_pnts < min_scaling_factor)
168 mesh_density_scaling_pnts = min_scaling_factor;
170 mesh_density_scaling_stations = param3->text().toDouble();
171 if (mesh_density_scaling_stations < min_scaling_factor)
173 mesh_density_scaling_stations = min_scaling_factor;
178 val4 = param4->text().toDouble();
181 bool delete_geo_file = this->geoFileDelete->isChecked();
183 max_number_of_points_in_quadtree_leaf,
184 mesh_density_scaling_pnts,
185 mesh_density_scaling_stations,
188 this->done(QDialog::Accepted);
193 this->done(QDialog::Rejected);
198 std::vector<std::string> indexList;
199 std::transform(list.begin(), list.end(), std::back_inserter(indexList),
200 [](
auto const& index) { return index.toStdString(); });
Definition of the GEOObjects class.
Definition of the GMSHPrefsDialog class.
Definition of the OGSError class.
Implementation of the StrictDoubleValidator class.
Definition of the StrictIntValidator class.
void on_selectGeoButton_pressed()
std::vector< std::string > getSelectedObjects(QStringList list)
void reject() override
Instructions if the Cancel-Button has been pressed.
void on_radioAdaptive_toggled(bool isTrue)
QStringListModel * _selGeo
QStringListModel * _allGeo
GMSHPrefsDialog(GeoLib::GEOObjects const &geoObjects, QDialog *parent=nullptr)
void accept() override
Instructions if the OK-Button has been pressed.
~GMSHPrefsDialog() override
void on_deselectGeoButton_pressed()
void requestMeshing(std::vector< std::string > &, unsigned, double, double, double, bool)
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
void getStationVectorNames(std::vector< std::string > &names) const
Returns the names of all station vectors.
static void box(const QString &e)
A validator for an input field which only accepts decimals. Source code adapted from StackOverflow
A validator for an input field which only accepts integers. Source code adapted from Qt developer faq...
void copy(PETScVector const &x, PETScVector &y)