// File: tlestang[P]IW_gene/Walls.cpp
// Function: BottomWall::TemperatureBC(VelSite**, ThermalSite**, double**, double***)
void BottomWall::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 Tsup, rho, ub[2], usup[2];
  for (int i=0;i<nbNodes;i++)
    {
      double eu;
      x = nodes[i][0]; y = nodes[i][1];

      thermalSites[x][y+1].computeRhoAndU(Tsup);
      velSites[x][y+1].computeRhoAndU(rho, usup);
      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] = (Tsup/4.)*(1.+ 2.*eu) + thermalSites[x][y+1].f[k]
	    - thermalSites[x][y+1].fEq(k,Tsup,usup);
	}
    }
}

// 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 0x492f(%rip), %rax      # 0x91a0
movq %rax, -0x50(%rbp)
movq 0x492c(%rip), %rax      # 0x91a8
movq %rax, -0x48(%rbp)
movq 0x4929(%rip), %rax      # 0x91b0
movq %rax, -0x40(%rbp)
movq 0x4926(%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 0x4aa6
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
addl $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
addl $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 0x4a90
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 0x475e(%rip), %xmm1     # 0x9120
divsd %xmm1, %xmm0
movsd -0xa0(%rbp), %xmm2
addsd %xmm2, %xmm2
movsd 0x464e(%rip), %xmm1     # 0x9028
addsd %xmm1, %xmm2
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x58(%rbp), %ecx
addl $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
addl $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 0x4974
jmp 0x4a92
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x48a8
addq $0xc0, %rsp
popq %rbp
retq
nop