Beispiel #1
0
    def geometry(self):
        """Returns the geometry for the given cell type.

        Currently the cell types are all ellipsoidal and are distinguished
        through setting different scaling values in the visualisation. This has
        the additional benefit that the cells can be discriminated easily in
        Paraview based on their given scaling value.
        """
        return pv.ParametricEllipsoid(2.2,
                                      4.2,
                                      4.2,
                                      u_res=CELL_RESOLUTION,
                                      v_res=CELL_RESOLUTION,
                                      w_res=CELL_RESOLUTION)
def test_select_enclosed_points():
    mesh = examples.load_uniform()
    surf = pyvista.Sphere(center=mesh.center, radius=mesh.length/2.)
    result = mesh.select_enclosed_points(surf)
    assert isinstance(result, type(mesh))
    assert 'SelectedPoints' in result.array_names
    assert result.n_arrays == mesh.n_arrays + 1
    # Now check non-closed surface
    mesh = pyvista.ParametricEllipsoid(0.2, 0.7, 0.7, )
    surf = mesh.copy()
    surf.rotate_x(90)
    result = mesh.select_enclosed_points(surf, check_surface=False)
    assert isinstance(result, type(mesh))
    assert 'SelectedPoints' in result.array_names
    assert result.n_arrays == mesh.n_arrays + 1
    with pytest.raises(RuntimeError):
        result = mesh.select_enclosed_points(surf, check_surface=True)
Beispiel #3
0
def test_compute_cell_quality():
    mesh = pyvista.ParametricEllipsoid().decimate(0.8)
    qual = mesh.compute_cell_quality()
    assert 'CellQuality' in qual.array_names
    with pytest.raises(KeyError):
        qual = mesh.compute_cell_quality(quality_measure='foo')
Beispiel #4
0
###############################################################################
# This example demonstrates how to plot parametric objects using pyvista
#
# Supertoroid
# +++++++++++

supertoroid = pv.ParametricSuperToroid(n1=0.5)
supertoroid.plot(color='tan', smooth_shading=True)

################################################################################
# Parametric Ellipsoid
# ++++++++++++++++++++

# Ellipsoid with a long x axis
ellipsoid = pv.ParametricEllipsoid(10, 5, 5)
ellipsoid.plot(color='tan')

################################################################################
# Partial Parametric Ellipsoid
# ++++++++++++++++++++++++++++

# cool plotting direction
cpos = [(21.9930, 21.1810, -30.3780), (-1.1640, -1.3098, -0.1061),
        (0.8498, -0.2515, 0.4631)]

# half ellipsoid
part_ellipsoid = pv.ParametricEllipsoid(10, 5, 5, max_v=pi / 2)
part_ellipsoid.plot(color='tan', smooth_shading=True, cpos=cpos)

################################################################################
Beispiel #5
0
def test_compute_cell_quality():
    mesh = pyvista.ParametricEllipsoid().decimate(0.8)
    qual = mesh.compute_cell_quality()
    assert 'CellQuality' in qual.scalar_names
def test_ParametricEllipsoid():
    geom = pyvista.ParametricEllipsoid()
    assert geom.n_points