// File: snesic[P]stochastic_thin_films/film.cpp
// Function: film::film(int, double, double, double, int, double)
film::film(int L, double dx, double dt, double b, int ugao, double sigma): L(L), dx(dx), dt(dt), b(b), angle(ugao), sigma(sigma)
{
    h     = new double [L];
    y     = new double [L];
    q     = new double [L];
    r     = new double [L];
    r_fix = new double [L];
    
    noise = new double [L+2];
    ind   = new int    [L+4];     // Determines boundary conditions
    
    h2    = new double [L];       // To make calculations faster -> h2 = h^2, h3=h^3, ...
    h3    = new double [L];
    y2    = new double [L];
    y3    = new double [L];
    old_sol = new double [L];
    
    a = new double *[L];
    for(int i=0;i<L;i++)
        a[i]=new double [5];

    
    double a_min = 1.0;
    
    A     = 2*(1-cos(PI*ugao/180))*(a_min*b);
    B     = A*(a_min*b); // vdW: The min of vdW potential determins B..
    tol   = 1e-10;
    theta = 0.5;
    create_boundary_conditions(ind, L); // ind - index for h, includes zero-der. boundary conditions
    
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x20(%rbp)
movsd %xmm2, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
movsd %xmm3, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, 0x10(%rax)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, 0x18(%rax)
movl -0xc(%rbp), %ecx
movl %ecx, 0x20(%rax)
cvtsi2sdl -0x2c(%rbp), %xmm0
movsd %xmm0, 0x88(%rax)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, 0xa0(%rax)
movsd 0x5d94(%rip), %xmm0     # 0xa128
movsd %xmm0, 0xa8(%rax)
movsd 0x5d7c(%rip), %xmm0     # 0xa120
movsd %xmm0, 0xb0(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x30(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x38(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x40(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0xc(%rbp), %eax
addl $0x2, %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x70(%rax)
movl -0xc(%rbp), %eax
addl $0x4, %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x80(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x50(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x58(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x60(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x68(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x78(%rax)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x465d
movl $0x28, %edi
callq 0x3030
movq %rax, %rdx
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x462d
movsd 0x59a3(%rip), %xmm0     # 0xa008
movsd %xmm0, -0x48(%rbp)
cvtsi2sdl -0x2c(%rbp), %xmm1
movsd 0x5ac9(%rip), %xmm0     # 0xa140
mulsd %xmm1, %xmm0
movsd 0x5ab5(%rip), %xmm1     # 0xa138
divsd %xmm1, %xmm0
callq 0x34a0
movq -0x50(%rbp), %rax
movsd 0x5970(%rip), %xmm1     # 0xa008
subsd %xmm0, %xmm1
movsd 0x5a8c(%rip), %xmm0     # 0xa130
mulsd %xmm1, %xmm0
movsd -0x48(%rbp), %xmm1
mulsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rax)
movsd 0x90(%rax), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rax)
movsd 0x5a44(%rip), %xmm0     # 0xa128
movsd %xmm0, 0xa8(%rax)
movsd 0x5a2c(%rip), %xmm0     # 0xa120
movsd %xmm0, 0xb0(%rax)
movq 0x80(%rax), %rdi
movl -0xc(%rbp), %esi
callq 0x6d50
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)