### ===================================================================================================================
### viia_find_linear_interface_elements
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Function to get the linear-modelled building elements
### ===================================================================================================================
[docs]def viia_find_linear_interface_elements(project: ViiaProject):
""" This function is used to find linear interface elements."""
linear_interface_elem_0d, linear_interface_nod_0d, linear_interface_elem_1d, linear_interface_nod_1d, \
linear_interface_elem_2d, linear_interface_nod_2d = [], [], [], [], [], []
for connection in project.collections.connections:
if (material := getattr(connection, 'material', None)) is not None:
if material.is_linear:
connection_type = connection.connection_type
if connection_type in ['point', 'point-point']:
linear_interface_elem_0d.extend(connection.mesh.mesh_elements)
linear_interface_nod_0d.extend(connection.mesh.get_meshnodes())
elif connection_type in ['line', 'line-line']:
linear_interface_elem_1d.extend(connection.mesh.mesh_elements)
linear_interface_nod_1d.extend(connection.mesh.get_meshnodes())
elif connection_type in ['surface', 'surface-surface']:
linear_interface_elem_2d.extend(connection.mesh.mesh_elements)
linear_interface_nod_2d.extend(connection.mesh.get_meshnodes())
return linear_interface_elem_0d, linear_interface_nod_0d, linear_interface_elem_1d, linear_interface_nod_1d, \
linear_interface_elem_2d, linear_interface_nod_2d
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================