// File: bauerj4[P]Riemann1D/src/Context.cpp
// Function: readContext(char*, context_t&)
int readContext(char * PATH, context_t &context)
{
  ifstream file; 
  file.open(PATH,ifstream::in);
  vector<string> tokens;

  if (file.is_open())
    {
      int i=0;
      string line;
      while(getline(file,line))
        {
	  delimitString(tokens,line, " = ");
	  i++;
	}

      for (int j = 0; j < tokens.size(); j++)
	{
	  if(tokens[j] == "MESH_RESOLUTION")
            {
              context.MESH_RESOLUTION =  atoi(tokens[j + 2].c_str());
            }

	  if(tokens[j] == "RHO_L")
	    {
	      context.RHO_L = atof(tokens[j + 2].c_str());
	    }
         
	  if(tokens[j] == "RHO_R")
            {
              context.RHO_R = atof(tokens[j + 2].c_str());
            }

	  if (tokens[j] == "U_L")
	    {
	      context.U_L = atof(tokens[j + 2].c_str());
	    }

          if (tokens[j] == "U_R")
            {
              context.U_R = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "P_L")
            {
              context.P_L = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "P_R")
            {
              context.P_R = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "CFL_NUMBER")
            {
              context.CFL_NUMBER = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "EVOLVE_TIME")
            {
              context.EVOLVE_TIME = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "X0")
            {
              context.X0 = atof(tokens[j + 2].c_str());
            }


          if (tokens[j] == "X1")
            {
              context.X1 = atof(tokens[j + 2].c_str());
            }

          if (tokens[j] == "INITIAL_DISCONTINUITY")
            {
              context.INITIAL_DISCONTINUITY = atof(tokens[j + 2].c_str());
            }



          if(tokens[j] == "SOLUTION_METHOD")
            {
              context.SOLUTION_METHOD = tokens[j + 2];
            }


          if(tokens[j] == "SNAPSHOT_PATH")
            {
              context.SNAPSHOT_PATH = tokens[j + 2];
            }

	  //cout << "Read token is " + tokens[j] << endl;
	}
    }
  file.close();

  return 0;
}

// Assembly:
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdi, 0x2f0(%rsp)
movq %rsi, 0x2e8(%rsp)
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x22b0
movq 0x40(%rsp), %rdi
movq 0x2f0(%rsp), %rsi
movl $0x8, %edx
callq 0x2150
jmp 0x2792
leaq 0xb8(%rsp), %rdi
callq 0x3170
leaq 0xe0(%rsp), %rdi
callq 0x2380
movb %al, 0x3f(%rsp)
jmp 0x27b2
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x27bf
jmp 0x2f15
movl $0x0, 0xb4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x2330
leaq 0xe0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x2060
movq %rax, 0x30(%rsp)
jmp 0x27f3
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2310
movb %al, 0x2f(%rsp)
jmp 0x280d
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x281a
jmp 0x293a
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x20f0
jmp 0x282e
leaq 0x4f(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x23e0
movq 0x20(%rsp), %rdx
leaq 0x15948(%rip), %rsi     # 0x18191
leaq 0x50(%rsp), %rdi
callq 0x3180
jmp 0x2855
leaq 0xb8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x2650
jmp 0x286e
leaq 0x50(%rsp), %rdi
callq 0x2140
leaq 0x4f(%rsp), %rdi
callq 0x2280
leaq 0x70(%rsp), %rdi
callq 0x2140
movl 0xb4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb4(%rsp)
jmp 0x27d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x2f55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x2f48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x2f06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x2921
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x2140
leaq 0x4f(%rsp), %rdi
callq 0x2280
leaq 0x70(%rsp), %rdi
callq 0x2140
jmp 0x2f06
movl $0x0, 0x48(%rsp)
movslq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x3240
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x2ef7
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x1567e(%rip), %rsi     # 0x18004
callq 0x3260
movb %al, 0x17(%rsp)
jmp 0x2991
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x299b
jmp 0x29ce
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2370
movl %eax, %ecx
movq 0x2e8(%rsp), %rax
movl %ecx, (%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x1562a(%rip), %rsi     # 0x18014
callq 0x3260
movb %al, 0x16(%rsp)
jmp 0x29f5
movb 0x16(%rsp), %al
testb $0x1, %al
jne 0x29ff
jmp 0x2a33
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x155cb(%rip), %rsi     # 0x1801a
callq 0x3260
movb %al, 0x15(%rsp)
jmp 0x2a5a
movb 0x15(%rsp), %al
testb $0x1, %al
jne 0x2a64
jmp 0x2a98
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x20(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x1556c(%rip), %rsi     # 0x18020
callq 0x3260
movb %al, 0x14(%rsp)
jmp 0x2abf
movb 0x14(%rsp), %al
testb $0x1, %al
jne 0x2ac9
jmp 0x2afd
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x28(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x1550b(%rip), %rsi     # 0x18024
callq 0x3260
movb %al, 0x13(%rsp)
jmp 0x2b24
movb 0x13(%rsp), %al
testb $0x1, %al
jne 0x2b2e
jmp 0x2b62
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x30(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x154aa(%rip), %rsi     # 0x18028
callq 0x3260
movb %al, 0x12(%rsp)
jmp 0x2b89
movb 0x12(%rsp), %al
testb $0x1, %al
jne 0x2b93
jmp 0x2bc7
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x38(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x15449(%rip), %rsi     # 0x1802c
callq 0x3260
movb %al, 0x11(%rsp)
jmp 0x2bee
movb 0x11(%rsp), %al
testb $0x1, %al
jne 0x2bf8
jmp 0x2c2c
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x40(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x153e8(%rip), %rsi     # 0x18030
callq 0x3260
movb %al, 0x10(%rsp)
jmp 0x2c53
movb 0x10(%rsp), %al
testb $0x1, %al
jne 0x2c5d
jmp 0x2c91
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x50(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x1538e(%rip), %rsi     # 0x1803b
callq 0x3260
movb %al, 0xf(%rsp)
jmp 0x2cb8
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x2cc2
jmp 0x2cf6
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x58(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x15335(%rip), %rsi     # 0x18047
callq 0x3260
movb %al, 0xe(%rsp)
jmp 0x2d1d
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x2d27
jmp 0x2d5b
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x152d3(%rip), %rsi     # 0x1804a
callq 0x3260
movb %al, 0xd(%rsp)
jmp 0x2d82
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x2d8c
jmp 0x2dc0
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x15271(%rip), %rsi     # 0x1804d
callq 0x3260
movb %al, 0xc(%rsp)
jmp 0x2de7
movb 0xc(%rsp), %al
testb $0x1, %al
jne 0x2df1
jmp 0x2e25
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2300
movq 0x2e8(%rsp), %rax
movsd %xmm0, 0x48(%rax)
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x15222(%rip), %rsi     # 0x18063
callq 0x3260
movb %al, 0xb(%rsp)
jmp 0x2e4c
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x2e56
jmp 0x2e85
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rsi
movq 0x2e8(%rsp), %rdi
addq $0x60, %rdi
callq 0x2030
jmp 0x2e83
jmp 0x2e85
movslq 0x48(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rdi
leaq 0x151d2(%rip), %rsi     # 0x18073
callq 0x3260
movb %al, 0xa(%rsp)
jmp 0x2eac
movb 0xa(%rsp), %al
testb $0x1, %al
jne 0x2eb6
jmp 0x2ee5
movl 0x48(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x3290
movq %rax, %rsi
movq 0x2e8(%rsp), %rdi
subq $-0x80, %rdi
callq 0x2030
jmp 0x2ee3
jmp 0x2ee5
jmp 0x2ee7
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x2942
leaq 0x90(%rsp), %rdi
callq 0x2140
jmp 0x2f15
leaq 0x90(%rsp), %rdi
callq 0x2140
jmp 0x2f48
leaq 0xe0(%rsp), %rdi
callq 0x2070
jmp 0x2f24
leaq 0xb8(%rsp), %rdi
callq 0x32b0
leaq 0xe0(%rsp), %rdi
callq 0x2090
xorl %eax, %eax
addq $0x2f8, %rsp            # imm = 0x2F8
retq
leaq 0xb8(%rsp), %rdi
callq 0x32b0
leaq 0xe0(%rsp), %rdi
callq 0x2090
movq 0xd8(%rsp), %rdi
callq 0x23d0
nop