OGS
Vtu2GridDialog.cpp File Reference

Detailed Description

Implementation of the Vtu2GridDialog class.

Date
2023-05-11

Definition in file Vtu2GridDialog.cpp.

#include "Vtu2GridDialog.h"
#include <vtkXMLUnstructuredGridWriter.h>
#include <QStringList>
#include <QStringListModel>
#include <optional>
#include <string>
#include "Base/OGSError.h"
#include "Base/StrictDoubleValidator.h"
#include "GeoLib/AABB.h"
#include "MeshLib/IO/writeMeshToFile.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshLib/Vtk/VtkMappedMeshSource.h"
#include "MeshModel.h"
#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
#include "MeshToolsLib/MeshGenerators/VoxelGridFromMesh.h"
Include dependency graph for Vtu2GridDialog.cpp:

Go to the source code of this file.

Functions

std::optional< std::array< double, 3 > > fillXYZ (QString xin, QString yin, QString zin)
 
Eigen::Vector3d getMeshExtent (MeshLib::Mesh const *_mesh)
 

Function Documentation

◆ fillXYZ()

std::optional< std::array< double, 3 > > fillXYZ ( QString xin,
QString yin,
QString zin )

Definition at line 59 of file Vtu2GridDialog.cpp.

61{
62 bool ok;
63 if (!xin.toDouble(&ok))
64 {
65 return std::nullopt;
66 }
67 double const xinput = xin.toDouble();
68 double const yinput = (yin.toDouble(&ok)) ? yin.toDouble() : xinput;
69 double const zinput = (zin.toDouble(&ok)) ? zin.toDouble() : xinput;
70
71 if (xinput <= 0 || yinput <= 0 || zinput <= 0)
72 {
73 return std::nullopt;
74 }
75
76 return std::optional<std::array<double, 3>>{{xinput, yinput, zinput}};
77}

Referenced by Vtu2GridDialog::accept(), and Vtu2GridDialog::updateExpectedVoxel().

◆ getMeshExtent()

Eigen::Vector3d getMeshExtent ( MeshLib::Mesh const * _mesh)

Definition at line 79 of file Vtu2GridDialog.cpp.

80{
81 auto const& nodes = _mesh->getNodes();
82 GeoLib::AABB const aabb(nodes.cbegin(), nodes.cend());
83 auto const& min = aabb.getMinPoint();
84 auto const& max = aabb.getMaxPoint();
85 return max - min;
86}
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:56

References GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), and MeshLib::Mesh::getNodes().

Referenced by Vtu2GridDialog::updateExpectedVoxel().