Use `std::array` rather than `malloc()`/`free()`
In gridoperator.hh:nonlinear_jacobian_apply()
:
// number of basis functions
auto size = lb_.size();
// Per-element trial coefficient vectors
// cannot use std::array as size is not constexpr - size can change at runtime.
auto zl = (typename Domain::field_type*) malloc(sizeof(typename Domain::field_type)*size);
auto wl = (typename Domain::field_type*) malloc(sizeof(typename Domain::field_type)*size);
// Local per-element test cofficient vector to store result in
auto yl = (typename Range::field_type*) malloc(sizeof(typename Range::field_type)*size);
//[...]
free(zl);
free(wl);
free(yl);
As the comment says, size
is not constexpr. But it can be made constexpr. If just slapping constexpr
in front of the auto
is not enough, you'll have to turn the lb_.size()
call into a static method call on the class rather then an instance call.
(And, even if size
was indeed not constexpr, that should be a std::vector
, not a malloc()
/free()
)
Blocks: !67 (merged)
Edited by Dr. Jorrit Fahlke