...
 
Commits (2)
......@@ -175,12 +175,12 @@ class CylinderMesh(Domain):
# n_outer
@property
def n_outer(self):
return self.n_cyl_per_bsize*(self.bsize-1)+1
return self.n_outer_per_bsize*(self.bsize-1)+1
@property
def n_outer_per_bsize(self):
# default to 1
if self._n_cyl_per_bsize is None:
if self._n_outer_per_bsize is None:
return 1
else:
return self._n_outer_per_bsize
......@@ -232,7 +232,7 @@ class CylinderMesh(Domain):
# n_up
@property
def n_up(self):
return self.n_cyl_per_bsize*(self.bsize-1)+1
return self.n_up_per_bsize*(self.bsize-1)+1
@property
def n_up_per_bsize(self):
......@@ -590,6 +590,54 @@ class CylinderMesh(Domain):
if ax is None:
ax_use.axis("equal")
def hvplot_grid(self, with_outer=False, normalize=False, as_blocks=False):
import holoviews as hv
hv_dict = dict()
if as_blocks:
blocks = self._get_blocks_for_2D_slice()
else:
blocks = self.innercylouter_domain.blocks
for name, block in blocks.items():
if not with_outer and "outer" in name:
pass
else:
x = self._matmesh2arraymesh(block.x[:, :, 0])
y = self._matmesh2arraymesh(block.y[:, :, 0])
if normalize:
x /= self.r_cyl
y /= self.r_cyl
hv_dict[name] = hv.Curve((x, y))
return hv.NdOverlay(hv_dict).opts(legend_position="right", aspect="equal", legend_limit=50)
def _get_blocks_for_2D_slice(self):
out = dict()
# Inner
for j in range(2 * self.n_cyl_per_bsize):
out["inner-split%04d" % (2 * j)] = self.blocks["inner-split%04d" % (2 * j)]
# Cyl
for i in range(2*self.n_cyl_per_bsize):
name = "cyl4-split%04d%s"
if i == 0:
name_ex = ""
else:
name_ex = "-%04d" % i
for j in range(2 * self.n_cyl_per_bsize):
out[name % (2*j, name_ex)] = self.blocks[name % (2*j, name_ex)]
# Outer
for i in range(2*self.n_cyl_per_bsize):
name = "outer4-split%04d%s"
if i == 0:
name_ex = ""
else:
name_ex = "-%04d" % i
for j in range(2 * self.n_outer_per_bsize):
out[name % (2*j, name_ex)] = self.blocks[name % (2*j, name_ex)]
return out
def start_app(self, bsize_min=8, bsize_mult=5, debug=False):
import ipywidgets as ipw
import plotly.graph_objects as ply
......