Instructions if the OK-Button has been pressed.
155{
157 {
158 return;
159 }
160
161 if ((this->xLengthEdit->text().toDouble() <= 0) ||
162 (this->yLengthEdit->text().toDouble() <= 0) ||
163 (this->zLengthEdit->text().toDouble() <= 0))
164 {
166 return;
167 }
168
169 if ((this->xElemEdit->text().toDouble() <= 0) ||
170 (this->yElemEdit->text().toDouble() <= 0) ||
171 (this->zElemEdit->text().toDouble() <= 0))
172 {
173 OGSError::box(
"Number of elements needs to be larger than 0.");
174 return;
175 }
176
177 GeoLib::Point const origin(this->xOriginEdit->text().toDouble(),
178 this->yOriginEdit->text().toDouble(),
179 this->zOriginEdit->text().toDouble());
180 std::string
const name(this->meshNameEdit->text().toStdString());
181 MeshLib::Mesh* mesh(nullptr);
182 if (this->lineButton->isChecked())
183 {
184 if (this->meshExtentButton->isChecked())
185 {
187 this->xLengthEdit->text().toDouble(),
188 this->xElemEdit->text().toInt(), origin, name);
189 }
190 else
191 {
193 this->xElemEdit->text().toInt(),
194 this->xLengthEdit->text().toDouble(), origin, name);
195 }
196 }
197 else if (this->triButton->isChecked())
198 {
199 if (this->meshExtentButton->isChecked())
200 {
202 this->xLengthEdit->text().toDouble(),
203 this->yLengthEdit->text().toDouble(),
204 this->xElemEdit->text().toInt(),
205 this->yElemEdit->text().toInt(), origin, name);
206 }
207 else
208 {
210 this->xElemEdit->text().toInt(),
211 this->yElemEdit->text().toInt(),
212 this->xLengthEdit->text().toDouble(),
213 this->yLengthEdit->text().toDouble(), origin, name);
214 }
215 }
216 else if (this->quadButton->isChecked())
217 {
218 if (this->meshExtentButton->isChecked())
219 {
221 this->xLengthEdit->text().toDouble(),
222 this->yLengthEdit->text().toDouble(),
223 this->xElemEdit->text().toInt(),
224 this->yElemEdit->text().toInt(), origin, name);
225 }
226 else
227 {
229 this->xElemEdit->text().toInt(),
230 this->yElemEdit->text().toInt(),
231 this->xLengthEdit->text().toDouble(),
232 this->yLengthEdit->text().toDouble(), origin, name);
233 }
234 }
235 else if (this->prismButton->isChecked())
236 {
237 if (this->meshExtentButton->isChecked())
238 {
240 this->xLengthEdit->text().toDouble(),
241 this->yLengthEdit->text().toDouble(),
242 this->zLengthEdit->text().toDouble(),
243 this->xElemEdit->text().toInt(),
244 this->yElemEdit->text().toInt(),
245 this->zElemEdit->text().toInt(), origin, name);
246 }
247 else
248 {
250 this->xLengthEdit->text().toDouble(),
251 this->yLengthEdit->text().toDouble(),
252 this->zLengthEdit->text().toDouble(),
253 this->xElemEdit->text().toInt(),
254 this->yElemEdit->text().toInt(),
255 this->zElemEdit->text().toInt(), origin, name);
256 }
257 }
258 else if (this->hexButton->isChecked())
259 {
260 if (this->meshExtentButton->isChecked())
261 {
263 this->xLengthEdit->text().toDouble(),
264 this->yLengthEdit->text().toDouble(),
265 this->zLengthEdit->text().toDouble(),
266 this->xElemEdit->text().toInt(),
267 this->yElemEdit->text().toInt(),
268 this->zElemEdit->text().toInt(), origin, name);
269 }
270 else
271 {
273 this->xElemEdit->text().toInt(),
274 this->yElemEdit->text().toInt(),
275 this->zElemEdit->text().toInt(),
276 this->xLengthEdit->text().toDouble(),
277 this->yLengthEdit->text().toDouble(),
278 this->zLengthEdit->text().toDouble(), origin, name);
279 }
280 }
281
282 if (mesh == nullptr)
283 {
285 return;
286 }
287
288 auto* const mat_ids = mesh->getProperties().createNewPropertyVector<int>(
290 assert(mat_ids != nullptr);
291 mat_ids->resize(mesh->getNumberOfElements());
293 this->done(QDialog::Accepted);
294}
void meshAdded(MeshLib::Mesh *mesh)
bool inputIsEmpty() const
Checks if all necessary inputs have been specified.
static void box(const QString &e)