Skip to content

Commit bf1583c

Browse files
Branson, Paul (Environment, IOMRC Crawley)Branson, Paul (Environment, IOMRC Crawley)
Branson, Paul (Environment, IOMRC Crawley)
authored and
Branson, Paul (Environment, IOMRC Crawley)
committed
Allow the use of SIDES object for multiple sides
1 parent 9167a86 commit bf1583c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

rompy/swan/components/boundary.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
HOTSINGLE,
1212
HOTMULTIPLE,
1313
SIDE,
14+
SIDES,
1415
SEGMENT,
1516
PAR,
1617
CONSTANTPAR,
@@ -112,20 +113,26 @@ class BOUNDSPEC(BaseComponent):
112113
default="boundspec",
113114
description="Model type discriminator",
114115
)
115-
shapespec: SHAPESPEC = Field(
116-
default_factory=SHAPESPEC,
116+
shapespec: Optional[SHAPESPEC] = Field(
117+
default=None,
117118
description="Spectral shape specification",
118119
)
119-
location: SIDE | SEGMENT = Field(
120+
location: SIDE | SEGMENT | SIDES = Field(
120121
description="Location to apply the boundary",
121122
)
122123
data: CONSTANTPAR | CONSTANTFILE | VARIABLEPAR | VARIABLEFILE = Field(
123124
description="Spectral data",
124125
)
125126

126127
def cmd(self) -> list:
127-
repr = [f"{self.shapespec.render()}"]
128-
repr += [f"BOUNDSPEC {self.location.render()}{self.data.render()}"]
128+
repr = []
129+
if self.shapespec is not None:
130+
repr += [f"{self.shapespec.render()}"]
131+
if self.location.model_type in ["side", "segment"]:
132+
repr += [f"BOUNDSPEC {self.location.render()}{self.data.render()}"]
133+
elif self.location.model_type == "sides":
134+
for side in self.location.sides:
135+
repr += [f"BOUNDSPEC {side.render()}{self.data.render()}"]
129136
return repr
130137

131138

0 commit comments

Comments
 (0)