Ejemplo n.º 1
0
def test_quality_struct():
    x = np.arange(-10, 10, 5)
    y = np.arange(-10, 10, 5)
    z = np.arange(-10, 10, 5)
    x, y, z = np.meshgrid(x, y, z)
    grid = pv.StructuredGrid(x, y, z)
    qual = pyansys.quality(grid)
    assert (qual == 1).all()
Ejemplo n.º 2
0
cell_center = grid.points[cells].mean(1)

# extract cells below the 0 xy plane
mask = cell_center[:, 2] < 0
cell_ind = mask.nonzero()[0]
subgrid = grid.extract_cells(cell_ind)

# advanced plotting
plotter = pv.Plotter()
plotter.add_mesh(subgrid, 'lightgrey', lighting=True, show_edges=True)
plotter.add_mesh(sphere, 'r', 'wireframe')
plotter.add_legend([[' Input Mesh ', 'r'], [' Tesselated Mesh ', 'black']])
plotter.show()

###############################################################################
# Use pyansys to compute cell quality

import pyansys

cell_qual = pyansys.quality(subgrid)

# plot quality
subgrid.plot(
    scalars=cell_qual,
    stitle='Quality',
    cmap='bwr',
    clim=[0, 1],
    flip_scalars=True,
    show_edges=True,
)
Ejemplo n.º 3
0
def test_quality():
    archive = pyansys.Archive(examples.hexarchivefile)
    grid = archive.grid
    qual = pyansys.quality(grid)
    assert (qual == 1).all()
Ejemplo n.º 4
0
def test_quality_type_error():
    with pytest.raises(TypeError):
        pyansys.quality(pv.PolyData())