diff --git a/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp b/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp index 84104354106d878461de7c2ac957c3e1aa691ea3..78e8fa4de18b994774ea867fd7e4a800e6286165 100644 --- a/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp +++ b/Src/Kernels/Chebyshev/FChebSymM2LHandler.hpp @@ -2,6 +2,7 @@ #ifndef FCHEBSYMM2LHANDLER_HPP #define FCHEBSYMM2LHANDLER_HPP +#include <array> #include <climits> #include <sstream> @@ -36,9 +37,10 @@ permutations of the 16 we compute in this function). Depending on whether FACASVD is defined or not, either ACA+SVD or only SVD is used to compress them. */ -template <class FReal, int ORDER, typename MatrixKernelClass> +template <class FReal, int ORDER, typename MatrixKernelClass, class ArrayK, class ArrayLr> static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal CellWidth, - const FReal Epsilon, FReal* K[343], int LowRank[343]) + const FReal Epsilon, ArrayK K, ArrayLr LowRank) +// const FReal Epsilon, FReal* K[343], int LowRank[343]) { // std::cout << "\nComputing 16 far-field interactions (l=" << ORDER << ", eps=" << Epsilon // << ") for cells of width w = " << CellWidth << std::endl; @@ -492,10 +494,10 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons static const unsigned int nnodes = ORDER*ORDER*ORDER; // compute and compress //////////// - FReal* K[343]; - int LowRank[343]; - for (unsigned int idx=0; idx<343; ++idx) - { K[idx] = nullptr; LowRank[idx] = 0; } + std::array<FReal*,343> K{}; + std::array<int,343> LowRank{}; + // for (unsigned int idx=0; idx<343; ++idx) + // { K[idx] = nullptr; LowRank[idx] = 0; } precompute<FReal,ORDER>(MatrixKernel, FReal(2.), Epsilon, K, LowRank); // write to binary file //////////// diff --git a/Src/Kernels/Interpolation/FInterpSymmetries.hpp b/Src/Kernels/Interpolation/FInterpSymmetries.hpp index 3138664e28c531b0d9488ca3f79f9b01156dcb11..94fb78e03525fc299f6511b17f357ad1cbefce18 100644 --- a/Src/Kernels/Interpolation/FInterpSymmetries.hpp +++ b/Src/Kernels/Interpolation/FInterpSymmetries.hpp @@ -48,8 +48,9 @@ class FInterpSymmetries // set quads and cones permutations unsigned int evn[ORDER], odd[ORDER]; - for (unsigned int o=0; o<ORDER; ++o) - {evn[o] = o; odd[o] = ORDER-1 - o;} + for (unsigned int o=0; o<ORDER; ++o) { + evn[o] = o; + odd[o] = ORDER-1 - o;} for (unsigned int i=0; i<ORDER; ++i) { for (unsigned int j=0; j<ORDER; ++j) { @@ -81,12 +82,15 @@ class FInterpSymmetries } // set 48 global permutations (combinations of 8 quadrants and 6 cones respectively) - for (unsigned int q=0; q<8; ++q) - for (unsigned int c=0; c<8; ++c) - if (c!=2 && c!=5) // cone 2 and 5 do not exist - for (unsigned int n=0; n<nnodes; ++n) - permutations[q*8 + c][n] = cones[c][quads[q][n]]; - + for (unsigned int q=0; q<8; ++q) { + for (unsigned int c=0; c<8; ++c){ + if (c!=2 && c!=5) {// cone 2 and 5 do not exist + for (unsigned int n=0; n<nnodes; ++n){ + permutations[q*8 + c][n] = cones[c][quads[q][n]]; + } + } + } + } // permutation of interaction indices (already absolute value) perms[0][0] = 0; perms[0][1] = 1; perms[0][2] = 2; perms[1][0] = 0; perms[1][1] = 2; perms[1][2] = 1; @@ -119,7 +123,8 @@ class FInterpSymmetries const int cidx = (q2 | q1 | q0); // set permutation array ///////////////////////////////////////// - for (unsigned int n=0; n<nnodes; ++n) permutation[n] = permutations[qidx*8 + cidx][n]; + for (unsigned int n=0; n<nnodes; ++n) { + permutation[n] = permutations[qidx*8 + cidx][n]; } // set permutation index ///////////////////////////////////////// return static_cast<unsigned> (u[perms[cidx][0]]+3)*7*7 + (u[perms[cidx][1]]+3)*7 + (u[perms[cidx][2]]+3);