// File: /workspace/github_cpp_makefile_star2_O2/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 $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x80(%rdi)
movupd %xmm0, 0x70(%rdi)
movupd %xmm0, 0x60(%rdi)
movupd %xmm0, 0x50(%rdi)
andq $0x0, 0x90(%rdi)
movq 0x3a1b(%rip), %rdi      # 0x5fd8
leaq 0x1a40(%rip), %rsi      # 0x4004
callq 0x2170
movq %rax, %rdi
callq 0x20c0
leaq -0x2b8(%rbp), %rdi
callq 0x21a0
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1a44(%rip), %rsi      # 0x4038
leaq -0x2b8(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x20f0
leaq -0x70(%rbp), %r13
leaq -0x2b8(%rbp), %r14
leaq -0x90(%rbp), %r15
leaq -0xb0(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x2040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x265c
movq %r12, %rdi
movq %r15, %rsi
callq 0x21e0
movq %r12, %rsi
callq 0x27a8
movsd %xmm0, (%r13)
movq %r12, %rdi
callq 0x20a0
addq $0x8, %r13
jmp 0x261c
cvttsd2si -0x70(%rbp), %eax
movl %eax, 0x28(%rbx)
cvttsd2si -0x68(%rbp), %eax
movl %eax, 0x8(%rbx)
cvttsd2si -0x60(%rbp), %eax
movl %eax, 0xc(%rbx)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, 0x48(%rbx)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, 0x40(%rbx)
cvttsd2si -0x40(%rbp), %eax
movl %eax, 0x1c(%rbx)
cvttsd2si -0x38(%rbp), %eax
movl %eax, 0x20(%rbx)
cvttsd2si -0x30(%rbp), %eax
movl %eax, 0x24(%rbx)
movq %rbx, %rdi
callq 0x28da
movslq 0x18(%rbx), %rdi
movq 0x50(%rbx), %rax
movl -0x4(%rax,%rdi,4), %eax
movl %eax, (%rbx)
movl 0x8(%rbx), %ecx
cltd
idivl %ecx
movl %eax, 0x10(%rbx)
movl %eax, 0x14(%rbx)
movq 0x80(%rbx), %rax
xorl %edx, %edx
testl %edi, %edi
movl $0x0, %esi
cmovgl %edi, %esi
xorpd %xmm0, %xmm0
cmpq %rdx, %rsi
je 0x26fa
movsd (%rax,%rdx,8), %xmm1
maxsd %xmm0, %xmm1
incq %rdx
movapd %xmm1, %xmm0
jmp 0x26e3
cvtsi2sd %ecx, %xmm1
mulsd 0x48(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rbx)
cvtsi2sdl 0x28(%rbx), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4(%rbx)
leaq -0x90(%rbp), %rdi
callq 0x20a0
leaq -0x2b8(%rbp), %rdi
callq 0x2060
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x274a
jmp 0x2760
movq %rax, %r14
jmp 0x277b
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
callq 0x20a0
jmp 0x2763
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x20a0
leaq -0x2b8(%rbp), %rdi
callq 0x2060
leaq 0x50(%rbx), %r15
leaq 0x80(%rbx), %rdi
addq $0x68, %rbx
callq 0x24fe
movq %rbx, %rdi
callq 0x24fe
movq %r15, %rdi
callq 0x253c
movq %r14, %rdi
callq 0x2270
nop