// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
leaq (,%rax,8), %r15
testq %rax, %rax
movl %eax, (%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
cmovsq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x60(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x68(%rbx)
movl (%rbx), %eax
testl %eax, %eax
jle 0x3847
xorl %r14d, %r14d
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x88, %ecx
mulq %rcx
movq %rax, %r15
movq $-0x1, %rax
cmovoq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, %r12
testq %r13, %r13
je 0x37d9
movq %r13, %rax
shlq $0x7, %rax
leaq (%rax,%r13,8), %r13
xorl %ebp, %ebp
leaq (%r12,%rbp), %rdi
callq 0x25b6
addq $0x88, %rbp
cmpq %rbp, %r13
jne 0x37c4
movq 0x60(%rbx), %rax
movq %r12, (%rax,%r14,8)
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x88, %ecx
mulq %rcx
movq %rax, %r15
movq $-0x1, %rax
cmovoq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, %r12
testq %r13, %r13
je 0x3830
movq %r13, %rax
shlq $0x7, %rax
leaq (%rax,%r13,8), %r13
xorl %ebp, %ebp
leaq (%r12,%rbp), %rdi
callq 0x25b6
addq $0x88, %rbp
cmpq %rbp, %r13
jne 0x381b
movq 0x68(%rbx), %rax
movq %r12, (%rax,%r14,8)
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x378a
cltq
leaq (,%rax,8), %r15
testl %eax, %eax
movq $-0x1, %rax
cmovsq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x70(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x78(%rbx)
movl (%rbx), %ebp
testl %ebp, %ebp
jle 0x392c
xorl %r14d, %r14d
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x70, %ecx
mulq %rcx
movq %rax, %r15
movq $-0x1, %rax
cmovoq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, %r12
testq %r13, %r13
je 0x38c8
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r12,%rbp), %rdi
callq 0x25d6
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x38b6
movq 0x70(%rbx), %rax
movq %r12, (%rax,%r14,8)
movslq 0x4(%rbx), %r13
movq %r13, %rax
movl $0x70, %ecx
mulq %rcx
movq %rax, %r15
movq $-0x1, %rax
cmovoq %rax, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, %r12
testq %r13, %r13
je 0x3915
imulq $0x70, %r13, %r13
xorl %ebp, %ebp
leaq (%r12,%rbp), %rdi
callq 0x25d6
addq $0x70, %rbp
cmpq %rbp, %r13
jne 0x3903
movq 0x78(%rbx), %rax
movq %r12, (%rax,%r14,8)
incq %r14
movslq (%rbx), %rbp
cmpq %rbp, %r14
jl 0x3883
movslq %ebp, %r12
leaq (,%r12,8), %r15
testl %r12d, %r12d
movq $-0x1, %r14
cmovsq %r14, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x50(%rbx)
movl %ebp, %r13d
testl %r12d, %r12d
jle 0x3987
movslq 0x4(%rbx), %rax
leaq (,%rax,8), %r12
testq %rax, %rax
cmovsq %r14, %r12
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2030
movq 0x50(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
cmpq %r14, %r13
jne 0x396f
movq %r15, %rdi
callq 0x2030
movq %rax, 0x48(%rbx)
testl %ebp, %ebp
jle 0x39cc
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 0x39b4
movq %r15, %rdi
callq 0x2030
movq %rax, 0x58(%rbx)
testl %ebp, %ebp
jle 0x3a39
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 0x3a31
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 0x3a13
incq %r12
cmpq %r13, %r12
jne 0x39fc
movq %rbx, %rdi
callq 0x3adc
movl $0x18, %edi
callq 0x2190
movq %rax, %r15
movq %rax, %rdi
movq (%rsp), %r14
movq %r14, %rsi
callq 0x28dc
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 0x2ee8
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 0x3ab5
movq %rax, %rbx
movl $0x18, %esi
movq %r15, %rdi
callq 0x21a0
jmp 0x3ad3
jmp 0x3ac5
jmp 0x3ac5
jmp 0x3ac5
movq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x22e0
movq %rbx, %rdi
callq 0x2280
nop