From 217549c7d703daaba6e02c39f88957e4b364ac6b Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Thu, 7 Sep 2023 16:10:17 +0100 Subject: [PATCH] serendipity 2d but this time it's correct --- cpp/basix/e-serendipity.cpp | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/cpp/basix/e-serendipity.cpp b/cpp/basix/e-serendipity.cpp index 4fafdf3fc..6474de7e3 100644 --- a/cpp/basix/e-serendipity.cpp +++ b/cpp/basix/e-serendipity.cpp @@ -42,37 +42,10 @@ impl::mdarray_t make_serendipity_space_2d(int degree) impl::mdarray_t wcoeffs(ndofs, psize); int row_n = 0; for (int i = 0; i <= degree; ++i) - for (int j = 0; j <= degree - i; ++j) + for (int j = 0; j <= (i < 2 ? degree : (i == degree ? 1 : degree - i)); ++j) wcoeffs(row_n++, i * (degree + 1) + j) = 1; - if (degree == 1) - { - for (std::size_t i = 0; i < psize; ++i) - { - wcoeffs(row_n, i) = 0.0; - for (std::size_t j = 0; j < wts.size(); ++j) - wcoeffs(row_n, i) += wts[j] * pts(j, 0) * pts(j, 1) * Pq(0, i, j); - } - return wcoeffs; - } - - std::vector integrand(wts.size()); - for (std::size_t k = 0; k < psize; ++k) - { - for (std::size_t a = 0; a < 2; ++a) - { - for (std::size_t i = 0; i < integrand.size(); ++i) - integrand[i] = wts[i] * pts(i, 0) * pts(i, 1) * Pq(0, k, i); - - for (int i = 1; i < degree; ++i) - for (std::size_t j = 0; j < integrand.size(); ++j) - integrand[j] *= pts(j, a); - - wcoeffs(row_n + a, k) = 0; - for (std::size_t i = 0; i < integrand.size(); ++i) - wcoeffs(row_n + a, k) += integrand[i]; - } - } + assert(std::size_t(row_n) == ndofs); return wcoeffs; }