Coverage for src / beamme / four_c / input_file_mappings.py: 100%

23 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-11-21 12:57 +0000

1# The MIT License (MIT) 

2# 

3# Copyright (c) 2018-2025 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 

27from beamme.core.conf import bme as _bme 

28from beamme.core.element_volume import ( 

29 VolumeHEX8 as _VolumeHEX8, 

30) 

31from beamme.core.element_volume import ( 

32 VolumeHEX20 as _VolumeHEX20, 

33) 

34from beamme.core.element_volume import ( 

35 VolumeHEX27 as _VolumeHEX27, 

36) 

37from beamme.core.element_volume import ( 

38 VolumeTET4 as _VolumeTET4, 

39) 

40from beamme.core.element_volume import ( 

41 VolumeTET10 as _VolumeTET10, 

42) 

43from beamme.core.element_volume import ( 

44 VolumeWEDGE6 as _VolumeWEDGE6, 

45) 

46from beamme.core.nurbs_patch import NURBSSurface as _NURBSSurface 

47from beamme.core.nurbs_patch import NURBSVolume as _NURBSVolume 

48from beamme.four_c.element_volume import SolidRigidSphere as _SolidRigidSphere 

49from beamme.four_c.four_c_types import BeamType as _BeamType 

50 

51INPUT_FILE_MAPPINGS: dict[str, _Any] = {} 

52INPUT_FILE_MAPPINGS["beam_types"] = { 

53 _BeamType.reissner: "BEAM3R", 

54 _BeamType.kirchhoff: "BEAM3K", 

55 _BeamType.euler_bernoulli: "BEAM3EB", 

56} 

57INPUT_FILE_MAPPINGS["boundary_conditions"] = { 

58 (_bme.bc.dirichlet, _bme.geo.point): "DESIGN POINT DIRICH CONDITIONS", 

59 (_bme.bc.dirichlet, _bme.geo.line): "DESIGN LINE DIRICH CONDITIONS", 

60 (_bme.bc.dirichlet, _bme.geo.surface): "DESIGN SURF DIRICH CONDITIONS", 

61 (_bme.bc.dirichlet, _bme.geo.volume): "DESIGN VOL DIRICH CONDITIONS", 

62 (_bme.bc.locsys, _bme.geo.point): "DESIGN POINT LOCSYS CONDITIONS", 

63 (_bme.bc.locsys, _bme.geo.line): "DESIGN LINE LOCSYS CONDITIONS", 

64 (_bme.bc.locsys, _bme.geo.surface): "DESIGN SURF LOCSYS CONDITIONS", 

65 (_bme.bc.locsys, _bme.geo.volume): "DESIGN VOL LOCSYS CONDITIONS", 

66 (_bme.bc.neumann, _bme.geo.point): "DESIGN POINT NEUMANN CONDITIONS", 

67 (_bme.bc.neumann, _bme.geo.line): "DESIGN LINE NEUMANN CONDITIONS", 

68 (_bme.bc.neumann, _bme.geo.surface): "DESIGN SURF NEUMANN CONDITIONS", 

69 (_bme.bc.neumann, _bme.geo.volume): "DESIGN VOL NEUMANN CONDITIONS", 

70 ( 

71 _bme.bc.moment_euler_bernoulli, 

72 _bme.geo.point, 

73 ): "DESIGN POINT MOMENT EB CONDITIONS", 

74 ( 

75 _bme.bc.beam_to_solid_volume_meshtying, 

76 _bme.geo.line, 

77 ): "BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING LINE", 

78 ( 

79 _bme.bc.beam_to_solid_volume_meshtying, 

80 _bme.geo.volume, 

81 ): "BEAM INTERACTION/BEAM TO SOLID VOLUME MESHTYING VOLUME", 

82 ( 

83 _bme.bc.beam_to_solid_surface_meshtying, 

84 _bme.geo.line, 

85 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING LINE", 

86 ( 

87 _bme.bc.beam_to_solid_surface_meshtying, 

88 _bme.geo.surface, 

89 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE MESHTYING SURFACE", 

90 ( 

91 _bme.bc.beam_to_solid_surface_contact, 

92 _bme.geo.line, 

93 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT LINE", 

94 ( 

95 _bme.bc.beam_to_solid_surface_contact, 

96 _bme.geo.surface, 

97 ): "BEAM INTERACTION/BEAM TO SOLID SURFACE CONTACT SURFACE", 

98 (_bme.bc.point_coupling, _bme.geo.point): "DESIGN POINT COUPLING CONDITIONS", 

99 ( 

100 _bme.bc.beam_to_beam_contact, 

101 _bme.geo.line, 

102 ): "BEAM INTERACTION/BEAM TO BEAM CONTACT CONDITIONS", 

103 ( 

104 _bme.bc.point_coupling_penalty, 

105 _bme.geo.point, 

106 ): "DESIGN POINT PENALTY COUPLING CONDITIONS", 

107 ( 

108 _bme.bc.point_coupling_indirect, 

109 _bme.geo.line, 

110 ): "BEAM INTERACTION/BEAM TO BEAM POINT COUPLING CONDITIONS", 

111 ( 

112 "DESIGN SURF MORTAR CONTACT CONDITIONS 3D", 

113 _bme.geo.surface, 

114 ): "DESIGN SURF MORTAR CONTACT CONDITIONS 3D", 

115} 

116INPUT_FILE_MAPPINGS["element_type_to_four_c_string"] = { 

117 _VolumeHEX8: "HEX8", 

118 _VolumeHEX20: "HEX20", 

119 _VolumeHEX27: "HEX27", 

120 _VolumeTET4: "TET4", 

121 _VolumeTET10: "TET10", 

122 _VolumeWEDGE6: "WEDGE6", 

123 _SolidRigidSphere: "POINT1", 

124} 

125INPUT_FILE_MAPPINGS["element_four_c_string_to_type"] = { 

126 value: key 

127 for key, value in INPUT_FILE_MAPPINGS["element_type_to_four_c_string"].items() 

128} 

129INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_condition_name"] = { 

130 _bme.geo.point: "DNODE-NODE TOPOLOGY", 

131 _bme.geo.line: "DLINE-NODE TOPOLOGY", 

132 _bme.geo.surface: "DSURF-NODE TOPOLOGY", 

133 _bme.geo.volume: "DVOL-NODE TOPOLOGY", 

134} 

135INPUT_FILE_MAPPINGS["geometry_sets_condition_to_geometry_name"] = { 

136 value: key 

137 for key, value in INPUT_FILE_MAPPINGS[ 

138 "geometry_sets_geometry_to_condition_name" 

139 ].items() 

140} 

141INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_entry_name"] = { 

142 _bme.geo.point: "DNODE", 

143 _bme.geo.line: "DLINE", 

144 _bme.geo.surface: "DSURFACE", 

145 _bme.geo.volume: "DVOL", 

146} 

147INPUT_FILE_MAPPINGS["n_nodes_to_cell_type"] = {2: "LINE2", 3: "LINE3"} 

148INPUT_FILE_MAPPINGS["n_nodes_to_node_ordering"] = {2: [0, 1], 3: [0, 2, 1]} 

149INPUT_FILE_MAPPINGS["nurbs_type_to_default_four_c_type"] = { 

150 _NURBSSurface: "WALLNURBS", 

151 _NURBSVolume: "SOLID", 

152}