27 template <
typename PropertyType>
31 if (bounds.has_value())
33 return {
"[" + QString::number(bounds->first) +
",",
34 QString::number(bounds->second) +
"]"};
37 return {
"[empty,",
"empty]"};
46 QList<QVariant> rootData;
58 vtkUnstructuredGridAlgorithm
const*
const grid,
const unsigned elem_index)
65 auto const*
const source =
76 QList<QVariant> elemData;
77 elemData <<
"Element " + QString::number(elem_index) <<
""
83 QList<QVariant> typeData;
84 typeData <<
"Element Type: "
85 << QString::fromStdString(
87 auto* typeItem =
new TreeItem(typeData, elemItem);
88 elemItem->appendChild(typeItem);
91 QString matIdString = !mat_ids ? QString(
"not defined")
92 : QString::number((*mat_ids)[elem->
getID()]);
93 QList<QVariant> materialData;
94 materialData <<
"MaterialID: " << matIdString;
95 auto* matItem =
new TreeItem(materialData, elemItem);
96 elemItem->appendChild(matItem);
98 QList<QVariant> volData;
99 volData <<
"Area/Volume: "
101 auto* volItem =
new TreeItem(volData, elemItem);
102 elemItem->appendChild(volItem);
104 QList<QVariant> nodeListData;
105 nodeListData <<
"Nodes"
109 auto* nodeListItem =
new TreeItem(nodeListData, elemItem);
110 elemItem->appendChild(nodeListItem);
114 for (std::size_t i = 0; i < nElemNodes; i++)
117 QList<QVariant> nodeData;
118 nodeData <<
"Node " + QString::number(node->
getID())
119 << QString::number((*node)[0],
'f', 6)
120 << QString::number((*node)[1],
'f', 6)
121 << QString::number((*node)[2],
'f', 6);
122 auto* nodeItem =
new TreeItem(nodeData, nodeListItem);
123 nodeListItem->appendChild(nodeItem);
141 QList<QVariant> mesh_name;
142 mesh_name <<
"Name:" << QString::fromStdString(mesh.
getName()) <<
""
148 QList<QVariant> nodes_number;
149 nodes_number <<
"#Nodes: " << QString::number(mesh.
getNumberOfNodes()) <<
""
154 QList<QVariant> elements_number;
155 elements_number <<
"#Elements: "
161 auto const& n_element_types =
163 for (
auto entry : n_element_types)
165 QList<QVariant> number_of_element_types;
166 number_of_element_types
167 << QString::fromStdString(
171 << QString::number(entry.second) <<
""
173 auto* type_item =
new TreeItem(number_of_element_types, elements_item);
174 elements_item->appendChild(type_item);
177 QList<QVariant> bounding_box;
178 bounding_box <<
"Bounding Box"
189 QList<QVariant> min_aabb;
190 min_aabb <<
"Min:" << QString::number(min[0],
'f')
191 << QString::number(min[1],
'f') << QString::number(min[2],
'f');
192 auto* min_item =
new TreeItem(min_aabb, aabb_item);
193 aabb_item->appendChild(min_item);
195 QList<QVariant> max_aabb;
196 max_aabb <<
"Max:" << QString::number(max[0],
'f')
197 << QString::number(max[1],
'f') << QString::number(max[2],
'f');
198 auto* max_item =
new TreeItem(max_aabb, aabb_item);
199 aabb_item->appendChild(max_item);
201 QList<QVariant> edges;
202 edges <<
"Edge Length: "
211 QList<QVariant> array_info{QString::fromStdString(
name) +
": "};
Definition of the AABB class.
Definition of the ElementTreeModel class.
Definition of the Element class.
Definition of the Mesh class.
Definition of the Node class.
Definition of the TreeItem class.
VtkMappedMeshSource is a source class to transform OGS meshes into complete vtkUnstructuredGrids....
void setElement(vtkUnstructuredGridAlgorithm const *const grid, const unsigned elem_index)
Displays information of the element with the given index from the given grid.
~ElementTreeModel() override
vtkUnstructuredGridAlgorithm const * _mesh_source
void clearView()
Clears the tree.
ElementTreeModel(QObject *parent=nullptr)
void setMesh(MeshLib::Mesh const &mesh)
Displays information of the given mesh.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Eigen::Vector3d const & getMinPoint() const
Eigen::Vector3d const & getMaxPoint() const
std::size_t getID() const
virtual MeshElemType getGeomType() const =0
virtual const Node * getNode(unsigned idx) const =0
virtual double getContent() const =0
Returns the length, area or volume of a 1D, 2D or 3D element.
virtual unsigned getNumberOfBaseNodes() const =0
virtual std::size_t getID() const final
Returns the ID of the element.
double getMaxEdgeLength() const
Get the maximum edge length over all elements of the mesh.
double getMinEdgeLength() const
Get the minimum edge length over all elements of the mesh.
const std::string getName() const
Get name of the mesh.
Properties & getProperties()
std::size_t getNumberOfNodes() const
Get the number of nodes.
const Element * getElement(std::size_t idx) const
Get the element with the given index.
std::size_t getNumberOfElements() const
Get the number of elements.
Objects nodes for the TreeModel.
virtual int childCount() const
void appendChild(TreeItem *item)
bool removeChildren(int position, int count)
A hierarchical model for a tree implemented as a double-linked list.
std::string MeshElemType2String(const MeshElemType t)
Given a MeshElemType this returns the appropriate string.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.
QList< QVariant > propertyBounds(PropertyType const &property)