Skip to content

Commit

Permalink
Minor cleanup of visualization (pmgbergen#287)
Browse files Browse the repository at this point in the history
* Fix missing data type in vtk exporter

* Fix plot_grid when ploting grid without values
  • Loading branch information
keileg authored Jul 4, 2019
1 parent aeab9e1 commit 4881f68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/porepy/viz/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def dtype(self):
np.dtype("bool"): vtk.VTK_CHAR,
np.dtype("int64"): vtk.VTK_INT,
np.dtype("float64"): vtk.VTK_DOUBLE,
np.dtype("int32"): vtk.VTK_INT,
}

return map_type[self.values.dtype]
Expand Down
17 changes: 12 additions & 5 deletions src/porepy/viz/plot_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,18 @@ def plot_gb(gb, cell_value, vector_value, info, **kwargs):
kwargs["color_map"] = color_map(extr_value)

gb.assign_node_ordering()
for g, d in gb:
kwargs["rgb"] = np.divide(kwargs.get("rgb", [1, 0, 0]), d["node_number"] + 1)
plot_grid_xd(
g, d[pp.STATE].get(cell_value), d[pp.STATE].get(vector_value), ax, **kwargs
)
if cell_value is not None:
for g, d in gb:
kwargs["rgb"] = np.divide(
kwargs.get("rgb", [1, 0, 0]), d["node_number"] + 1
)
plot_grid_xd(
g,
d[pp.STATE].get(cell_value),
d[pp.STATE].get(vector_value),
ax,
**kwargs
)

val = np.array([lim(g.nodes) for g, _ in gb])

Expand Down

0 comments on commit 4881f68

Please sign in to comment.