111    class(
schwarz_t), 
target, 
intent(inout) :: this
 
  112    type(
space_t), 
target, 
intent(inout) :: Xh
 
  113    type(
dofmap_t), 
target, 
intent(in) :: dof
 
  114    type(
gs_t), 
target, 
intent(inout) :: gs_h
 
  115    type(
mesh_t), 
target, 
intent(inout) :: msh
 
  116    type(
bc_list_t), 
target, 
intent(inout):: bclst
 
  121    call this%Xh_schwarz%init(
gll, xh%lx+2, xh%lx+2, xh%lx+2)
 
  122    call this%dm_schwarz%init(msh, this%Xh_schwarz)
 
  123    call this%gs_schwarz%init(this%dm_schwarz)
 
  125    allocate(this%work1(this%dm_schwarz%size()))
 
  126    allocate(this%work2(this%dm_schwarz%size()))
 
  127    allocate(this%wt(xh%lx, xh%lx, 4, msh%gdim, msh%nelv))
 
  129    call this%fdm%init(xh, dof, gs_h)
 
  144    if (nthrds .gt. 1) 
then 
  146       call this%gs_h%init(this%dof)
 
  147       this%local_gs = .true.
 
  150       this%local_gs = .false.
 
  154       call device_map(this%work1, this%work1_d,this%dm_schwarz%size())
 
  155       call device_map(this%work2, this%work2_d,this%dm_schwarz%size())
 
  161            int(this%dof%size(), 
i8) * int(c_sizeof(this%work1(1)), 
i8))
 
  162       call rone(this%work1, this%dof%size())
 
 
  214    integer :: enx,eny,enz, n, ie, k, ns
 
  215    real(kind=
rp), 
parameter :: zero = 0.0
 
  216    real(kind=
rp), 
parameter :: one = 1.0
 
  217    associate(work1 => this%work1, work2 => this%work2, msh => this%msh, &
 
  218         xh => this%Xh, xh_schwarz => this%Xh_schwarz)
 
  225      if(.not. msh%gdim .eq. 3) enz=1
 
  226      ns = enx*eny*enz*msh%nelv
 
  229      call rzero(work1, ns)
 
  233      call schwarz_extrude(work1, 0, zero, work2, 0, one , enx, eny, enz, msh%nelv)
 
  237         call this%gs_schwarz%op(work2, ns, gs_op_add)
 
  241         call this%gs_schwarz%op(work2, ns, gs_op_add)
 
  243      call schwarz_extrude(work2, 0, one, work1, 0, -one, enx, eny, enz, msh%nelv)
 
  244      call schwarz_extrude(work2, 2, one, work2, 0, one, enx, eny, enz, msh%nelv)
 
  255         call this%gs_h%op(work1, n, gs_op_add)
 
  259         call this%gs_h%op(work1, n, gs_op_add)
 
  264         if (msh%gdim .eq. 2) 
then 
  267         if (this%msh%gdim.eq. 3) 
then 
 
  277    integer, 
intent(in) :: n, nelv
 
  278    real(kind=rp), 
intent(inout) :: wt(n,4,2,nelv)
 
  279    real(kind=rp), 
intent(inout) :: work(n,n)
 
  282       wt(j,1,1,ie) = 1.0_rp / work(1,j)
 
  283       wt(j,2,1,ie) = 1.0_rp / work(2,j)
 
  284       wt(j,3,1,ie) = 1.0_rp / work(n-1,j)
 
  285       wt(j,4,1,ie) = 1.0_rp / work(n,j)
 
  288       wt(i,1,2,ie) = 1.0_rp / work(i,1)
 
  289       wt(i,2,2,ie) = 1.0_rp / work(i,2)
 
  290       wt(i,3,2,ie) = 1.0_rp / work(i,n-1)
 
  291       wt(i,4,2,ie) = 1.0_rp / work(i,n)
 
 
  299    integer, 
intent(in) ::n, nelv, ie
 
  300    real(kind=rp), 
intent(inout) :: wt(n,n,4,3,nelv)
 
  301    real(kind=rp), 
intent(inout) :: work(n,n,n)
 
  306          wt(j,k,1,1,ie) = 1.0_rp / work(1,j,k)
 
  307          wt(j,k,2,1,ie) = 1.0_rp / work(2,j,k)
 
  308          wt(j,k,3,1,ie) = 1.0_rp / work(n-1,j,k)
 
  309          wt(j,k,4,1,ie) = 1.0_rp / work(n,j,k)
 
  315          wt(i,k,1,2,ie) = 1.0_rp / work(i,1,k)
 
  316          wt(i,k,2,2,ie) = 1.0_rp / work(i,2,k)
 
  317          wt(i,k,3,2,ie) = 1.0_rp / work(i,n-1,k)
 
  318          wt(i,k,4,2,ie) = 1.0_rp / work(i,n,k)
 
  324          wt(i,j,1,3,ie) = 1.0_rp / work(i,j,1)
 
  325          wt(i,j,2,3,ie) = 1.0_rp / work(i,j,2)
 
  326          wt(i,j,3,3,ie) = 1.0_rp / work(i,j,n-1)
 
  327          wt(i,j,4,3,ie) = 1.0_rp / work(i,j,n)
 
 
  372    integer, 
intent(in) :: l1, l2, nx, ny, nz, nelv
 
  373    real(kind=rp), 
intent(inout) :: arr1(nx,ny,nz,nelv), arr2(nx,ny,nz,nelv)
 
  374    real(kind=rp), 
intent(in) :: f1, f2
 
  375    integer :: i, j, k, ie, i0, i1
 
  382             arr1(l1+1 ,j,1,ie) = f1*arr1(l1+1 ,j,1,ie) &
 
  383                  +f2*arr2(l2+1 ,j,1,ie)
 
  384             arr1(nx-l1,j,1,ie) = f1*arr1(nx-l1,j,1,ie) &
 
  385                  +f2*arr2(nx-l2,j,1,ie)
 
  388             arr1(i,l1+1 ,1,ie) = f1*arr1(i,l1+1 ,1,ie) &
 
  389                  +f2*arr2(i,l2+1 ,1,ie)
 
  390             arr1(i,ny-l1,1,ie) = f1*arr1(i,ny-l1,1,ie) &
 
  391                  +f2*arr2(i,nx-l2,1,ie)
 
  398                arr1(l1+1 ,j,k,ie) = f1*arr1(l1+1 ,j,k,ie) &
 
  399                     +f2*arr2(l2+1 ,j,k,ie)
 
  400                arr1(nx-l1,j,k,ie) = f1*arr1(nx-l1,j,k,ie) &
 
  401                     +f2*arr2(nx-l2,j,k,ie)
 
  406                arr1(i,l1+1 ,k,ie) = f1*arr1(i,l1+1 ,k,ie) &
 
  407                     +f2*arr2(i,l2+1 ,k,ie)
 
  408                arr1(i,nx-l1,k,ie) = f1*arr1(i,nx-l1,k,ie) &
 
  409                     +f2*arr2(i,nx-l2,k,ie)
 
  414                arr1(i,j,l1+1 ,ie) = f1*arr1(i,j,l1+1 ,ie) &
 
  415                     +f2*arr2(i,j,l2+1 ,ie)
 
  416                arr1(i,j,nx-l1,ie) = f1*arr1(i,j,nx-l1,ie) &
 
  417                     +f2*arr2(i,j,nx-l2,ie)
 
 
  426    real(kind=rp), 
dimension(this%dof%size()), 
intent(inout) :: e, r
 
  427    integer :: n, enx, eny, enz, ns
 
  428    real(kind=rp), 
parameter :: zero = 0.0_rp
 
  429    real(kind=rp), 
parameter :: one = 1.0_rp
 
  430    type(c_ptr) :: e_d, r_d
 
  431    associate(work1 => this%work1, work1_d => this%work1_d,&
 
  432         work2 => this%work2, work2_d => this%work2_d)
 
  435      enx=this%Xh_schwarz%lx
 
  436      eny=this%Xh_schwarz%ly
 
  437      enz=this%Xh_schwarz%lz
 
  438      if(.not. this%msh%gdim .eq. 3) enz=1
 
  439      ns = enx*eny*enz*this%msh%nelv
 
  440      if (neko_bcknd_device .eq. 1) 
then 
  441         r_d = device_get_ptr(r)
 
  442         e_d = device_get_ptr(e)
 
  443         call device_event_record(this%event, glb_cmd_queue)
 
  444         call device_stream_wait_event(aux_cmd_queue, this%event, 0)
 
  445         call device_schwarz_toext3d(work1_d, r_d, this%Xh%lx, &
 
  446              this%msh%nelv, aux_cmd_queue)
 
  447         call device_schwarz_extrude(work1_d, 0, zero, work1_d, 2, one, &
 
  448              enx,eny,enz, this%msh%nelv,aux_cmd_queue)
 
  450         this%gs_schwarz%bcknd%gs_stream = aux_cmd_queue
 
  451         call this%gs_schwarz%op(work1, ns, gs_op_add,this%event)
 
  452         call device_event_sync(this%event)
 
  453         call device_schwarz_extrude(work1_d, 0, one, work1_d, 2, -one, &
 
  454              enx, eny, enz, this%msh%nelv, aux_cmd_queue)
 
  456         call this%fdm%compute(work2, work1,aux_cmd_queue) 
 
  458         call device_schwarz_extrude(work1_d, 0, zero, work2_d, 0, one, &
 
  459              enx, eny, enz, this%msh%nelv, aux_cmd_queue)
 
  460         call this%gs_schwarz%op(work2, ns, gs_op_add,this%event)
 
  461         call device_event_sync(this%event)
 
  463         call device_schwarz_extrude(work2_d, 0, one, work1_d, 0, -one, &
 
  464              enx, eny, enz, this%msh%nelv, aux_cmd_queue)
 
  465         call device_schwarz_extrude(work2_d, 2, one, work2_d, 0, one, &
 
  466              enx, eny, enz, this%msh%nelv, aux_cmd_queue)
 
  467         call device_schwarz_toreg3d(e_d, work2_d, this%Xh%lx, &
 
  468              this%msh%nelv, aux_cmd_queue)
 
  470         this%gs_h%bcknd%gs_stream = aux_cmd_queue
 
  471         call this%gs_h%op(e, n, gs_op_add, this%event)
 
  473         call this%bclst%apply_scalar(e, n, strm = aux_cmd_queue)
 
  474         call device_col2(e_d,this%wt_d, n, aux_cmd_queue)
 
  477         if (.not. this%local_gs) 
then 
  478            call device_event_sync(this%event)
 
  479            this%gs_h%bcknd%gs_stream = glb_cmd_queue
 
  482         call this%bclst%apply_scalar(r, n)
 
  487              enx, eny, enz, this%msh%nelv)
 
  488         call this%gs_schwarz%op(work1, ns, gs_op_add)
 
  490              enx, eny, enz, this%msh%nelv)
 
  492         call this%fdm%compute(work2, work1) 
 
  496              enx, eny, enz, this%msh%nelv)
 
  497         call this%gs_schwarz%op(work2, ns, gs_op_add)
 
  499              enx, eny, enz, this%msh%nelv)
 
  501              enx, eny, enz, this%msh%nelv)
 
  506         call this%gs_h%op(e, n, gs_op_add)
 
  507         call this%bclst%apply_scalar(e, n)
 
  509         call schwarz_wt3d(e, this%wt, this%Xh%lx, this%msh%nelv)
 
 
  516    integer, 
intent(in) :: n, nelv
 
  517    real(kind=rp), 
intent(inout) :: e(n,n,n,nelv)
 
  518    real(kind=rp), 
intent(inout) :: wt(n,n,4,3,nelv)
 
  519    integer :: ie, i, j, k
 
  524             e(1,j,k,ie) = e(1,j,k,ie) * wt(j,k,1,1,ie)
 
  525             e(2,j,k,ie) = e(2,j,k,ie) * wt(j,k,2,1,ie)
 
  526             e(n-1,j,k,ie) = e(n-1,j,k,ie) * wt(j,k,3,1,ie)
 
  527             e(n,j,k,ie) = e(n,j,k,ie) * wt(j,k,4,1,ie)
 
  532             e(i,1,k,ie) = e(i,1,k,ie) * wt(i,k,1,2,ie)
 
  533             e(i,2,k,ie) = e(i,2,k,ie) * wt(i,k,2,2,ie)
 
  534             e(i,n-1,k,ie) = e(i,n-1,k,ie) * wt(i,k,3,2,ie)
 
  535             e(i,n,k,ie) = e(i,n,k,ie) * wt(i,k,4,2,ie)
 
  540             e(i,j,1,ie) = e(i,j,1,ie) * wt(i,j,1,3,ie)
 
  541             e(i,j,2,ie) = e(i,j,2,ie) * wt(i,j,2,3,ie)
 
  542             e(i,j,n-1,ie) = e(i,j,n-1,ie) * wt(i,j,3,3,ie)
 
  543             e(i,j,n,ie) = e(i,j,n,ie) * wt(i,j,4,3,ie)