forked from devitocodes/devito
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from xdslproject/bench_edits-2
mpi: Init effort for serial modelling on wave operator
- Loading branch information
Showing
18 changed files
with
742 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from examples.seismic import plot_image | ||
|
||
__all__ = ['plot_2dfunc', 'plot_3dfunc'] | ||
|
||
|
||
def plot_2dfunc(u): | ||
# Plot a 2D image using devito's machinery | ||
plot_image(u.data[0], cmap='seismic') | ||
plot_image(u.data[1], cmap='seismic') | ||
|
||
|
||
def plot_3dfunc(u): | ||
# Plot a 3D structured grid using pyvista | ||
import pyvista as pv | ||
cmap = plt.colormaps["viridis"] | ||
values = u.data[0, :, :, :] | ||
vistagrid = pv.ImageData() | ||
vistagrid.dimensions = np.array(values.shape) + 1 | ||
vistagrid.spacing = (1, 1, 1) | ||
vistagrid.origin = (0, 0, 0) # The bottom left corner of the data set | ||
vistagrid.cell_data["values"] = values.flatten(order="F") | ||
vistaslices = vistagrid.slice_orthogonal() | ||
vistaslices.plot(cmap=cmap) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.