20#include <QStringListModel>
38 this->param1->setText(
"2");
39 this->param2->setText(
"0.3");
40 this->param3->setText(
"0.05");
41 this->param4->setText(
"0");
44 auto* max_number_of_points_in_quadtree_leaf_validator(
46 param1->setValidator(max_number_of_points_in_quadtree_leaf_validator);
48 auto* mesh_density_scaling_pnts_validator(
50 param2->setValidator(mesh_density_scaling_pnts_validator);
52 auto* mesh_density_scaling_stations_validator(
54 param3->setValidator(mesh_density_scaling_stations_validator);
59 std::vector<std::string> geo_station_names;
62 std::copy(geo_station_names.begin(), geo_station_names.end(),
63 std::back_inserter(geoNames));
65 std::size_t nGeoObjects(geoNames.size());
68 for (
unsigned i = 0; i < nGeoObjects; ++i)
70 list.append(QString::fromStdString(geoNames[i]));
75 this->selectGeoButton->setDisabled(
true);
76 this->deselectGeoButton->setDisabled(
true);
77 list.append(
"[No geometry available.]");
80 this->allGeoView->setModel(
_allGeo);
81 this->selectedGeoView->setModel(
_selGeo);
82 this->radioAdaptive->toggle();
94 QModelIndexList selected =
95 this->allGeoView->selectionModel()->selectedIndexes();
96 QStringList list =
_selGeo->stringList();
98 for (
auto& index : selected)
100 list.append(index.data().toString());
102 _allGeo->removeRow(index.row());
109 QModelIndexList selected =
110 this->selectedGeoView->selectionModel()->selectedIndexes();
111 QStringList list =
_allGeo->stringList();
113 for (
auto& index : selected)
115 list.append(index.data().toString());
117 _selGeo->removeRow(index.row());
126 this->param1->setEnabled(
true);
127 this->param2->setEnabled(
true);
128 this->param3->setEnabled(
true);
129 this->param4->setEnabled(
false);
133 this->param1->setEnabled(
false);
134 this->param2->setEnabled(
false);
135 this->param3->setEnabled(
false);
136 this->param4->setEnabled(
true);
142 if (this->
_selGeo->stringList().empty())
145 "No geometry selected. Geometric data\n is necessary for mesh "
150 std::vector<std::string> selectedObjects =
152 unsigned max_number_of_points_in_quadtree_leaf(10);
153 double mesh_density_scaling_pnts(0.5);
154 double mesh_density_scaling_stations(0.05);
157 if (this->radioAdaptive->isChecked())
159 double const min_scaling_factor(1e-10);
160 max_number_of_points_in_quadtree_leaf =
162 if (max_number_of_points_in_quadtree_leaf == 0)
164 max_number_of_points_in_quadtree_leaf = 10;
166 mesh_density_scaling_pnts = fabs(param2->text().toDouble());
167 if (mesh_density_scaling_pnts < min_scaling_factor)
169 mesh_density_scaling_pnts = min_scaling_factor;
171 mesh_density_scaling_stations = param3->text().toDouble();
172 if (mesh_density_scaling_stations < min_scaling_factor)
174 mesh_density_scaling_stations = min_scaling_factor;
179 val4 = param4->text().toDouble();
182 bool delete_geo_file = this->geoFileDelete->isChecked();
184 max_number_of_points_in_quadtree_leaf,
185 mesh_density_scaling_pnts,
186 mesh_density_scaling_stations,
189 this->done(QDialog::Accepted);
194 this->done(QDialog::Rejected);
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()
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...
T str2number(const std::string &str)
std::vector< std::string > getSelectedObjects(QStringList const &list)