// File: tlestang[P]IW_gene/Walls.cpp
// Function: TopWall::TemperatureBC(VelSite**, ThermalSite**, double**, double***)
void TopWall::TemperatureBC(VelSite **velSites, ThermalSite **thermalSites,
				double **T, double ***u)
{
  int c[4][2] = {{1,0}, {0,1}, {-1,0}, {0, -1}};
  int x,y; 
  double Tcold = 0.0;
  double Tinf, rho, ub[2], uinf[2];
  for (int i=0;i<nbNodes;i++)
    {
      double eu;
      x = nodes[i][0]; y = nodes[i][1];

      thermalSites[x][y-1].computeRhoAndU(Tinf);
      velSites[x][y-1].computeRhoAndU(rho, uinf);
      velSites[x][y].computeRhoAndU(rho, ub);
      
      for (int k=0;k<4;k++)
	{
	  eu = c[k][0]*ub[0] + c[k][1]*ub[1];
	  thermalSites[x][y].f[k] = (Tinf/4.)*(1.+2.*eu) + thermalSites[x][y-1].f[k]
	    - thermalSites[x][y-1].fEq(k,Tinf,uinf);
	}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq 0x4ebf(%rip), %rax      # 0x91a0
movq %rax, -0x50(%rbp)
movq 0x4ebc(%rip), %rax      # 0x91a8
movq %rax, -0x48(%rbp)
movq 0x4eb9(%rip), %rax      # 0x91b0
movq %rax, -0x40(%rbp)
movq 0x4eb6(%rip), %rax      # 0x91b8
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x0, -0x94(%rbp)
movq -0xb0(%rbp), %rcx
movl -0x94(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x4516
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x94(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
movl %ecx, -0x54(%rbp)
movq 0x10(%rax), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x58(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x70, %rax, %rax
addq %rax, %rdi
movq (%rdi), %rax
leaq -0x68(%rbp), %rsi
callq *0x20(%rax)
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x58(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x88, %rax, %rax
addq %rax, %rdi
leaq -0x90(%rbp), %rdx
movq (%rdi), %rax
leaq -0x70(%rbp), %rsi
callq *0x8(%rax)
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x58(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rdi
leaq -0x80(%rbp), %rdx
movq (%rdi), %rax
leaq -0x70(%rbp), %rsi
callq *0x8(%rax)
movl $0x0, -0xa4(%rbp)
cmpl $0x4, -0xa4(%rbp)
jge 0x4500
movslq -0xa4(%rbp), %rax
cvtsi2sdl -0x50(%rbp,%rax,8), %xmm0
movsd -0x80(%rbp), %xmm2
movslq -0xa4(%rbp), %rax
cvtsi2sdl -0x4c(%rbp,%rax,8), %xmm1
mulsd -0x78(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x68(%rbp), %xmm0
movsd 0x4cee(%rip), %xmm1     # 0x9120
divsd %xmm1, %xmm0
movsd -0xa0(%rbp), %xmm2
addsd %xmm2, %xmm2
movsd 0x4bde(%rip), %xmm1     # 0x9028
addsd %xmm1, %xmm2
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x58(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movslq -0xa4(%rbp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x58(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x70, %rax, %rax
addq %rax, %rdi
movl -0xa4(%rbp), %esi
movsd -0x68(%rbp), %xmm0
leaq -0x90(%rbp), %rdx
movq (%rdi), %rax
callq *(%rax)
movaps %xmm0, %xmm1
movsd -0xb8(%rbp), %xmm0
subsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x58(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movslq -0xa4(%rbp), %rcx
movsd %xmm0, 0x8(%rax,%rcx,8)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x43e4
jmp 0x4502
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x4318
addq $0xc0, %rsp
popq %rbp
retq
nop