Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use array not vector #2971

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/test/unit/fem/test_dof_permuting.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_evaluation(cell_type, space_type, space_order):

for d in dofs:
v = Function(V)
v.vector[:] = [1 if i == d else 0 for i in range(v.vector.local_size)]
v.x.array[:] = [1 if i == d else 0 for i in range(v.x.index_map.size_local)]
values0 = v.eval(eval_points, [0 for i in eval_points])
values1 = v.eval(eval_points, [1 for i in eval_points])
if len(eval_points) == 1:
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_integral(cell_type, space_type, space_order):
tdim = mesh.topology.dim
for d in dofs:
v = Function(V)
v.vector[:] = [1 if i == d else 0 for i, _ in enumerate(v.vector[:])]
v.x.array[:] = [1 if i == d else 0 for i, _ in enumerate(v.x.array[:])]
if space_type in ["RT", "BDM", "RTCF", "NCF", "BDMCF", "AAF"]:
# Hdiv
def normal(x):
Expand Down
6 changes: 3 additions & 3 deletions python/test/unit/fem/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def f(x):

w = Function(W)
w.interpolate(f)
x = w.vector
assert x.max()[1] == 3.0 # /NOSONAR
assert x.min()[1] == 1.0 # /NOSONAR
x = w.x.array
assert x.max() == 3.0 # /NOSONAR
assert x.min() == 1.0 # /NOSONAR

num_vertices = W.mesh.topology.index_map(0).size_global
assert round(w.x.norm(la.Norm.l1) - 6 * num_vertices, 7) == 0
Expand Down
2 changes: 1 addition & 1 deletion python/test/unit/fem/test_function_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_collapse(W, V):

f_0 = Function(Ws[0][0])
f_1 = Function(V)
assert f_0.vector.getSize() == f_1.vector.getSize()
assert f_0.x.index_map.size_global == f_1.x.index_map.size_global


def test_argument_equality(mesh, V, V2, W, W2):
Expand Down
2 changes: 1 addition & 1 deletion python/test/unit/fem/test_quadrature_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_vector_element(shape):
q_ = ufl.TestFunction(Quad)
dq = ufl.TrialFunction(Quad)
one = dolfinx.fem.Function(Quad)
one.vector.set(1.0)
one.x.array[:] = 1.0
mass_L_form = dolfinx.fem.form(ufl.inner(one, q_) * dx_m)
mass_v = dolfinx.fem.assemble_vector(mass_L_form)
mass_a_form = dolfinx.fem.form(ufl.inner(dq, q_) * dx_m)
Expand Down
Loading