Skip to content

Commit

Permalink
Fix some tests by explicitly using make_array_view().
Browse files Browse the repository at this point in the history
  • Loading branch information
David Wells committed Jun 3, 2023
1 parent 7a84cd4 commit 19de4b7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
8 changes: 4 additions & 4 deletions tests/integrators/advection_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test_cell(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
cell_residual(w, fev, uval, vel);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -118,7 +118,7 @@ test_boundary(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
upwind_value_residual(w, fev, uval, null_val, vel);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -191,7 +191,7 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
fev1.get_function_values(u1, indices1, u1val, true);
fev1.get_function_values(u1, indices1, make_array_view(u1val), true);
upwind_face_residual(w1, w2, fev1, fev2, u1val, nullval, vel);
M11.vmult(v1, u1);
w1.add(-1., v1);
Expand All @@ -213,7 +213,7 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)
}
w1 = 0.;
w2 = 0.;
fev2.get_function_values(u1, indices2, u1val, true);
fev2.get_function_values(u1, indices2, make_array_view(u1val), true);
upwind_face_residual(w1, w2, fev1, fev2, nullval, u1val, vel);
M12.vmult(v1, u1);
w1.add(-1., v1);
Expand Down
4 changes: 2 additions & 2 deletions tests/integrators/divergence_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_cell(const FEValuesBase<dim> &fev, const FEValuesBase<dim> &fes)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
cell_residual<dim>(w, fes, ugrad);
Md.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -123,7 +123,7 @@ test_boundary(const FEValuesBase<dim> &fev, const FEValuesBase<dim> &fes)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
u_dot_n_residual(w, fev, fes, uval);
M.vmult(v, u);
w.add(-1., v);
Expand Down
20 changes: 13 additions & 7 deletions tests/integrators/elasticity_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test_cell(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
cell_residual<dim>(w, fev, ugrad);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -100,8 +100,8 @@ test_boundary(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
nitsche_residual<dim>(w, fev, uval, ugrad, null_val, 17);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -168,8 +168,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
fev1.get_function_values(u1, indices1, u1val, true);
fev1.get_function_gradients(u1, indices1, u1grad, true);
fev1.get_function_values(u1, indices1, make_array_view(u1val), true);
fev1.get_function_gradients(u1,
indices1,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17);
M11.vmult(v1, u1);
Expand All @@ -180,8 +183,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)

w1 = 0.;
w2 = 0.;
fev2.get_function_values(u1, indices2, u1val, true);
fev2.get_function_gradients(u1, indices2, u1grad, true);
fev2.get_function_values(u1, indices2, make_array_view(u1val), true);
fev2.get_function_gradients(u1,
indices2,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17);
M12.vmult(v1, u1);
Expand Down
4 changes: 2 additions & 2 deletions tests/integrators/elasticity_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ test_boundary(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
nitsche_tangential_residual<dim>(w, fev, uval, ugrad, null_val, 17);
M.vmult(v, u);
w.add(-1., v);
Expand Down
20 changes: 13 additions & 7 deletions tests/integrators/grad_div_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test_cell(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
cell_residual<dim>(w, fev, ugrad);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -100,8 +100,8 @@ test_boundary(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
nitsche_residual<dim>(w, fev, uval, ugrad, null_val, 17);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -168,8 +168,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
fev1.get_function_values(u1, indices1, u1val, true);
fev1.get_function_gradients(u1, indices1, u1grad, true);
fev1.get_function_values(u1, indices1, make_array_view(u1val), true);
fev1.get_function_gradients(u1,
indices1,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17);
M11.vmult(v1, u1);
Expand All @@ -180,8 +183,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)

w1 = 0.;
w2 = 0.;
fev2.get_function_values(u1, indices2, u1val, true);
fev2.get_function_gradients(u1, indices2, u1grad, true);
fev2.get_function_values(u1, indices2, make_array_view(u1val), true);
fev2.get_function_gradients(u1,
indices2,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17);
M12.vmult(v1, u1);
Expand Down
20 changes: 13 additions & 7 deletions tests/integrators/laplacian_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test_cell(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
cell_residual<dim>(w, fev, ugrad);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -106,8 +106,8 @@ test_boundary(const FEValuesBase<dim> &fev)
u = 0.;
u(i) = 1.;
w = 0.;
fev.get_function_values(u, indices, uval, true);
fev.get_function_gradients(u, indices, ugrad, true);
fev.get_function_values(u, indices, make_array_view(uval), true);
fev.get_function_gradients(u, indices, make_array_view(ugrad), true);
nitsche_residual<dim>(w, fev, uval, ugrad, null_val, 17);
M.vmult(v, u);
w.add(-1., v);
Expand Down Expand Up @@ -181,8 +181,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
fev1.get_function_values(u1, indices1, u1val, true);
fev1.get_function_gradients(u1, indices1, u1grad, true);
fev1.get_function_values(u1, indices1, make_array_view(u1val), true);
fev1.get_function_gradients(u1,
indices1,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17);
M11.vmult(v1, u1);
Expand Down Expand Up @@ -213,8 +216,11 @@ test_face(const FEValuesBase<dim> &fev1, const FEValuesBase<dim> &fev2)

w1 = 0.;
w2 = 0.;
fev2.get_function_values(u1, indices2, u1val, true);
fev2.get_function_gradients(u1, indices2, u1grad, true);
fev2.get_function_values(u1, indices2, make_array_view(u1val), true);
fev2.get_function_gradients(u1,
indices2,
make_array_view(u1grad),
true);
ip_residual<dim>(
w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17);
M12.vmult(v1, u1);
Expand Down

0 comments on commit 19de4b7

Please sign in to comment.