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

19 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-09-29 11:30 +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.four_c.element_volume import SolidRigidSphere as _SolidRigidSphere 

47from beamme.four_c.four_c_types import BeamType as _BeamType 

48 

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

50INPUT_FILE_MAPPINGS["beam_types"] = { 

51 _BeamType.reissner: "BEAM3R", 

52 _BeamType.kirchhoff: "BEAM3K", 

53 _BeamType.euler_bernoulli: "BEAM3EB", 

54} 

55INPUT_FILE_MAPPINGS["boundary_conditions"] = { 

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

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

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

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

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

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

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

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

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

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

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

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

68 ( 

69 _bme.bc.moment_euler_bernoulli, 

70 _bme.geo.point, 

71 ): "DESIGN POINT MOMENT EB CONDITIONS", 

72 ( 

73 _bme.bc.beam_to_solid_volume_meshtying, 

74 _bme.geo.line, 

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

76 ( 

77 _bme.bc.beam_to_solid_volume_meshtying, 

78 _bme.geo.volume, 

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

80 ( 

81 _bme.bc.beam_to_solid_surface_meshtying, 

82 _bme.geo.line, 

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

84 ( 

85 _bme.bc.beam_to_solid_surface_meshtying, 

86 _bme.geo.surface, 

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

88 ( 

89 _bme.bc.beam_to_solid_surface_contact, 

90 _bme.geo.line, 

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

92 ( 

93 _bme.bc.beam_to_solid_surface_contact, 

94 _bme.geo.surface, 

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

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

97 ( 

98 _bme.bc.beam_to_beam_contact, 

99 _bme.geo.line, 

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

101 ( 

102 _bme.bc.point_coupling_penalty, 

103 _bme.geo.point, 

104 ): "DESIGN POINT PENALTY COUPLING CONDITIONS", 

105 ( 

106 "DESIGN SURF MORTAR CONTACT CONDITIONS 3D", 

107 _bme.geo.surface, 

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

109} 

110INPUT_FILE_MAPPINGS["element_type_to_four_c_string"] = { 

111 _VolumeHEX8: "HEX8", 

112 _VolumeHEX20: "HEX20", 

113 _VolumeHEX27: "HEX27", 

114 _VolumeTET4: "TET4", 

115 _VolumeTET10: "TET10", 

116 _VolumeWEDGE6: "WEDGE6", 

117 _SolidRigidSphere: "POINT1", 

118} 

119INPUT_FILE_MAPPINGS["element_four_c_string_to_type"] = { 

120 value: key 

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

122} 

123INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_condition_name"] = { 

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

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

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

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

128} 

129INPUT_FILE_MAPPINGS["geometry_sets_geometry_to_entry_name"] = { 

130 _bme.geo.point: "DNODE", 

131 _bme.geo.line: "DLINE", 

132 _bme.geo.surface: "DSURFACE", 

133 _bme.geo.volume: "DVOL", 

134} 

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

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