cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 
c Gregor von Laszewski * North East Parallel Architectures Center
c                      * Center for Computational Science, Syracuse University
c                      * 111 College Place * Syracuse, NY 13244-4100
c                      * (315) 443-4883 * gregor@npac.syr.edu 
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      subroutine SendResult(m,n,PanelSize,lda,ipiv,a,me,
     $     processors,
     $     MsgBlock)

      include 'lu_const.f'
      integer m,n,lda,me,PanelSize
      integer ipiv(*), i,processors
      real a(LDA,*)

      real MsgBlock(*)


      integer Lx0,Ly0,Lx1,Ly1
      integer MsgLength,MsgDest,MsgType, dummy

      resid = -1.0
      MsgType = MEndPanel
      MsgDest = 0

      if (Processors .gt.1) then
         if (me .eq. 0) then
            do i=1,(n/PanelSize/Processors)*(Processors -1)
               call RecvMsg3 (MsgBlock, MsgLength, MsgType, dummy,me)
               call GetMsgBlock(A,LDA,Lx0,Ly0,Lx1,Ly1,MsgBlock,
     $              ipiv,PanelSize)
            end do


         else
            
            Ly0 =1
            Lx0 = me*PanelSize + 1
            Ly1 = m
            Lx1 = Lx0 + PanelSize - 1
            do i=1,n/Processors/PanelSize
               call GenMsgBlock (A,LDA, Lx0,Ly0,Lx1,Ly1,ipiv,PanelSize,
     $              MsgLength,MsgBlock)
               call SendMsg3 (MsgBlock, MsgLength, MsgType, me, MsgDest)
               Lx0 = Lx0 + PanelSize* Processors
               Lx1 = Lx0 + PanelSize - 1
            end do
         end if
      end if

      return
      end
