// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, %r15
xorpd %xmm0, %xmm0
movupd %xmm0, 0x80(%rdi)
movupd %xmm0, 0x70(%rdi)
movupd %xmm0, 0x60(%rdi)
movupd %xmm0, 0x50(%rdi)
movq $0x0, 0x90(%rdi)
movq 0x49e4(%rip), %r14      # 0x6fd8
leaq 0x2a09(%rip), %rsi      # 0x5004
movl $0x3d, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x49b2(%rip), %rdi      # 0x6fd8
callq 0x2040
movq %rax, %rdi
callq 0x20d0
leaq -0x2c8(%rbp), %rdi
callq 0x21a0
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x29df(%rip), %rsi      # 0x5038
leaq -0x2c8(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
movq %r15, -0x30(%rbp)
callq 0x20b0
leaq -0xc0(%rbp), %rbx
leaq -0x60(%rbp), %r13
leaq -0x50(%rbp), %r15
leaq -0x70(%rbp), %r12
movq -0x2c8(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x22a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x26f6
movq %r13, -0x70(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x32b8
movq %r12, %rsi
callq 0x28c4
movsd %xmm0, (%rbx)
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x26f0
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
addq $0x8, %rbx
jmp 0x2684
cvttsd2si -0xc0(%rbp), %eax
movq -0x30(%rbp), %r15
movl %eax, 0x28(%r15)
cvttsd2si -0xb8(%rbp), %eax
movl %eax, 0x8(%r15)
cvttsd2si -0xb0(%rbp), %eax
movl %eax, 0xc(%r15)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, 0x48(%r15)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, 0x38(%r15)
movsd -0x98(%rbp), %xmm0
movsd %xmm0, 0x40(%r15)
cvttsd2si -0x90(%rbp), %eax
movl %eax, 0x1c(%r15)
cvttsd2si -0x88(%rbp), %eax
movl %eax, 0x20(%r15)
cvttsd2si -0x80(%rbp), %eax
movl %eax, 0x24(%r15)
movq %r15, %rdi
callq 0x2a76
movslq 0x18(%r15), %rdi
movq 0x50(%r15), %rax
movl -0x4(%rax,%rdi,4), %ecx
movl 0x8(%r15), %esi
movl %ecx, %eax
cltd
idivl %esi
movl %ecx, (%r15)
movl %eax, 0x10(%r15)
movl %eax, 0x14(%r15)
testq %rdi, %rdi
jle 0x27be
movq 0x80(%r15), %rax
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
leaq -0x40(%rbp), %rdx
movsd (%rax,%rcx,8), %xmm0
maxsd %xmm1, %xmm0
incq %rcx
movapd %xmm0, %xmm1
cmpq %rcx, %rdi
jne 0x27a7
jmp 0x27c6
xorpd %xmm0, %xmm0
leaq -0x40(%rbp), %rdx
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd 0x48(%r15), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%r15)
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%r15), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4(%r15)
movq -0x50(%rbp), %rdi
cmpq %rdx, %rdi
je 0x2807
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x2c8(%rbp), %rdi
callq 0x2050
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2829
jmp 0x2848
movq %rax, %r14
jmp 0x2874
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x284b
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x284b
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2864
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x2c8(%rbp), %rdi
callq 0x2050
movq -0x30(%rbp), %r15
movq 0x80(%r15), %rdi
testq %rdi, %rdi
je 0x288f
movq 0x90(%r15), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x50(%r15), %rbx
movq 0x68(%r15), %rdi
testq %rdi, %rdi
je 0x28a8
movq 0x78(%r15), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x28bc
movq 0x60(%r15), %rsi
subq %rdi, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2270