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