Skip to content

Commit

Permalink
Zero work array in `fem::CoordinateElement::compute_jacobian_determin…
Browse files Browse the repository at this point in the history
…ant` (#2291)

* Zero out required working memory of compute_detJ

* Simplification

Co-authored-by: Garth N. Wells <gnw20@cam.ac.uk>
  • Loading branch information
jorgensd and garth-wells committed Jul 26, 2022
1 parent 80123e8 commit 06faeb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cpp/dolfinx/fem/CoordinateElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include "ElementDofLayout.h"
#include <algorithm>
#include <array>
#include <basix/element-families.h>
#include <basix/mdspan.hpp>
Expand Down Expand Up @@ -129,7 +130,6 @@ class CoordinateElement
return math::det(J);
else
{
// TODO: pass buffers for B and BA
assert(w.size() >= 2 * J.extent(0) * J.extent(1));

using T = typename U::element_type;
Expand All @@ -143,6 +143,8 @@ class CoordinateElement
for (std::size_t j = 0; j < B.extent(1); ++j)
B(i, j) = J(j, i);

// Zero working memory of BA
std::fill_n(BA.data_handle(), BA.size(), 0);
math::dot(B, J, BA);
return std::sqrt(math::det(BA));
}
Expand Down

0 comments on commit 06faeb5

Please sign in to comment.