// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %rax
movq %rdi, %rbx
movslq (%rsi), %rbp
leaq (,%rbp,8), %r15
testq %rbp, %rbp
movl %ebp, (%rdi)
movq %rsi, (%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)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x30(%rdi)
movq $-0x1, %rax
movq %r15, %r13
cmovsq %rax, %r13
movq %r13, %rdi
callq 0x2030
movq %rax, 0x60(%rbx)
movq %r13, %rdi
callq 0x2030
movq %rax, 0x68(%rbx)
testq %rbp, %rbp
jle 0x3833
xorl %r14d, %r14d
movslq 0x4(%rbx), %rbp
movq %rbp, %rax
movl $0x88, %ecx
mulq %rcx
movq %rax, %r13
movq $-0x1, %rax
cmovoq %rax, %r13
movq %r13, %rdi
callq 0x2030
movq %rax, %r15
movl $0x0, %eax
testq %rbp, %rbp
je 0x37c0
movq %rbp, %rax
shlq $0x7, %rax
leaq (%rax,%rbp,8), %rbp
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x25b6
addq $0x88, %r12
cmpq %r12, %rbp
jne 0x37a8
movl 0x4(%rbx), %eax
movq 0x60(%rbx), %rcx
movslq %eax, %rbp
movq %rbp, %rax
movl $0x88, %edx
mulq %rdx
movq %rax, %r13
movq %r15, (%rcx,%r14,8)
movq $-0x1, %rax
cmovoq %rax, %r13
movq %r13, %rdi
callq 0x2030
movq %rax, %r15
testl %ebp, %ebp
je 0x3816
movq %rbp, %rax
shlq $0x7, %rax
leaq (%rax,%rbp,8), %rbp
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x25b6
addq $0x88, %r12
cmpq %r12, %rbp
jne 0x3801
movq 0x68(%rbx), %rax
movq %r15, (%rax,%r14,8)
incq %r14
movl (%rbx), %ebp
movslq %ebp, %r15
cmpq %r15, %r14
jl 0x3768
shlq $0x3, %r15
testl %ebp, %ebp
movq $-0x1, %r14
cmovnsq %r15, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0x70(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x78(%rbx)
testl %ebp, %ebp
jle 0x3919
xorl %r14d, %r14d
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x70, %ecx
mulq %rcx
movq %rax, %r12
movq $-0x1, %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
movl $0x0, %eax
testq %r13, %r13
je 0x38b0
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x25d6
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x389b
movl 0x4(%rbx), %eax
movq 0x70(%rbx), %rcx
movslq %eax, %r13
movq %r13, %rax
movl $0x70, %edx
mulq %rdx
movq %rax, %r12
movq %r15, (%rcx,%r14,8)
movq $-0x1, %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r15
testl %r13d, %r13d
je 0x38fc
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r15,%rbp), %rdi
callq 0x25d6
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x38ea
movq 0x78(%rbx), %rax
movq %r15, (%rax,%r14,8)
incq %r14
movl (%rbx), %ebp
movslq %ebp, %r15
cmpq %r15, %r14
jl 0x3863
shlq $0x3, %r15
testl %ebp, %ebp
movq $-0x1, %r14
cmovsq %r14, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x50(%rbx)
testl %ebp, %ebp
jle 0x3a23
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %r12
testq %rax, %rax
cmovsq %r14, %r12
movl %ebp, %r13d
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2030
movq 0x50(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
cmpq %r14, %r13
jne 0x3953
movq %r15, %rdi
callq 0x2030
movq %rax, 0x48(%rbx)
testl %ebp, %ebp
jle 0x3a2f
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
movq $-0x1, %r12
cmovnsq %rcx, %r12
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2030
movq 0x48(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
cmpq %r14, %r13
jne 0x399c
movq %r15, %rdi
callq 0x2030
movq %rax, 0x58(%rbx)
testl %ebp, %ebp
jle 0x3a3b
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
movq $-0x1, %r15
cmovnsq %rcx, %r15
movl %eax, %r14d
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x2030
movq 0x58(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
testl %r14d, %r14d
jle 0x3a19
xorl %ebp, %ebp
movl $0x10, %edi
callq 0x2030
movq 0x58(%rbx), %rcx
movq (%rcx,%r12,8), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
cmpq %rbp, %r14
jne 0x39fb
incq %r12
cmpq %r13, %r12
jne 0x39e4
jmp 0x3a3b
movq %r15, %rdi
callq 0x2030
movq %rax, 0x48(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x58(%rbx)
movq %rbx, %rdi
callq 0x3ae6
movl $0x18, %edi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
movq (%rsp), %r14
movq %r14, %rsi
callq 0x28d0
movq %r15, 0x80(%rbx)
movl $0x20, %edi
callq 0x2190
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 0x2ec4
movq %r15, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
jmp 0x3ab7
movq %rax, %rbx
movl $0x18, %esi
movq %r15, %rdi
callq 0x21a0
jmp 0x3ade
jmp 0x3ac3
movq %rax, %rbx
movq %r15, %rdi
movq %r12, %rsi
jmp 0x3ad9
jmp 0x3ad0
movq %rax, %rbx
movq %r15, %rdi
movq %r13, %rsi
callq 0x22e0
movq %rbx, %rdi
callq 0x2280