Skip to content

Commit 5c4cabe

Browse files
committed
Revert "Patch for badly defined ls-dyna fields (forces norm when several components are reported."
This reverts commit 267721d.
1 parent 267721d commit 5c4cabe

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/ansys/dpf/core/plotter.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,11 @@ def add_field(
275275
mesh_location = meshed_region.elements
276276
else:
277277
raise ValueError("Only elemental, nodal or faces location are supported for plotting.")
278-
if field.component_count > 1:
279-
# Take the norm
280-
field = dpf.core.operators.math.norm(field=field, server=field._server).eval()
281-
# Patch for badly defined ls-dyna fields
282-
field = dpf.core.operators.logic.elementary_data_selector(
283-
field=field,
284-
elementary_data_index=0,
285-
server=field._server,
286-
).eval()
287-
overall_data = np.full(len(mesh_location), np.nan)
278+
component_count = field.component_count
279+
if component_count > 1:
280+
overall_data = np.full((len(mesh_location), component_count), np.nan)
281+
else:
282+
overall_data = np.full(len(mesh_location), np.nan)
288283
if location != locations.overall:
289284
ind, mask = mesh_location.map_scoping(field.scoping)
290285
overall_data[ind] = field.data[mask]
@@ -943,17 +938,9 @@ def plot_contour(
943938

944939
# Merge field data into a single array
945940
if component_count > 1:
946-
fields_container = dpf.core.operators.math.norm_fc(
947-
fields_container=fields_container, server=fields_container._server
948-
).eval()
949-
# Patch for badly defined ls-dyna fields
950-
fields_container = dpf.core.operators.logic.elementary_data_selector_fc(
951-
fields_container=fields_container,
952-
elementary_data_index=0,
953-
server=fields_container._server,
954-
).eval()
955-
956-
overall_data = np.full(len(mesh_location), np.nan)
941+
overall_data = np.full((len(mesh_location), component_count), np.nan)
942+
else:
943+
overall_data = np.full(len(mesh_location), np.nan)
957944

958945
for field in fields_container:
959946
ind, mask = mesh_location.map_scoping(field.scoping)

0 commit comments

Comments
 (0)