- Author
- Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
- Date
- 2016-06-01
- Parameters
-
[in] | i | Scalar index. |
[in] | n | Number of points in one dimension. |
[out] | ids | Computed indices for all spatial directions. |
This function is the inverse of, e.g. computing a (square) matrix entry position in memory as i*n+j. The last dimension always varies the fastest.
Definition at line 364 of file dgcartesiangalerkinprojection.h.
364 {
365 const MInt f1 = i / n;
366
367 IF_CONSTEXPR(nDim == 2) {
368 ids[0] = f1;
369 ids[1] = i - f1 * n;
370 }
371 else {
372 const MInt f2 = i / (n * n);
373
374 ids[0] = f2;
375 ids[1] = f1 - f2 * n;
376 ids[2] = i - f1 * n;
377 }
378}