// File: Gilaverbuch[P]FD_2D_WAVE/Field.cpp
// Function: Field::print_to_file(int, int, double**, double*, double*, int)
void Field::print_to_file(int size_x, int size_y, double **A, double *pos_x, double *pos_y, int itteration){

	int ii, jj;
    std::ofstream ofile;

    std::cout << " printing results " << std::endl;

    ofile.open("wave_signal"+std::to_string(itteration)+".txt"); 


    for (ii=0; ii<size_y; ii=ii+5){
    	for (jj=0; jj<size_x; jj=jj+5){

         	// std::cout << ii << " " << jj << " " <<  pos_x[jj] << " " << pos_y[ii] << std::endl;
         	ofile << pos_x[jj] << " " << pos_y[ii] << " " << A[ii][jj] << std::endl;
       }
   }
   // j=20;
   // for (i=0; i<size_y; i++){

   //   ofile << pos_y[i] << " " << A[i][j] << std::endl;
   // }
    ofile.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x22b0
movq 0x5821(%rip), %rdi      # 0xafd8
leaq 0x1a37(%rip), %rsi      # 0x71f5
callq 0x21a0
movq %rax, -0x2a8(%rbp)
jmp 0x57cc
movq -0x2a8(%rbp), %rdi
movq 0x57ee(%rip), %rsi      # 0xafc8
callq 0x21d0
jmp 0x57e1
movl 0x10(%rbp), %esi
leaq -0x2a0(%rbp), %rdi
callq 0x5ca0
jmp 0x57f2
leaq 0x1a0f(%rip), %rsi      # 0x7208
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rdx
callq 0x5c50
jmp 0x580e
leaq 0x19b5(%rip), %rdx      # 0x71ca
leaq -0x260(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x5c00
jmp 0x582a
leaq -0x230(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x10, %edx
callq 0x20c0
jmp 0x5844
leaq -0x260(%rbp), %rdi
callq 0x2100
leaq -0x280(%rbp), %rdi
callq 0x2100
leaq -0x2a0(%rbp), %rdi
callq 0x2100
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x59e0
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x59d0
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq -0x230(%rbp), %rdi
callq 0x2320
movq %rax, -0x2b0(%rbp)
jmp 0x58b0
movq -0x2b0(%rbp), %rdi
leaq 0x1918(%rip), %rsi      # 0x71d6
callq 0x21a0
movq %rax, -0x2b8(%rbp)
jmp 0x58cc
movq -0x2b8(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x2320
movq %rax, -0x2c0(%rbp)
jmp 0x58ee
movq -0x2c0(%rbp), %rdi
leaq 0x18da(%rip), %rsi      # 0x71d6
callq 0x21a0
movq %rax, -0x2c8(%rbp)
jmp 0x590a
movq -0x2c8(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x2320
movq %rax, -0x2d0(%rbp)
jmp 0x5934
movq -0x2d0(%rbp), %rdi
movq 0x5686(%rip), %rsi      # 0xafc8
callq 0x21d0
jmp 0x5949
jmp 0x594b
movl -0x30(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x30(%rbp)
jmp 0x5882
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x5a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x59c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x59b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x2100
leaq -0x280(%rbp), %rdi
callq 0x2100
leaq -0x2a0(%rbp), %rdi
callq 0x2100
jmp 0x5a03
jmp 0x59d2
movl -0x2c(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x2c(%rbp)
jmp 0x586f
leaq -0x230(%rbp), %rdi
callq 0x2260
jmp 0x59ee
leaq -0x230(%rbp), %rdi
callq 0x2270
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
leaq -0x230(%rbp), %rdi
callq 0x2270
movq -0x238(%rbp), %rdi
callq 0x22e0
nopl (%rax,%rax)