| 911 | } |
| 912 | |
| 913 | void HypreABec::setupSolver(Real _reltol, Real _abstol, int maxiter) |
| 914 | { |
| 915 | BL_PROFILE("HypreABec::setupSolver"); |
| 916 | |
| 917 | const BoxArray& grids = acoefs->boxArray(); |
| 918 | |
| 919 | const int size = AMREX_SPACEDIM + 1; |
| 920 | int i, idim; |
| 921 | |
| 922 | int stencil_indices[size]; |
| 923 | |
| 924 | for (i = 0; i < size; i++) { |
| 925 | stencil_indices[i] = i; |
| 926 | } |
| 927 | |
| 928 | BaseFab<GpuArray<Real, size>> matfab; // AoS indexing |
| 929 | for (MFIter ai(*acoefs); ai.isValid(); ++ai) { |
| 930 | i = ai.index(); |
| 931 | const Box ® = grids[i]; |
| 932 | |
| 933 | matfab.resize(reg); |
| 934 | Elixir matfab_elix = matfab.elixir(); |
| 935 | Real* mat = (Real*) matfab.dataPtr(); |
| 936 | |
| 937 | // build matrix interior |
| 938 | |
| 939 | hacoef(reg, matfab.array(), (*acoefs)[ai].array(), alpha); |
| 940 | |
| 941 | for (idim = 0; idim < AMREX_SPACEDIM; ++idim) { |
| 942 | hbcoef(reg, matfab.array(), (*bcoefs[idim])[ai].array(), beta, dx, idim); |
| 943 | } |
| 944 | |
| 945 | // add b.c.'s to matrix diagonal, and |
| 946 | // zero out offdiag values at low domain boundaries (high done by symmetry) |
| 947 | |
| 948 | const NGBndry& bd = getBndry(); |
| 949 | const Box& domain = bd.getDomain(); |
| 950 | for (OrientationIter oitr; oitr; oitr++) { |
| 951 | int cdir(oitr()); |
| 952 | idim = oitr().coordDir(); |
| 953 | const RadBoundCond &bct = bd.bndryConds(oitr())[i]; |
| 954 | const Real &bcl = bd.bndryLocs(oitr())[i]; |
| 955 | const Mask &msk = bd.bndryMasks(oitr(),i); |
| 956 | const Box &bbox = (*bcoefs[idim])[ai].box(); |
| 957 | const Box &msb = msk.box(); |
| 958 | if (reg[oitr()] == domain[oitr()]) { |
| 959 | Array4<int const> tfp{}; |
| 960 | int bctype = bct; |
| 961 | if (bd.mixedBndry(oitr())) { |
| 962 | const BaseFab<int> &tf = *(bd.bndryTypes(oitr())[i]); |
| 963 | tfp = tf.array(); |
| 964 | bctype = -1; |
| 965 | } |
| 966 | const Box &fsb = bd.bndryValues(oitr())[ai].box(); |
| 967 | Array4<Real const> pSPa{}; |
| 968 | if (SPa != 0) { |
| 969 | pSPa = (*SPa)[ai].array(); |
| 970 | } |
no test coverage detected