コード例 #1
0
ファイル: testing.py プロジェクト: sflarkin/yt
def small_fake_hexahedral_ds():
    from yt.frontends.stream.api import load_unstructured_mesh

    _coordinates = np.array([[-1., -1., -1.], [0., -1., -1.], [-0., 0., -1.],
                             [-1., -0., -1.], [-1., -1., 0.], [-0., -1., 0.],
                             [-0., 0., -0.], [-1., 0., -0.]])
    _connectivity = np.array([[1, 2, 3, 4, 5, 6, 7, 8]])

    # the distance from the origin
    node_data = {}
    dist = np.sum(_coordinates**2, 1)
    node_data[('connect1', 'test')] = dist[_connectivity - 1]

    ds = load_unstructured_mesh(_connectivity - 1,
                                _coordinates,
                                node_data=node_data)
    return ds
コード例 #2
0
def fake_hexahedral_ds():
    from yt.frontends.stream.api import load_unstructured_mesh
    from yt.frontends.stream.sample_data.hexahedral_mesh import \
        _connectivity, _coordinates

    # the distance from the origin
    node_data = {}
    dist = np.sum(_coordinates**2, 1)
    node_data[('connect1', 'test')] = dist[_connectivity - 1]

    # each element gets a random number
    elem_data = {}
    elem_data[('connect1', 'elem')] = np.random.rand(_connectivity.shape[0])

    ds = load_unstructured_mesh(_connectivity - 1,
                                _coordinates,
                                node_data=node_data,
                                elem_data=elem_data)
    return ds
コード例 #3
0
ファイル: testing.py プロジェクト: pshriwise/yt
def fake_hexahedral_ds():
    from yt.frontends.stream.api import load_unstructured_mesh
    from yt.frontends.stream.sample_data.hexahedral_mesh import (
        _connectivity,
        _coordinates,
    )

    prng = RandomState(0x4D3D3D3)
    # the distance from the origin
    node_data = {}
    dist = np.sum(_coordinates**2, 1)
    node_data[("connect1", "test")] = dist[_connectivity - 1]

    # each element gets a random number
    elem_data = {}
    elem_data[("connect1", "elem")] = prng.rand(_connectivity.shape[0])

    ds = load_unstructured_mesh(_connectivity - 1,
                                _coordinates,
                                node_data=node_data,
                                elem_data=elem_data)
    return ds