Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the boundary points #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this binary file, we should not include unrelated file in a PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will remove them.

Binary file not shown.
Binary file added cpp/.DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Binary file not shown.
Binary file added modmesh/.DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Binary file not shown.
21 changes: 12 additions & 9 deletions modmesh/app/euler1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ def build_grid_figure(self):

:return: FigureCanvas
"""
x = self.st.svr.coord[::2]
pt_mid = np.linspace(2,len(self.st.svr.coord) - 3,num=((len(self.st.svr.coord) - 3) // 2),dtype=int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code appears many times, would you like to optimize it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think I can do it.

x = self.st.svr.coord[pt_mid]
fig = Figure()
canvas = FigureCanvas(fig)
ax = canvas.figure.subplots(3, 2)
Expand Down Expand Up @@ -574,7 +575,8 @@ def build_single_figure(self):

:return: FigureCanvas
"""
x = self.st.svr.coord[::2]
pt_mid = np.linspace(2,len(self.st.svr.coord) - 3,num=((len(self.st.svr.coord) - 3) // 2),dtype=int)
x = self.st.svr.coord[pt_mid]
fig = Figure()
canvas = FigureCanvas(fig)
ax = canvas.figure.subplots()
Expand Down Expand Up @@ -739,25 +741,26 @@ def update_lines(self):

:return: None
"""
pt_mid = np.linspace(2,len(self.st.svr.coord) - 3,num=((len(self.st.svr.coord) - 3) // 2),dtype=int)
if self.use_grid_layout:
self.density.update(adata=self.st.density_field,
ndata=self.st.svr.density[::2])
ndata=self.st.svr.density[pt_mid])
self.pressure.update(adata=self.st.pressure_field,
ndata=self.st.svr.pressure[::2])
ndata=self.st.svr.pressure[pt_mid])
self.velocity.update(adata=self.st.velocity_field,
ndata=self.st.svr.velocity[::2])
ndata=self.st.svr.velocity[pt_mid])
self.temperature.update(adata=self.st.temperature_field,
ndata=self.st.svr.temperature[::2])
ndata=self.st.svr.temperature[pt_mid])
self.internal_energy.update(adata=(self.st.internal_energy_field),
ndata=(self.st.svr.
internal_energy[::2]))
internal_energy[pt_mid]))
self.entropy.update(adata=self.st.entropy_field,
ndata=self.st.svr.entropy[::2])
ndata=self.st.svr.entropy[pt_mid])
else:
for name, is_selected, *_ in self.plot_config.state:
if is_selected:
eval(f'(self.{name}.update(adata=self.st.{name}_field,'
f' ndata=self.st.svr.{name}[::2]))')
f' ndata=self.st.svr.{name}[pt_mid]))')


class PlotArea(PuiInQt):
Expand Down
3 changes: 2 additions & 1 deletion modmesh/onedim/euler1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ def build_field(self, t, coord=None):
:return: None
"""
if None is coord:
coord = self.svr.coord[::2] # Use the numerical solver.
pt_mid = np.linspace(2,len(self.svr.coord) - 3,num=((len(self.svr.coord) - 3) // 2),dtype=int)
coord = self.svr.coord[pt_mid] # Use the numerical solver.
self.coord = coord.copy() # Make a copy; no write back to argument.

# Determine the zone location and the Boolean selection arrays.
Expand Down
Loading