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

Function assemble_vector_parallel

python/test/unit/fem/test_custom_assembler.py:64–80  ·  view source on GitHub ↗

Assemble simple linear form over a mesh into the array b using a parallel loop.

(b, v, x, dofmap_t_data, dofmap_t_offsets, num_cells)

Source from the content-addressed store, hash-verified

62
63@numba.njit(parallel=True, fastmath=True)
64def assemble_vector_parallel(b, v, x, dofmap_t_data, dofmap_t_offsets, num_cells):
65 """Assemble simple linear form over a mesh into the array b using a parallel loop."""
66 q0 = 1 / 3.0
67 q1 = 1 / 3.0
68 b_unassembled = np.empty((num_cells, 3), dtype=b.dtype)
69 for cell in numba.prange(num_cells):
70 # FIXME: This assumes a particular geometry dof layout
71 A = area(x[v[cell, 0]], x[v[cell, 1]], x[v[cell, 2]])
72 b_unassembled[cell, 0] = A * (1.0 - q0 - q1)
73 b_unassembled[cell, 1] = A * q0
74 b_unassembled[cell, 2] = A * q1
75
76 # Accumulate values in RHS
77 _b_unassembled = b_unassembled.reshape(num_cells * 3)
78 for index in numba.prange(dofmap_t_offsets.shape[0] - 1):
79 for p in range(dofmap_t_offsets[index], dofmap_t_offsets[index + 1]):
80 b[index] += _b_unassembled[dofmap_t_data[p]]
81
82
83@numba.njit(fastmath=True)

Callers

nothing calls this directly

Calls 1

areaFunction · 0.70

Tested by

no test coverage detected