### ===================================================================================================================
### FUNCTION: Collect the information of the numbers of mesh-elements
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Dict
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Function to collect the number of mesh-elements
### ===================================================================================================================
[docs]def get_element_numbers(project: ViiaProject) -> Dict[str, Dict[str, str]]:
"""
This function will generate dictionary keys for number of mesh-elements that are used in the engineering report.
Input
- project (obj): VIIA project object containing collections of fem objects and project variables.
Output
- Returns dictionary of jinja tags assigned to corresponding info.
"""
return {'elements': {
# Number of foundation mesh-elements
'Foundation': str(sum([len(fstrip.mesh.mesh_elements) for fstrip in project.collections.fstrips if fstrip.mesh])),
# Number of floor mesh-elements
'Floors': str(sum([len(floor.mesh.mesh_elements) for floor in project.collections.floors if floor.mesh])),
# Number of wall mesh-elements
'Walls': str(sum([len(wall.mesh.mesh_elements) for wall in project.collections.walls if wall.mesh])),
# Number of elements of steel beams
'Steel_structure': str(sum([
len(line.mesh.mesh_elements) for line in project.collections.lines
if line.mesh and 'STAAL' in line.material.name])),
'Timber_structure': str(sum([
len(line.mesh.mesh_elements) for line in project.collections.lines
if line.mesh and 'HOUT' in line.material.name])),
# Number of roof mesh-elements
'Roof': str(sum([len(roof.mesh.mesh_elements) for roof in project.collections.roofs if roof.mesh])),
# Number of connection mesh-elements
'Connections': str(sum([
len(conn.mesh.mesh_elements) for conn in project.collections.connections
if hasattr(conn, 'mesh') and conn.mesh])),
# Number of mesh-elements
'Total': str(len(project.collections.mesh_elements))}}
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================