def fake_hexahedral_ds(): from yt.frontends.stream.sample_data.hexahedral_mesh import ( _connectivity, _coordinates, ) from yt.loaders import load_unstructured_mesh 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
def small_fake_hexahedral_ds(): from yt.loaders import load_unstructured_mesh _coordinates = np.array( [ [-1.0, -1.0, -1.0], [0.0, -1.0, -1.0], [-0.0, 0.0, -1.0], [-1.0, -0.0, -1.0], [-1.0, -1.0, 0.0], [-0.0, -1.0, 0.0], [-0.0, 0.0, -0.0], [-1.0, 0.0, -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