// File: Gilaverbuch[P]FD_2D_WAVE/model_parameters.cpp
// Function: model_parameters::model_parameters()
model_parameters::model_parameters(){

	std::cout << "Cuctum default constructor. Reading parameters from input.txt" << std::endl;

	std::ifstream inFile;
	std::string line;
	double data[9], v_max;
	int i=0;



	inFile.open("input.txt");
	while(std::getline(inFile, line)) 
	  {
	  	data[i] = extractNumbersWords(line);
	  	i = i + 1;
	  	// std::cout << extractNumbersWords(line) << " " << data[i] << std::endl;
	  }

	time = int(data[0]);  
	dx = int(data[1]);
	dy = int(data[2]); 
	stability = data[3];
	frequency = data[4];
	source_time_delay = data[5];
	x_s = data[6];
	y_s = data[7];
	print_int = data[8];

	read_vel_profile();
	l = x_range[layers-1];
	elements_x = int (l/dx);
	elements_y = elements_x;

	v_max = 0;
	for (i=0; i<layers; i++){
		if (velocity_range[i] > v_max){
			v_max = velocity_range[i];
		}
	}

	dt = (stability * dx)/v_max;
	nsteps = time/dt; 

	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
addq $0x50, %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x3680
movq -0x2d8(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x36a0
movq -0x2d8(%rbp), %rdi
subq $-0x80, %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x36a0
movq 0x8559(%rip), %rdi      # 0xafd8
leaq 0x457e(%rip), %rsi      # 0x7004
callq 0x21a0
movq %rax, -0x2c8(%rbp)
jmp 0x2a94
movq -0x2c8(%rbp), %rdi
movq 0x8526(%rip), %rsi      # 0xafc8
callq 0x21d0
jmp 0x2aa9
leaq -0x220(%rbp), %rdi
callq 0x2200
jmp 0x2ab7
leaq -0x240(%rbp), %rdi
callq 0x2250
movl $0x0, -0x29c(%rbp)
leaq 0x4564(%rip), %rsi      # 0x7038
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x2110
jmp 0x2ae7
jmp 0x2ae9
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2050
movq %rax, -0x2f0(%rbp)
jmp 0x2b05
movq -0x2f0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2220
movb %al, -0x2f1(%rbp)
jmp 0x2b23
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0x2b32
jmp 0x2bdb
leaq -0x2c0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x20b0
jmp 0x2b47
movq -0x2d8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x2dc0
movsd %xmm0, -0x300(%rbp)
jmp 0x2b64
movsd -0x300(%rbp), %xmm0
movslq -0x29c(%rbp), %rax
movsd %xmm0, -0x290(%rbp,%rax,8)
leaq -0x2c0(%rbp), %rdi
callq 0x2100
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x2ae9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x2d85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x2d6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x2100
jmp 0x2d6d
movq -0x2d8(%rbp), %rdi
cvttsd2si -0x290(%rbp), %eax
movl %eax, 0x28(%rdi)
cvttsd2si -0x288(%rbp), %eax
movl %eax, 0x8(%rdi)
cvttsd2si -0x280(%rbp), %eax
movl %eax, 0xc(%rdi)
movsd -0x278(%rbp), %xmm0
movsd %xmm0, 0x48(%rdi)
movsd -0x270(%rbp), %xmm0
movsd %xmm0, 0x38(%rdi)
movsd -0x268(%rbp), %xmm0
movsd %xmm0, 0x40(%rdi)
cvttsd2si -0x260(%rbp), %eax
movl %eax, 0x1c(%rdi)
cvttsd2si -0x258(%rbp), %eax
movl %eax, 0x20(%rdi)
cvttsd2si -0x250(%rbp), %eax
movl %eax, 0x24(%rdi)
callq 0x2fb0
jmp 0x2c52
movq -0x2d8(%rbp), %rax
movq %rax, %rdi
addq $0x50, %rdi
movl 0x18(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x36c0
movq -0x2d8(%rbp), %rcx
movl (%rax), %eax
movl %eax, (%rcx)
movl (%rcx), %eax
cltd
idivl 0x8(%rcx)
movl %eax, %ecx
movq -0x2d8(%rbp), %rax
movl %ecx, 0x10(%rax)
movl 0x10(%rax), %ecx
movl %ecx, 0x14(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, -0x298(%rbp)
movl $0x0, -0x29c(%rbp)
movq -0x2d8(%rbp), %rcx
movl -0x29c(%rbp), %eax
cmpl 0x18(%rcx), %eax
jge 0x2d19
movq -0x2d8(%rbp), %rdi
addq $0x80, %rdi
movslq -0x29c(%rbp), %rsi
callq 0x36e0
movsd (%rax), %xmm0
ucomisd -0x298(%rbp), %xmm0
jbe 0x2d06
movq -0x2d8(%rbp), %rdi
addq $0x80, %rdi
movslq -0x29c(%rbp), %rsi
callq 0x36e0
movsd (%rax), %xmm0
movsd %xmm0, -0x298(%rbp)
jmp 0x2d08
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x2ca6
movq -0x2d8(%rbp), %rax
movsd 0x48(%rax), %xmm0
cvtsi2sdl 0x8(%rax), %xmm1
mulsd %xmm1, %xmm0
divsd -0x298(%rbp), %xmm0
movsd %xmm0, 0x30(%rax)
cvtsi2sdl 0x28(%rax), %xmm0
divsd 0x30(%rax), %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x4(%rax)
leaq -0x240(%rbp), %rdi
callq 0x2100
leaq -0x220(%rbp), %rdi
callq 0x2070
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x240(%rbp), %rdi
callq 0x2100
leaq -0x220(%rbp), %rdi
callq 0x2070
movq -0x2d0(%rbp), %rdi
callq 0x25f0
movq -0x2e0(%rbp), %rdi
callq 0x25f0
movq -0x2e8(%rbp), %rdi
callq 0x2650
movq -0x10(%rbp), %rdi
callq 0x22e0
nopw %cs:(%rax,%rax)