27template <
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);
90 auto const mat_ids = materialIDs(*mesh);
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"
190 QList<QVariant> min_aabb;
191 min_aabb <<
"Min:" << QString::number(min[0],
'f')
192 << QString::number(min[1],
'f')
193 << QString::number(min[2],
'f');
194 auto* min_item =
new TreeItem(min_aabb, aabb_item);
195 aabb_item->appendChild(min_item);
197 QList<QVariant> max_aabb;
198 max_aabb <<
"Max:" << QString::number(max[0],
'f')
199 << QString::number(max[1],
'f')
200 << QString::number(max[2],
'f');
201 auto* max_item =
new TreeItem(max_aabb, aabb_item);
202 aabb_item->appendChild(max_item);
205 QList<QVariant> edges;
207 auto const [min, max] = minMaxEdgeLength(mesh.
getElements());
208 edges <<
"Edge Length: "
209 <<
"[" + QString::number(min,
'f') +
","
210 << QString::number(max,
'f') +
"]"
218 QList<QVariant> array_info{QString::fromStdString(std::string(name)) +
223 array_info.append(propertyBounds(*p));
228 array_info.append(propertyBounds(*p));
232 array_info.append(propertyBounds(*p));
237 array_info.append(propertyBounds(*p));
242 array_info.append(propertyBounds(*p));
247 array_info.append(propertyBounds(*p));
252 array_info.append(propertyBounds(*p));
258 array_info.append(propertyBounds(*p));
263 array_info.append(propertyBounds(*p));
268 array_info.append(propertyBounds(*p));
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 ...
MinMaxPoints getMinMaxPoints() const
std::size_t getID() const
virtual MeshElemType getGeomType() 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 const Node * getNode(unsigned idx) const =0
std::size_t getID() const
Returns the ID of the element.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
const Element * getElement(std::size_t idx) const
Get the element with the given index.
const std::string getName() const
Get name of the mesh.
std::size_t getNumberOfNodes() const
Get the number of nodes.
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.
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.
QList< QVariant > propertyBounds(PropertyType const &property)