Skip to content

Commit d3a1edc

Browse files
committed
Fix performance-unnecessary-value-param
1 parent 0ecd5b8 commit d3a1edc

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

cpp/basix/dof-transformations.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ std::pair<std::vector<T>, std::array<std::size_t, 2>> compute_transformation(
368368
std::array<std::vector<mdspan_t<const T, 4>>, 4> M,
369369
mdspan_t<const T, 2> coeffs, const mdarray_t<T, 2>& J, T detJ,
370370
const mdarray_t<T, 2>& K,
371-
std::function<std::array<T, 3>(std::span<const T>)> map_point, int degree,
372-
int tdim, int entity, std::size_t vs, const maps::type map_type,
371+
const std::function<std::array<T, 3>(std::span<const T>)>& map_point,
372+
int degree, int tdim, int entity, std::size_t vs, const maps::type map_type,
373373
const polyset::type ptype)
374374
{
375375
if (x[tdim].size() == 0 or x[tdim][entity].extent(0) == 0)
@@ -500,9 +500,8 @@ template <std::floating_point T>
500500
std::map<cell::type, std::pair<std::vector<T>, std::array<std::size_t, 3>>>
501501
doftransforms::compute_entity_transformations(
502502
cell::type cell_type,
503-
std::array<std::vector<md::mdspan<const T, md::dextents<std::size_t, 2>>>,
504-
4>
505-
x,
503+
const std::array<
504+
std::vector<md::mdspan<const T, md::dextents<std::size_t, 2>>>, 4>& x,
506505
std::array<std::vector<md::mdspan<const T, md::dextents<std::size_t, 4>>>,
507506
4>
508507
M,
@@ -540,8 +539,8 @@ template std::map<cell::type,
540539
std::pair<std::vector<float>, std::array<std::size_t, 3>>>
541540
doftransforms::compute_entity_transformations(
542541
cell::type,
543-
std::array<
544-
std::vector<md::mdspan<const float, md::dextents<std::size_t, 2>>>, 4>,
542+
const std::array<
543+
std::vector<md::mdspan<const float, md::dextents<std::size_t, 2>>>, 4>&,
545544
std::array<
546545
std::vector<md::mdspan<const float, md::dextents<std::size_t, 4>>>, 4>,
547546
md::mdspan<const float, md::dextents<std::size_t, 2>>, int, std::size_t,
@@ -551,8 +550,9 @@ template std::map<cell::type,
551550
std::pair<std::vector<double>, std::array<std::size_t, 3>>>
552551
doftransforms::compute_entity_transformations(
553552
cell::type,
554-
std::array<
555-
std::vector<md::mdspan<const double, md::dextents<std::size_t, 2>>>, 4>,
553+
const std::array<
554+
std::vector<md::mdspan<const double, md::dextents<std::size_t, 2>>>,
555+
4>&,
556556
std::array<
557557
std::vector<md::mdspan<const double, md::dextents<std::size_t, 4>>>, 4>,
558558
md::mdspan<const double, md::dextents<std::size_t, 2>>, int, std::size_t,

cpp/basix/dof-transformations.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ template <std::floating_point T>
4040
std::map<cell::type, std::pair<std::vector<T>, std::array<std::size_t, 3>>>
4141
compute_entity_transformations(
4242
cell::type cell_type,
43-
std::array<std::vector<md::mdspan<const T, md::dextents<std::size_t, 2>>>,
44-
4>
45-
x,
43+
const std::array<
44+
std::vector<md::mdspan<const T, md::dextents<std::size_t, 2>>>, 4>& x,
4645
std::array<std::vector<md::mdspan<const T, md::dextents<std::size_t, 4>>>,
4746
4>
4847
M,

cpp/basix/e-lagrange.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ template <std::floating_point T>
437437
FiniteElement<T>
438438
basix::element::create_lagrange(cell::type celltype, int degree,
439439
lagrange_variant variant, bool discontinuous,
440-
std::vector<int> dof_ordering)
440+
const std::vector<int>& dof_ordering)
441441
{
442442
if (celltype == cell::type::point)
443443
{
@@ -765,10 +765,10 @@ FiniteElement<T> basix::element::create_iso(cell::type celltype, int degree,
765765
//-----------------------------------------------------------------------------
766766
template FiniteElement<float> element::create_lagrange(cell::type, int,
767767
lagrange_variant, bool,
768-
std::vector<int>);
769-
template FiniteElement<double> element::create_lagrange(cell::type, int,
770-
lagrange_variant, bool,
771-
std::vector<int>);
768+
const std::vector<int>&);
769+
template FiniteElement<double>
770+
element::create_lagrange(cell::type, int, lagrange_variant, bool,
771+
const std::vector<int>&);
772772
template FiniteElement<float> element::create_iso(cell::type, int,
773773
lagrange_variant, bool);
774774
template FiniteElement<double> element::create_iso(cell::type, int,

cpp/basix/e-lagrange.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace basix::element
2121
template <std::floating_point T>
2222
FiniteElement<T> create_lagrange(cell::type celltype, int degree,
2323
lagrange_variant variant, bool discontinuous,
24-
std::vector<int> dof_ordering = {});
24+
const std::vector<int>& dof_ordering = {});
2525

2626
/// @brief Create an iso macro element on cell with given degree
2727
/// @param[in] celltype The element cell type

cpp/basix/finite-element.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ FiniteElement<T>
190190
basix::create_element(element::family family, cell::type cell, int degree,
191191
element::lagrange_variant lvariant,
192192
element::dpc_variant dvariant, bool discontinuous,
193-
std::vector<int> dof_ordering)
193+
const std::vector<int>& dof_ordering)
194194
{
195195
if (family == element::family::custom)
196196
{
@@ -316,11 +316,11 @@ basix::create_element(element::family family, cell::type cell, int degree,
316316
template basix::FiniteElement<float>
317317
basix::create_element(element::family, cell::type, int,
318318
element::lagrange_variant, element::dpc_variant, bool,
319-
std::vector<int>);
319+
const std::vector<int>&);
320320
template basix::FiniteElement<double>
321321
basix::create_element(element::family, cell::type, int,
322322
element::lagrange_variant, element::dpc_variant, bool,
323-
std::vector<int>);
323+
const std::vector<int>&);
324324
//-----------------------------------------------------------------------------
325325
template <std::floating_point T>
326326
FiniteElement<T>

cpp/basix/finite-element.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ FiniteElement<T> create_element(element::family family, cell::type cell,
16111611
int degree, element::lagrange_variant lvariant,
16121612
element::dpc_variant dvariant,
16131613
bool discontinuous,
1614-
std::vector<int> dof_ordering = {});
1614+
const std::vector<int>& dof_ordering = {});
16151615

16161616
/// Get the tensor product DOF ordering for an element
16171617
/// @param[in] family The element family

0 commit comments

Comments
 (0)