Skip to content

Commit

Permalink
docs(FiniteElementAnalysis): fix file chunk handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Sep 29, 2022
1 parent 76e6c8b commit 7790cd1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Expand Up @@ -62,6 +62,12 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
nodes_bytes = nodes_file.get("content")
elems_bytes = elems_file.get("content")

if isinstance(nodes_bytes, list):
nodes_bytes = b"".join(nodes_bytes)

if isinstance(elems_bytes, list):
elems_bytes = b"".join(elems_bytes)

df_nodes = pd.read_csv(
io.StringIO(nodes_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down Expand Up @@ -148,6 +154,8 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
# Add field if any
if field_file:
field_bytes = field_file.get("content")
if isinstance(field_bytes, list):
field_bytes = b"".join(field_bytes)
df_elem_data = pd.read_csv(
io.StringIO(field_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down
Expand Up @@ -86,6 +86,12 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
nodes_bytes = nodes_file.get("content")
elems_bytes = elems_file.get("content")

if isinstance(nodes_bytes, list):
nodes_bytes = b"".join(nodes_bytes)

if isinstance(elems_bytes, list):
elems_bytes = b"".join(elems_bytes)

df_nodes = pd.read_csv(
io.StringIO(nodes_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down Expand Up @@ -173,6 +179,8 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
# Add field if any
if field_file:
field_bytes = field_file.get("content")
if isinstance(field_bytes, list):
field_bytes = b"".join(field_bytes)
df_elem_data = pd.read_csv(
io.StringIO(field_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down Expand Up @@ -252,7 +260,7 @@ def reset():
"style": "max-width: 200px",
"class": "mx-2",
"small_chips": True,
"clearable": ("false",),
"clearable": False,
"accept": ".txt",
}

Expand Down
Expand Up @@ -85,6 +85,12 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
nodes_bytes = nodes_file.get("content")
elems_bytes = elems_file.get("content")

if isinstance(nodes_bytes, list):
nodes_bytes = b"".join(nodes_bytes)

if isinstance(elems_bytes, list):
elems_bytes = b"".join(elems_bytes)

df_nodes = pd.read_csv(
io.StringIO(nodes_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down Expand Up @@ -172,6 +178,8 @@ def update_grid(nodes_file, elems_file, field_file, **kwargs):
# Add field if any
if field_file:
field_bytes = field_file.get("content")
if isinstance(field_bytes, list):
field_bytes = b"".join(field_bytes)
df_elem_data = pd.read_csv(
io.StringIO(field_bytes.decode("utf-8")),
delim_whitespace=True,
Expand Down Expand Up @@ -236,6 +244,7 @@ def update_mesh_representations(**kwargs):
property.SetRepresentation(representation)
property.SetColor(color)
property.SetOpacity(opacity)
property.SetLineWidth(2)
ctrl.view_update()


Expand Down Expand Up @@ -322,7 +331,9 @@ def reset():
classes="pa-0 fill-height",
style="position: relative",
):
html_view = vtk.VtkRemoteView(renderWindow, interactive_ratio=("1",))
html_view = vtk.VtkRemoteView(
renderWindow, interactive_ratio=("1",), interactive_quality=(80,)
)
ctrl.view_update = html_view.update
ctrl.view_reset_camera = html_view.reset_camera

Expand Down

0 comments on commit 7790cd1

Please sign in to comment.