From 0bcc3ca729e7f350bc4be8fe5f9dbc81beac0d8f Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 27 Jun 2023 20:26:14 -0400 Subject: [PATCH] Fix some tests by explicitly using make_array_view(). --- tests/integrators/advection_01.cc | 8 ++++---- tests/integrators/divergence_01.cc | 4 ++-- tests/integrators/elasticity_01.cc | 20 +++++++++++++------- tests/integrators/elasticity_02.cc | 4 ++-- tests/integrators/grad_div_01.cc | 20 +++++++++++++------- tests/integrators/laplacian_01.cc | 20 +++++++++++++------- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/tests/integrators/advection_01.cc b/tests/integrators/advection_01.cc index 55f68d1b4c..add2bb55c1 100644 --- a/tests/integrators/advection_01.cc +++ b/tests/integrators/advection_01.cc @@ -63,7 +63,7 @@ test_cell(const FEValuesBase &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); @@ -118,7 +118,7 @@ test_boundary(const FEValuesBase &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); @@ -191,7 +191,7 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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); @@ -213,7 +213,7 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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); diff --git a/tests/integrators/divergence_01.cc b/tests/integrators/divergence_01.cc index 2d49e7b1ac..e497de263d 100644 --- a/tests/integrators/divergence_01.cc +++ b/tests/integrators/divergence_01.cc @@ -66,7 +66,7 @@ test_cell(const FEValuesBase &fev, const FEValuesBase &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(w, fes, ugrad); Md.vmult(v, u); w.add(-1., v); @@ -123,7 +123,7 @@ test_boundary(const FEValuesBase &fev, const FEValuesBase &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); diff --git a/tests/integrators/elasticity_01.cc b/tests/integrators/elasticity_01.cc index 65a993619e..b29c6b7e9b 100644 --- a/tests/integrators/elasticity_01.cc +++ b/tests/integrators/elasticity_01.cc @@ -58,7 +58,7 @@ test_cell(const FEValuesBase &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(w, fev, ugrad); M.vmult(v, u); w.add(-1., v); @@ -100,8 +100,8 @@ test_boundary(const FEValuesBase &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(w, fev, uval, ugrad, null_val, 17); M.vmult(v, u); w.add(-1., v); @@ -168,8 +168,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17); M11.vmult(v1, u1); @@ -180,8 +183,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17); M12.vmult(v1, u1); diff --git a/tests/integrators/elasticity_02.cc b/tests/integrators/elasticity_02.cc index 851d363b0e..647fead845 100644 --- a/tests/integrators/elasticity_02.cc +++ b/tests/integrators/elasticity_02.cc @@ -62,8 +62,8 @@ test_boundary(const FEValuesBase &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(w, fev, uval, ugrad, null_val, 17); M.vmult(v, u); w.add(-1., v); diff --git a/tests/integrators/grad_div_01.cc b/tests/integrators/grad_div_01.cc index 378f499a9a..f9f04de5c5 100644 --- a/tests/integrators/grad_div_01.cc +++ b/tests/integrators/grad_div_01.cc @@ -58,7 +58,7 @@ test_cell(const FEValuesBase &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(w, fev, ugrad); M.vmult(v, u); w.add(-1., v); @@ -100,8 +100,8 @@ test_boundary(const FEValuesBase &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(w, fev, uval, ugrad, null_val, 17); M.vmult(v, u); w.add(-1., v); @@ -168,8 +168,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17); M11.vmult(v1, u1); @@ -180,8 +183,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17); M12.vmult(v1, u1); diff --git a/tests/integrators/laplacian_01.cc b/tests/integrators/laplacian_01.cc index 82a8b9dc67..38c60acfe5 100644 --- a/tests/integrators/laplacian_01.cc +++ b/tests/integrators/laplacian_01.cc @@ -57,7 +57,7 @@ test_cell(const FEValuesBase &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(w, fev, ugrad); M.vmult(v, u); w.add(-1., v); @@ -106,8 +106,8 @@ test_boundary(const FEValuesBase &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(w, fev, uval, ugrad, null_val, 17); M.vmult(v, u); w.add(-1., v); @@ -181,8 +181,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, u1val, u1grad, nullval, nullgrad, 17); M11.vmult(v1, u1); @@ -213,8 +216,11 @@ test_face(const FEValuesBase &fev1, const FEValuesBase &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( w1, w2, fev1, fev2, nullval, nullgrad, u1val, u1grad, 17); M12.vmult(v1, u1); -- 2.39.5