Skip to content

Reply To: JPEG output of time-averaged fonctor

#6563
jjessberger
Participant

Dear Mathis,

Typically, such segfaults arise if the dimensions of the functors and the output arrays do not fit. For instance, SuperEuklidNorm3D expects to get a 3D functor and will probably segfault if a 1D functor is passed.

You could copy and modify the SuperExtractComponentF3D, s.t. it extracts several components. A most simple version of the operator() method to extract the first n components would then look like

template <typename T, typename W>
bool SuperExtractComponentVariantF3D<T,W>::operator()(W output[], const int input[])
{
std::vector<T> outTmp(_f->getTargetDim(), T{});
_f(outTmp.data(), input);
for (unsigned i=0; i<n; ++i) {
output[i] = outTmp[i];
}
return true;
}

Kind regards
Julius