MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / test_create_adj2d

Function test_create_adj2d

python/test/unit/graph/test_adjacencylist.py:14–28  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

12
13@pytest.mark.parametrize("dtype", [np.int32, np.int64])
14def test_create_adj2d(dtype):
15 data = np.zeros([2, 4], dtype=dtype)
16 adj = adjacencylist(data)
17 num_nodes, num_links = data.shape[0], data.shape[1]
18 assert np.array_equal(
19 adj.offsets, np.arange(0, num_nodes * num_links + num_links, num_links, dtype=np.int32)
20 )
21
22 data = np.arange(20, dtype=dtype)
23 offsets = np.array([0, 5, 15, 20], dtype=np.int32)
24 adj = adjacencylist(data, offsets)
25 assert adj.num_nodes == 3
26 assert len(adj.links(0)) == 5
27 assert len(adj.links(1)) == 10
28 assert len(adj.links(2)) == 5

Callers

nothing calls this directly

Calls 3

adjacencylistFunction · 0.90
arrayMethod · 0.45
linksMethod · 0.45

Tested by

no test coverage detected