49{
50 int normalX = (int)( cell.template getField<descriptors::NORMAL_X>() );
51 int normalY = (int)( cell.template getField<descriptors::NORMAL_Y>() );
52 if (normalX!=0 || normalY!=0) {
53 constexpr int extraExtent = MODEL::extent() + SCHEME_BOUND::getExtraExtent();
54 std::size_t iT = vars.template get<fd::fdParams::Timestep>();
55 T f[MODEL::extent()*DESCRIPTOR::d], F[MODEL::extent()*DESCRIPTOR::d];
56 T fGhost[MODEL::extent()*DESCRIPTOR::d], fNormal[extraExtent*DESCRIPTOR::d];
57 T u[DESCRIPTOR::d];
58 int normal[] {normalX, normalY};
59 std::fill(std::begin(fGhost), std::end(fGhost), 0);
60 T* fNew = fd::accessNew<T,FIELD>(cell, iT);
61 T* f0 = fd::accessOld<T,FIELD>(cell, iT);
62 for (int iN=1; iN<=extraExtent; ++iN) {
63 fNormal[fd::getArrayPos<extraExtent>(iN-1,0)] = *fd::accessOld<T,FIELD>( cell.neighbor({normalX*iN, 0}), iT );
64 fNormal[fd::getArrayPos<extraExtent>(iN-1,1)] = *fd::accessOld<T,FIELD>( cell.neighbor({ 0, normalY*iN}), iT );
65 }
66 cell.computeU(u);
67 SCHEME_BOUND::apply(fGhost, *f0, fNormal, normal, u, vars);
68 for (int iN=1; iN<=MODEL::extent(); ++iN) {
69 f[fd::getArrayPos<MODEL::extent()>(iN-1,0)] = normalX<=0 ? *fd::accessOld<T,FIELD>( cell.neighbor({-iN, 0}), iT )
70 : fGhost[fd::
getArrayPos<MODEL::extent()+SCHEME_BOUND::getExtraExtent()>(iN-1,0)];
71 F[fd::getArrayPos<MODEL::extent()>(iN-1,0)] = normalX>=0 ? *fd::accessOld<T,FIELD>( cell.neighbor({+iN, 0}), iT )
72 : fGhost[fd::
getArrayPos<MODEL::extent()+SCHEME_BOUND::getExtraExtent()>(iN-1,0)];
73 f[fd::getArrayPos<MODEL::extent()>(iN-1,1)] = normalY<=0 ? *fd::accessOld<T,FIELD>( cell.neighbor({ 0, -iN}), iT )
74 : fGhost[fd::
getArrayPos<MODEL::extent()+SCHEME_BOUND::getExtraExtent()>(iN-1,1)];
75 F[fd::getArrayPos<MODEL::extent()>(iN-1,1)] = normalY>=0 ? *fd::accessOld<T,FIELD>( cell.neighbor({ 0, +iN}), iT )
76 : fGhost[fd::
getArrayPos<MODEL::extent()+SCHEME_BOUND::getExtraExtent()>(iN-1,1)];
77 }
78 MODEL::apply(fNew, f0, f, F, u, vars);
80 }
81}
void applySourceTerm(T *fNew, CELL &cell) any_platform
constexpr unsigned getArrayPos(const unsigned iExt, const unsigned iD) any_platform