InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.41k stars 663 forks source link

STYLE: Put local matrix variables in FEM on the stack, remove new/delete #4560

Closed N-Dekker closed 6 months ago

N-Dekker commented 6 months ago

Note that the type of these local matrices is MatrixType = vnl_matrix<Float>, so such a matrix is just empty, when default-constructed.

Following C++ Core Guidelines, February 15, 2024, "Prefer scoped objects, don’t heap-allocate unnecessarily"

N-Dekker commented 6 months ago

Looks good on a glance.

Thanks @dzenanz I think this PR might even improve the performance of the FEM module, but I did not have time to do bench-marking. It's a style improvement anyway 😇