@@ -37,10 +37,8 @@ def __init__(self, geometry_set, bc_type=None, **kwargs):
37
37
38
38
Args
39
39
----
40
- geometry_set: GeometrySet, int
41
- Geometry that this boundary condition acts on. An integer can be
42
- given, in the case a dat file is imported. This integer is only
43
- temporary and will be replaced with the GeometrySet object.
40
+ geometry_set: GeometrySet
41
+ Geometry that this boundary condition acts on.
44
42
bc_type: mpy.bc
45
43
Type of the boundary condition.
46
44
"""
@@ -50,16 +48,13 @@ def __init__(self, geometry_set, bc_type=None, **kwargs):
50
48
self .geometry_set = geometry_set
51
49
52
50
@classmethod
53
- def from_dat (cls , bc_key , line , ** kwargs ):
51
+ def from_dict (cls , geometry_sets , bc_key , bc_dict ):
54
52
"""This function acts as a factory and creates the correct boundary
55
- condition object from a line in the dat file.
53
+ condition object from a dictionary parsed from an input file."""
56
54
57
- The geometry set is passed as integer (0 based index) and will
58
- be connected after the whole input file is parsed.
59
- """
60
-
61
- # Split up the input line.
62
- split = line .split ()
55
+ geometry_set_id = int (bc_dict ["E" ]) - 1
56
+ geometry_set = geometry_sets [geometry_set_id ]
57
+ del bc_dict ["E" ]
63
58
64
59
if bc_key in (
65
60
_mpy .bc .dirichlet ,
@@ -74,22 +69,25 @@ def from_dat(cls, bc_key, line, **kwargs):
74
69
BoundaryCondition as _BoundaryCondition ,
75
70
)
76
71
77
- return _BoundaryCondition (
78
- int ( split [ 1 ]) - 1 , " " . join ( split [ 2 :]) , bc_type = bc_key , ** kwargs
72
+ boundary_condition = _BoundaryCondition (
73
+ geometry_set , bc_dict , bc_type = bc_key
79
74
)
80
75
elif bc_key is _mpy .bc .point_coupling :
81
76
# Coupling condition.
82
77
from meshpy .core .coupling import Coupling as _Coupling
83
78
84
- return _Coupling (
85
- int ( split [ 1 ]) - 1 ,
79
+ boundary_condition = _Coupling (
80
+ geometry_set ,
86
81
bc_key ,
87
- " " . join ( split [ 2 :]) ,
82
+ bc_dict ,
88
83
check_overlapping_nodes = False ,
89
84
check_at_init = False ,
90
- ** kwargs ,
91
85
)
92
- raise ValueError ("Got unexpected boundary condition!" )
86
+ else :
87
+ raise ValueError ("Got unexpected boundary condition!" )
88
+
89
+ boundary_condition .check ()
90
+ return boundary_condition
93
91
94
92
95
93
class BoundaryConditionContainer (_ContainerBase ):
0 commit comments