beamme.four_c.input_file_mappings
This file provides the mappings between BeamMe objects and 4C input files.
1# The MIT License (MIT) 2# 3# Copyright (c) 2018-2026 BeamMe Authors 4# 5# Permission is hereby granted, free of charge, to any person obtaining a copy 6# of this software and associated documentation files (the "Software"), to deal 7# in the Software without restriction, including without limitation the rights 8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9# copies of the Software, and to permit persons to whom the Software is 10# furnished to do so, subject to the following conditions: 11# 12# The above copyright notice and this permission notice shall be included in 13# all copies or substantial portions of the Software. 14# 15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21# THE SOFTWARE. 22"""This file provides the mappings between BeamMe objects and 4C input 23files.""" 24 25from typing import Any as _Any 26 27import pyvista as _pv 28 29from beamme.core.conf import bme as _bme 30from beamme.core.mesh_representation import ( 31 MESH_REPRESENTATION_MAPPINGS as _MESH_REPRESENTATION_MAPPINGS, 32) 33from beamme.four_c.four_c_types import BeamType as _BeamType 34from beamme.utils.data_structures import ( 35 create_inverse_mapping as _create_inverse_mapping, 36) 37 38INPUT_FILE_MAPPINGS: dict[str, _Any] = {} 39INPUT_FILE_MAPPINGS["four_c_type_to_four_c_type"] = { 40 _BeamType.reissner: "BEAM3R", 41 _BeamType.kirchhoff: "BEAM3K", 42 _BeamType.euler_bernoulli: "BEAM3EB", 43} 44INPUT_FILE_MAPPINGS["four_c_type_to_requires_triads"] = { 45 "BEAM3R": True, 46 "BEAM3K": True, 47 "BEAM3EB": False, 48} 49INPUT_FILE_MAPPINGS["element_type_and_n_nodes_to_four_c_cell"] = { 50 (_bme.element_type.beam, 2): "LINE2", 51 (_bme.element_type.beam, 3): "LINE3", 52 (_bme.element_type.beam, 4): "LINE4", 53 (_bme.element_type.beam, 5): "LINE5", 54 (_bme.element_type.nurbs, 9): "NURBS9", 55 (_bme.element_type.nurbs, 27): "NURBS27", 56 (_bme.element_type.solid, 8): "HEX8", 57 (_bme.element_type.solid, 20): "HEX20", 58 (_bme.element_type.solid, 27): "HEX27", 59 (_bme.element_type.solid, 4): "TET4", 60 (_bme.element_type.solid, 10): "TET10", 61 (_bme.element_type.solid, 6): "WEDGE6", 62 (_bme.element_type.solid, 1): "POINT1", 63} 64INPUT_FILE_MAPPINGS["four_c_cell_to_element_type_and_n_nodes"] = ( 65 _create_inverse_mapping( 66 INPUT_FILE_MAPPINGS["element_type_and_n_nodes_to_four_c_cell"] 67 ) 68) 69INPUT_FILE_MAPPINGS["four_c_cell_to_vtk_cell_type"] = { 70 "POINT1": _pv.CellType.VERTEX, 71 "HEX8": _pv.CellType.HEXAHEDRON, 72 "TET4": _pv.CellType.TETRA, 73 "TET10": _pv.CellType.QUADRATIC_TETRA, 74 "HEX20": _pv.CellType.QUADRATIC_HEXAHEDRON, 75 "HEX27": _pv.CellType.TRIQUADRATIC_HEXAHEDRON, 76 "WEDGE6": _pv.CellType.WEDGE, 77} 78INPUT_FILE_MAPPINGS["four_c_cell_to_vtk_connectivity_mapping"] = { 79 # Only list the non-standard mappings 80 "HEX20": _MESH_REPRESENTATION_MAPPINGS[ 81 "element_type_and_n_nodes_to_connectivity_mapping_vtk_to_beamme" 82 ][(_bme.element_type.solid, 20)], 83 "HEX27": _MESH_REPRESENTATION_MAPPINGS[ 84 "element_type_and_n_nodes_to_connectivity_mapping_vtk_to_beamme" 85 ][(_bme.element_type.solid, 27)], 86} 87INPUT_FILE_MAPPINGS["four_c_cell_to_connectivity_mapping_from_vtk"] = { 88 # Only list the non-standard mappings 89 "LINE3": [0, 2, 1], 90 "LINE4": [0, 3, 1, 2], 91 "LINE5": [0, 4, 1, 2, 3], 92 "HEX20": _MESH_REPRESENTATION_MAPPINGS[ 93 "element_type_and_n_nodes_to_connectivity_mapping_beamme_to_vtk" 94 ][(_bme.element_type.solid, 20)], 95 "HEX27": _MESH_REPRESENTATION_MAPPINGS[ 96 "element_type_and_n_nodes_to_connectivity_mapping_beamme_to_vtk" 97 ][(_bme.element_type.solid, 27)], 98} 99INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_entry_name"] = { 100 _bme.geo.point: "DNODE", 101 _bme.geo.line: "DLINE", 102 _bme.geo.surface: "DSURFACE", 103 _bme.geo.volume: "DVOL", 104} 105INPUT_FILE_MAPPINGS["boundary_conditions"] = { 106 (_bme.bc.dirichlet, _bme.geo.point): "DESIGN POINT DIRICH CONDITIONS", 107 (_bme.bc.dirichlet, _bme.geo.line): "DESIGN LINE DIRICH CONDITIONS", 108 (_bme.bc.dirichlet, _bme.geo.surface): "DESIGN SURF DIRICH CONDITIONS", 109 (_bme.bc.dirichlet, _bme.geo.volume): "DESIGN VOL DIRICH CONDITIONS", 110 (_bme.bc.locsys, _bme.geo.point): "DESIGN POINT LOCSYS CONDITIONS", 111 (_bme.bc.locsys, _bme.geo.line): "DESIGN LINE LOCSYS CONDITIONS", 112 (_bme.bc.locsys, _bme.geo.surface): "DESIGN SURF LOCSYS CONDITIONS", 113 (_bme.bc.locsys, _bme.geo.volume): "DESIGN VOL LOCSYS CONDITIONS", 114 (_bme.bc.neumann, _bme.geo.point): "DESIGN POINT NEUMANN CONDITIONS", 115 (_bme.bc.neumann, _bme.geo.line): "DESIGN LINE NEUMANN CONDITIONS", 116 (_bme.bc.neumann, _bme.geo.surface): "DESIGN SURF NEUMANN CONDITIONS", 117 (_bme.bc.neumann, _bme.geo.volume): "DESIGN VOL NEUMANN CONDITIONS", 118 ( 119 _bme.bc.moment_euler_bernoulli, 120 _bme.geo.point, 121 ): "DESIGN POINT MOMENT EB CONDITIONS", 122 ( 123 _bme.bc.beam_to_solid_volume_meshtying, 124 _bme.geo.line, 125 ): "BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING LINE", 126 ( 127 _bme.bc.beam_to_solid_volume_meshtying, 128 _bme.geo.volume, 129 ): "BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING VOLUME", 130 ( 131 _bme.bc.beam_to_solid_surface_meshtying, 132 _bme.geo.line, 133 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING LINE", 134 ( 135 _bme.bc.beam_to_solid_surface_meshtying, 136 _bme.geo.surface, 137 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING SURFACE", 138 ( 139 _bme.bc.beam_to_solid_surface_contact, 140 _bme.geo.line, 141 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT LINE", 142 ( 143 _bme.bc.beam_to_solid_surface_contact, 144 _bme.geo.surface, 145 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT SURFACE", 146 (_bme.bc.point_coupling, _bme.geo.point): "DESIGN POINT COUPLING CONDITIONS", 147 ( 148 _bme.bc.beam_to_beam_contact, 149 _bme.geo.line, 150 ): "BEAM INTERACTION/BEAM TO BEAM CONTACT CONDITIONS", 151 ( 152 _bme.bc.point_coupling_penalty, 153 _bme.geo.point, 154 ): "DESIGN POINT PENALTY COUPLING CONDITIONS", 155 ( 156 _bme.bc.point_coupling_indirect, 157 _bme.geo.line, 158 ): "BEAM INTERACTION/BEAM TO BEAM POINT COUPLING CONDITIONS", 159 ( 160 "DESIGN SURF MORTAR CONTACT CONDITIONS 3D", 161 _bme.geo.surface, 162 ): "DESIGN SURF MORTAR CONTACT CONDITIONS 3D", 163} 164INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_condition_name"] = { 165 _bme.geo.point: "DNODE-NODE TOPOLOGY", 166 _bme.geo.line: "DLINE-NODE TOPOLOGY", 167 _bme.geo.surface: "DSURF-NODE TOPOLOGY", 168 _bme.geo.volume: "DVOL-NODE TOPOLOGY", 169} 170INPUT_FILE_MAPPINGS["geometry_sets_condition_to_geometry_name"] = ( 171 _create_inverse_mapping( 172 INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_condition_name"] 173 ) 174) 175INPUT_FILE_MAPPINGS["four_c_node_type_to_beamme_node_type"] = { 176 "NODE": _bme.node_type.node, 177 "CP": _bme.node_type.control_point, 178}
INPUT_FILE_MAPPINGS: dict[str, typing.Any] =
{'four_c_type_to_four_c_type': {<BeamType.reissner: 1>: 'BEAM3R', <BeamType.kirchhoff: 2>: 'BEAM3K', <BeamType.euler_bernoulli: 3>: 'BEAM3EB'}, 'four_c_type_to_requires_triads': {'BEAM3R': True, 'BEAM3K': True, 'BEAM3EB': False}, 'element_type_and_n_nodes_to_four_c_cell': {(<ElementType.beam: 1>, 2): 'LINE2', (<ElementType.beam: 1>, 3): 'LINE3', (<ElementType.beam: 1>, 4): 'LINE4', (<ElementType.beam: 1>, 5): 'LINE5', (<ElementType.nurbs: 2>, 9): 'NURBS9', (<ElementType.nurbs: 2>, 27): 'NURBS27', (<ElementType.solid: 3>, 8): 'HEX8', (<ElementType.solid: 3>, 20): 'HEX20', (<ElementType.solid: 3>, 27): 'HEX27', (<ElementType.solid: 3>, 4): 'TET4', (<ElementType.solid: 3>, 10): 'TET10', (<ElementType.solid: 3>, 6): 'WEDGE6', (<ElementType.solid: 3>, 1): 'POINT1'}, 'four_c_cell_to_element_type_and_n_nodes': {'LINE2': (<ElementType.beam: 1>, 2), 'LINE3': (<ElementType.beam: 1>, 3), 'LINE4': (<ElementType.beam: 1>, 4), 'LINE5': (<ElementType.beam: 1>, 5), 'NURBS9': (<ElementType.nurbs: 2>, 9), 'NURBS27': (<ElementType.nurbs: 2>, 27), 'HEX8': (<ElementType.solid: 3>, 8), 'HEX20': (<ElementType.solid: 3>, 20), 'HEX27': (<ElementType.solid: 3>, 27), 'TET4': (<ElementType.solid: 3>, 4), 'TET10': (<ElementType.solid: 3>, 10), 'WEDGE6': (<ElementType.solid: 3>, 6), 'POINT1': (<ElementType.solid: 3>, 1)}, 'four_c_cell_to_vtk_cell_type': {'POINT1': <CellType.VERTEX: 1>, 'HEX8': <CellType.HEXAHEDRON: 12>, 'TET4': <CellType.TETRA: 10>, 'TET10': <CellType.QUADRATIC_TETRA: 24>, 'HEX20': <CellType.QUADRATIC_HEXAHEDRON: 25>, 'HEX27': <CellType.TRIQUADRATIC_HEXAHEDRON: 29>, 'WEDGE6': <CellType.WEDGE: 13>}, 'four_c_cell_to_vtk_connectivity_mapping': {'HEX20': array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12,
13, 14, 15]), 'HEX27': array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12,
13, 14, 15, 24, 22, 21, 23, 20, 25, 26])}, 'four_c_cell_to_connectivity_mapping_from_vtk': {'LINE3': [0, 2, 1], 'LINE4': [0, 3, 1, 2], 'LINE5': [0, 4, 1, 2, 3], 'HEX20': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12, 13, 14, 15], 'HEX27': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12, 13, 14, 15, 24, 22, 21, 23, 20, 25, 26]}, 'geometry_sets_geometry_to_entry_name': {<Geometry.point: 1>: 'DNODE', <Geometry.line: 2>: 'DLINE', <Geometry.surface: 3>: 'DSURFACE', <Geometry.volume: 4>: 'DVOL'}, 'boundary_conditions': {(<BoundaryCondition.dirichlet: 1>, <Geometry.point: 1>): 'DESIGN POINT DIRICH CONDITIONS', (<BoundaryCondition.dirichlet: 1>, <Geometry.line: 2>): 'DESIGN LINE DIRICH CONDITIONS', (<BoundaryCondition.dirichlet: 1>, <Geometry.surface: 3>): 'DESIGN SURF DIRICH CONDITIONS', (<BoundaryCondition.dirichlet: 1>, <Geometry.volume: 4>): 'DESIGN VOL DIRICH CONDITIONS', (<BoundaryCondition.locsys: 3>, <Geometry.point: 1>): 'DESIGN POINT LOCSYS CONDITIONS', (<BoundaryCondition.locsys: 3>, <Geometry.line: 2>): 'DESIGN LINE LOCSYS CONDITIONS', (<BoundaryCondition.locsys: 3>, <Geometry.surface: 3>): 'DESIGN SURF LOCSYS CONDITIONS', (<BoundaryCondition.locsys: 3>, <Geometry.volume: 4>): 'DESIGN VOL LOCSYS CONDITIONS', (<BoundaryCondition.neumann: 2>, <Geometry.point: 1>): 'DESIGN POINT NEUMANN CONDITIONS', (<BoundaryCondition.neumann: 2>, <Geometry.line: 2>): 'DESIGN LINE NEUMANN CONDITIONS', (<BoundaryCondition.neumann: 2>, <Geometry.surface: 3>): 'DESIGN SURF NEUMANN CONDITIONS', (<BoundaryCondition.neumann: 2>, <Geometry.volume: 4>): 'DESIGN VOL NEUMANN CONDITIONS', (<BoundaryCondition.moment_euler_bernoulli: 4>, <Geometry.point: 1>): 'DESIGN POINT MOMENT EB CONDITIONS', (<BoundaryCondition.beam_to_solid_volume_meshtying: 6>, <Geometry.line: 2>): 'BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING LINE', (<BoundaryCondition.beam_to_solid_volume_meshtying: 6>, <Geometry.volume: 4>): 'BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING VOLUME', (<BoundaryCondition.beam_to_solid_surface_meshtying: 7>, <Geometry.line: 2>): 'BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING LINE', (<BoundaryCondition.beam_to_solid_surface_meshtying: 7>, <Geometry.surface: 3>): 'BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING SURFACE', (<BoundaryCondition.beam_to_solid_surface_contact: 8>, <Geometry.line: 2>): 'BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT LINE', (<BoundaryCondition.beam_to_solid_surface_contact: 8>, <Geometry.surface: 3>): 'BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT SURFACE', (<BoundaryCondition.point_coupling: 9>, <Geometry.point: 1>): 'DESIGN POINT COUPLING CONDITIONS', (<BoundaryCondition.beam_to_beam_contact: 5>, <Geometry.line: 2>): 'BEAM INTERACTION/BEAM TO BEAM CONTACT CONDITIONS', (<BoundaryCondition.point_coupling_penalty: 10>, <Geometry.point: 1>): 'DESIGN POINT PENALTY COUPLING CONDITIONS', (<BoundaryCondition.point_coupling_indirect: 11>, <Geometry.line: 2>): 'BEAM INTERACTION/BEAM TO BEAM POINT COUPLING CONDITIONS', ('DESIGN SURF MORTAR CONTACT CONDITIONS 3D', <Geometry.surface: 3>): 'DESIGN SURF MORTAR CONTACT CONDITIONS 3D'}, 'geometry_sets_geometry_to_condition_name': {<Geometry.point: 1>: 'DNODE-NODE TOPOLOGY', <Geometry.line: 2>: 'DLINE-NODE TOPOLOGY', <Geometry.surface: 3>: 'DSURF-NODE TOPOLOGY', <Geometry.volume: 4>: 'DVOL-NODE TOPOLOGY'}, 'geometry_sets_condition_to_geometry_name': {'DNODE-NODE TOPOLOGY': <Geometry.point: 1>, 'DLINE-NODE TOPOLOGY': <Geometry.line: 2>, 'DSURF-NODE TOPOLOGY': <Geometry.surface: 3>, 'DVOL-NODE TOPOLOGY': <Geometry.volume: 4>}, 'four_c_node_type_to_beamme_node_type': {'NODE': <NodeType.node: 1>, 'CP': <NodeType.control_point: 3>}}