Skip to content

Commit 09eae54

Browse files
committed
clarify branches in field.get_meshes_fld
1 parent c53b9d2 commit 09eae54

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/stagpy/field.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,30 @@ def get_meshes_fld(
114114
or fld.values.shape[0] != step.geom.nxtot
115115
or fld.values.shape[1] != step.geom.nytot
116116
)
117-
if step.geom.threed and step.geom.cartesian:
118-
(xcoord, ycoord), vals = _threed_extract(conf, step, var, walls)
119-
elif step.geom.twod_xz:
120-
xcoord = step.geom.x_walls if hwalls else step.geom.x_centers
121-
ycoord = step.geom.z_walls if walls else step.geom.z_centers
122-
vals = fld.values[:, 0, :, 0]
123-
else: # twod_yz
124-
xcoord = step.geom.y_walls if hwalls else step.geom.y_centers
125-
ycoord = step.geom.z_walls if walls else step.geom.z_centers
126-
if step.geom.curvilinear:
117+
118+
if step.geom.curvilinear:
119+
if step.geom.twod_yz:
120+
xcoord = step.geom.y_walls if hwalls else step.geom.y_centers
121+
ycoord = step.geom.z_walls if walls else step.geom.z_centers
127122
pmesh, rmesh = np.meshgrid(xcoord, ycoord, indexing="ij")
128123
xmesh, ymesh = rmesh * np.cos(pmesh), rmesh * np.sin(pmesh)
129-
vals = fld.values[0, :, :, 0]
130-
if step.geom.cartesian:
131-
xmesh, ymesh = np.meshgrid(xcoord, ycoord, indexing="ij")
124+
vals = fld.values[0, :, :, 0]
125+
return xmesh, ymesh, vals, fld.meta
126+
else:
127+
raise NotImplementedError()
128+
129+
# cartesian
130+
if step.geom.threed:
131+
(xcoord, ycoord), vals = _threed_extract(conf, step, var, walls)
132+
else:
133+
if step.geom.twod_xz:
134+
xcoord = step.geom.x_walls if hwalls else step.geom.x_centers
135+
vals = fld.values[:, 0, :, 0]
136+
else: # twod_yz
137+
xcoord = step.geom.y_walls if hwalls else step.geom.y_centers
138+
vals = fld.values[0, :, :, 0]
139+
ycoord = step.geom.z_walls if walls else step.geom.z_centers
140+
xmesh, ymesh = np.meshgrid(xcoord, ycoord, indexing="ij")
132141
return xmesh, ymesh, vals, fld.meta
133142

134143

0 commit comments

Comments
 (0)