34 this->xOriginEdit->setValidator(origin_x_validator);
36 this->yOriginEdit->setValidator(origin_y_validator);
38 this->zOriginEdit->setValidator(origin_z_validator);
41 this->xLengthEdit->setValidator(x_length_validator);
43 this->yLengthEdit->setValidator(y_length_validator);
45 this->zLengthEdit->setValidator(z_length_validator);
47 auto* x_n_elem_validator =
new QIntValidator(1, 10000000,
this);
48 this->xElemEdit->setValidator(x_n_elem_validator);
49 auto* y_n_elem_validator =
new QIntValidator(1, 10000000,
this);
50 this->yElemEdit->setValidator(y_n_elem_validator);
51 auto* z_n_elem_validator =
new QIntValidator(1, 10000000,
this);
52 this->zElemEdit->setValidator(z_n_elem_validator);
107 QString
const type_str =
108 (this->meshExtentButton->isChecked()) ?
"mesh" :
"element";
109 if (this->xLengthEdit->text().isEmpty())
112 "\nextent in x-direction.");
115 if (this->xElemEdit->text().isEmpty())
117 OGSError::box(
"Please specify number of\nelements in x-direction.");
120 if (this->xOriginEdit->text().isEmpty() ||
121 this->yOriginEdit->text().isEmpty() ||
122 this->zOriginEdit->text().isEmpty())
124 OGSError::box(
"Please specify coordinates\nof mesh origin.");
127 if (this->meshNameEdit->text().isEmpty())
133 if (!this->lineButton->isChecked())
135 if (this->yLengthEdit->text().isEmpty())
138 "\nextent in y-direction.");
141 if (this->yElemEdit->text().isEmpty())
143 OGSError::box(
"Please specify number of\nelements in y-direction.");
148 if (this->prismButton->isChecked() || this->hexButton->isChecked())
150 if (this->zLengthEdit->text().isEmpty())
153 "\nextent in z-direction.");
156 if (this->zElemEdit->text().isEmpty())
158 OGSError::box(
"Please specify number of\nelements in z-direction.");
172 if ((this->xLengthEdit->text().toDouble() <= 0) ||
173 (this->yLengthEdit->text().toDouble() <= 0) ||
174 (this->zLengthEdit->text().toDouble() <= 0))
180 if ((this->xElemEdit->text().toDouble() <= 0) ||
181 (this->yElemEdit->text().toDouble() <= 0) ||
182 (this->zElemEdit->text().toDouble() <= 0))
184 OGSError::box(
"Number of elements needs to be larger than 0.");
188 GeoLib::Point const origin(this->xOriginEdit->text().toDouble(),
189 this->yOriginEdit->text().toDouble(),
190 this->zOriginEdit->text().toDouble());
191 std::string
const name(this->meshNameEdit->text().toStdString());
193 if (this->lineButton->isChecked())
195 if (this->meshExtentButton->isChecked())
198 this->xLengthEdit->text().toDouble(),
199 this->xElemEdit->text().toInt(), origin, name);
204 this->xElemEdit->text().toInt(),
205 this->xLengthEdit->text().toDouble(), origin, name);
208 else if (this->triButton->isChecked())
210 if (this->meshExtentButton->isChecked())
213 this->xLengthEdit->text().toDouble(),
214 this->yLengthEdit->text().toDouble(),
215 this->xElemEdit->text().toInt(),
216 this->yElemEdit->text().toInt(), origin, name);
221 this->xElemEdit->text().toInt(),
222 this->yElemEdit->text().toInt(),
223 this->xLengthEdit->text().toDouble(),
224 this->yLengthEdit->text().toDouble(), origin, name);
227 else if (this->quadButton->isChecked())
229 if (this->meshExtentButton->isChecked())
232 this->xLengthEdit->text().toDouble(),
233 this->yLengthEdit->text().toDouble(),
234 this->xElemEdit->text().toInt(),
235 this->yElemEdit->text().toInt(), origin, name);
240 this->xElemEdit->text().toInt(),
241 this->yElemEdit->text().toInt(),
242 this->xLengthEdit->text().toDouble(),
243 this->yLengthEdit->text().toDouble(), origin, name);
246 else if (this->prismButton->isChecked())
248 if (this->meshExtentButton->isChecked())
251 this->xLengthEdit->text().toDouble(),
252 this->yLengthEdit->text().toDouble(),
253 this->zLengthEdit->text().toDouble(),
254 this->xElemEdit->text().toInt(),
255 this->yElemEdit->text().toInt(),
256 this->zElemEdit->text().toInt(), origin, name);
261 this->xLengthEdit->text().toDouble(),
262 this->yLengthEdit->text().toDouble(),
263 this->zLengthEdit->text().toDouble(),
264 this->xElemEdit->text().toInt(),
265 this->yElemEdit->text().toInt(),
266 this->zElemEdit->text().toInt(), origin, name);
269 else if (this->hexButton->isChecked())
271 if (this->meshExtentButton->isChecked())
274 this->xLengthEdit->text().toDouble(),
275 this->yLengthEdit->text().toDouble(),
276 this->zLengthEdit->text().toDouble(),
277 this->xElemEdit->text().toInt(),
278 this->yElemEdit->text().toInt(),
279 this->zElemEdit->text().toInt(), origin, name);
284 this->xElemEdit->text().toInt(),
285 this->yElemEdit->text().toInt(),
286 this->zElemEdit->text().toInt(),
287 this->xLengthEdit->text().toDouble(),
288 this->yLengthEdit->text().toDouble(),
289 this->zLengthEdit->text().toDouble(), origin, name);
301 assert(mat_ids !=
nullptr);
304 this->done(QDialog::Accepted);