LocalInterp contains unneeded tests in the innermost interpolation loop

Issue #1386 new
Roland Haas created an issue

in lines 584 ff of Interpolate.c the code tests:

/* check for valid input and output array type */
if (in_types[a] < 0 || out_types[a] < 0)
{
#pragma omp critical
  CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
              "Datatype for input and/or output array with index %d "
              "is invalid", a);
  myretval = UTIL_ERROR_BAD_INPUT;
  continue;
}

for each point. However test needs only be done once for each input array so could be moved outside of the innermost loop. There are several similar tests further down in the file that could be moved outside of the loop over points. Similarly one could replace the if() on variable types by C++ tmeplates on the type (and order of interpolation) which would also only be worhtwhile for very heavy uses of the interpolator.

Only really an issue for a client thorn that does very many interpolations.

Keyword: LocalInterp

Comments (0)

  1. Log in to comment