// File: /workspace/github_cpp_makefile_star2_O2/tlestang[P]IW_gene/LatticeBoltzmann.cpp
// Function: LatticeBoltzmann::LatticeBoltzmann(int const*, double const*, double, double, int, double)
LatticeBoltzmann::LatticeBoltzmann(const int d[2], const double omega_[2],
				   double coef_force_, double u0_, int h_, double N2_)
{

  dims[0] = d[0]; dims[1] = d[1];
  omega[0] = omega_[0];
  omega[1] = omega_[1];
  coef_force = coef_force_;
  u0 = u0_; N2 = N2_; h = h_;

  velSites = new VelSite*[dims[0]];
  velSites_ = new VelSite*[dims[0]];

  for (int i=0;i<dims[0];i++)
    {
      velSites[i] = new VelSite[dims[1]];
      velSites_[i] = new VelSite[dims[1]];
    }

  thermalSites = new ThermalSite*[dims[0]];
  thermalSites_ = new ThermalSite*[dims[0]];

  for (int i=0;i<dims[0];i++)
    {
      thermalSites[i] = new ThermalSite[dims[1]];
      thermalSites_[i] = new ThermalSite[dims[1]];
    }
  
  // allocate memory for T and rho
  T = new double*[dims[0]];
  for (int x=0; x<dims[0]; x++)
    T[x] = new double[dims[1]];

    rho = new double*[dims[0]];
  for (int x=0; x<dims[0]; x++)
    rho[x] = new double[dims[1]];
	
  // allocate memory for velocity
  u = new double**[dims[0]];
  for (int x=0; x<dims[0]; x++)
    {
      u[x] = new double*[dims[1]];
		
      for (int y=0; y<dims[1]; y++)
	u[x][y] = new double[2];
    }

  generateGeometry();
  
  w = new TopWall(d);
  topo = new Topography(d, h, u, velSites, velSites_);
  

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq (%rsi), %r12
leaq (,%r12,8), %r15
testq %r12, %r12
movl %r12d, (%rdi)
movq %rsi, 0x8(%rsp)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rdi)
movsd (%rdx), %xmm3
movsd %xmm3, 0x8(%rdi)
movsd 0x8(%rdx), %xmm3
movsd %xmm3, 0x10(%rdi)
movsd %xmm0, 0x18(%rdi)
movsd %xmm1, 0x20(%rdi)
movsd %xmm2, 0x28(%rdi)
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x30(%rdi)
pushq $-0x1
popq %rax
cmovsq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x60(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x68(%rbx)
xorl %r14d, %r14d
movslq %r12d, %rax
cmpq %rax, %r14
jge 0x3779
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x88, %ecx
mulq %rcx
movq %rax, %r12
pushq $-0x1
popq %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
testq %r13, %r13
je 0x3716
imulq $0x88, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x258e
addq $0x88, %rbp
cmpq %rbp, %r13
jne 0x36fc
movl 0x4(%rbx), %eax
jmp 0x3718
xorl %eax, %eax
movq 0x60(%rbx), %rcx
movslq %eax, %r13
movq %r13, %rax
movl $0x88, %edx
mulq %rdx
movq %rax, %r12
movq %r15, (%rcx,%r14,8)
pushq $-0x1
popq %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
testl %r13d, %r13d
je 0x3766
imulq $0x88, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x258e
addq $0x88, %rbp
cmpq %rbp, %r13
jne 0x3751
movq 0x68(%rbx), %rax
movq %r15, (%rax,%r14,8)
incq %r14
movl (%rbx), %r12d
jmp 0x36be
leaq (,%rax,8), %r15
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x70(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x78(%rbx)
xorl %r14d, %r14d
movslq %r12d, %r13
cmpq %r13, %r14
jge 0x3850
movslq 0x4(%rbx), %r13
movq %r13, %rax
pushq $0x70
popq %rcx
mulq %rcx
movq %rax, %r12
pushq $-0x1
popq %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
testq %r13, %r13
je 0x37f5
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x25ae
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x37de
movl 0x4(%rbx), %eax
jmp 0x37f7
xorl %eax, %eax
movq 0x70(%rbx), %rcx
movslq %eax, %r13
movq %r13, %rax
pushq $0x70
popq %rdx
mulq %rdx
movq %rax, %r12
movq %r15, (%rcx,%r14,8)
pushq $-0x1
popq %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
testl %r13d, %r13d
je 0x383d
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x25ae
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x382b
movq 0x78(%rbx), %rax
movq %r15, (%rax,%r14,8)
incq %r14
movl (%rbx), %r12d
jmp 0x37a5
leaq (,%r13,8), %r15
xorl %r14d, %r14d
testl %r13d, %r13d
pushq $-0x1
popq %rbp
cmovsq %rbp, %r15
cmovlel %r14d, %r13d
movq %r15, %rdi
callq 0x2030
movq %rax, 0x50(%rbx)
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %r12
testq %rax, %rax
cmovsq %rbp, %r12
cmpq %r14, %r13
je 0x38a2
movq %r12, %rdi
callq 0x2030
movq 0x50(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
jmp 0x3888
movq %r15, %rdi
callq 0x2030
movq %rax, 0x48(%rbx)
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %r12
testq %rax, %rax
pushq $-0x1
popq %rax
cmovsq %rax, %r12
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x38e1
movq %r12, %rdi
callq 0x2030
movq 0x48(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
jmp 0x38c7
movq %r15, %rdi
callq 0x2030
movq %rax, 0x58(%rbx)
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %rdx
testq %rax, %rax
pushq $-0x1
popq %rcx
cmovsq %rcx, %rdx
movq %rdx, 0x10(%rsp)
xorl %r14d, %r14d
testl %eax, %eax
movl $0x0, %ebp
cmovgl %eax, %ebp
pushq $0x10
popq %r12
cmpq %r13, %r14
je 0x3956
movq 0x10(%rsp), %rdi
callq 0x2030
movq 0x58(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
xorl %r15d, %r15d
cmpq %r15, %rbp
je 0x3951
movq %r12, %rdi
callq 0x2030
movq 0x58(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
jmp 0x3933
incq %r14
jmp 0x3919
movq %rbx, %rdi
callq 0x39f0
pushq $0x18
popq %rdi
callq 0x2160
movq %rax, %r15
movq %rax, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x2894
movq %r15, 0x80(%rbx)
pushq $0x20
popq %rdi
callq 0x2160
cvttsd2si 0x30(%rbx), %edx
movq %rax, %r15
movq 0x58(%rbx), %rcx
movq 0x60(%rbx), %r8
movq 0x68(%rbx), %r9
movq %rax, %rdi
movq %r14, %rsi
callq 0x2e78
movq %r15, 0x88(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x20
jmp 0x39c9
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x2170
jmp 0x39e8
jmp 0x39da
jmp 0x39da
jmp 0x39da
movq %rax, %rbx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2250