// File: suhasjains[P]AMR-Solver/src/input.cpp
// Function: std::read_scalar_field_Bc(std::basic_ifstream<char, std::char_traits<char>>&, int)
void read_scalar_field_Bc(ifstream& file, int number) {


	int blocknumber;	
	string line, str;
	string eastbc, westbc, northbc, southbc, topbc, bottombc;

		
	myOctree::FieldBc **bc;
	double **bcval;
	bc = new myOctree::FieldBc* [3];
	bcval = new double* [3];
	for(int i = 0; i < 3; i++) {
     		bc[i] = new myOctree::FieldBc [2];	
		bcval[i] = new double [2];
	}

	myOctree::FieldBc east_bc, west_bc, north_bc, south_bc, top_bc, bottom_bc;
	double eastbcval, westbcval, northbcval, southbcval, topbcval, bottombcval;

	//Skips if a line is empty		
	getline(file, line);
	while(line.empty()) {
		getline(file, line);
	}

	if(line=="scalar_field_boundary_conditions") {

		file >> str;
                if(str != "{") {
                        cerr << "Expected an opening bracket" <<endl;
                        exit(1);
                }
		
		cerr << "\nSetting scalar field boundary conditions" << endl;

		while(file) { 
	
		
			if(file >> str && str == "}") break;
                        //else    myOctree::scalar_fields.push_back(str);
			cerr << str << endl;

			for(int i = 0; i < number ; ++i) {
		
				file >> blocknumber; 
				file >> eastbc >> westbc >> northbc >> southbc >> topbc >> bottombc;
				file >> bcval[0][0] >> bcval[0][1] >> bcval[1][0] >> bcval[1][1] >> bcval[2][0] >> bcval[2][1];
				
				bc[myOctree::XDIR][myOctree::RIGHT] = string_to_FieldBc(eastbc);		
				bc[myOctree::XDIR][myOctree::LEFT] = string_to_FieldBc(westbc);		
				bc[myOctree::YDIR][myOctree::RIGHT] = string_to_FieldBc(northbc);		
				bc[myOctree::YDIR][myOctree::LEFT] = string_to_FieldBc(southbc);		
				bc[myOctree::ZDIR][myOctree::RIGHT] = string_to_FieldBc(topbc);		
				bc[myOctree::ZDIR][myOctree::LEFT] = string_to_FieldBc(bottombc);		

				//cerr << blocknumber << eastbc << westbc << northbc << southbc << topbc << bottombc << endl;

				/*add a function here which sets boundary condition and boundary values*/
				myOctree::set_FieldBc_FieldBcVal(blocknumber, str, bc, bcval);
			}
		}	
	}

	delete [] bc;
	delete [] bcval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3360
leaq -0x50(%rbp), %rdi
callq 0x3360
leaq -0x70(%rbp), %rdi
callq 0x3360
leaq -0x90(%rbp), %rdi
callq 0x3360
leaq -0xb0(%rbp), %rdi
callq 0x3360
leaq -0xd0(%rbp), %rdi
callq 0x3360
leaq -0xf0(%rbp), %rdi
callq 0x3360
leaq -0x110(%rbp), %rdi
callq 0x3360
movl $0x18, %edi
callq 0x3040
movq %rax, -0x268(%rbp)
jmp 0x14cdc
movq -0x268(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x18, %edi
callq 0x3040
movq %rax, -0x270(%rbp)
jmp 0x14cfd
movq -0x270(%rbp), %rax
movq %rax, -0x120(%rbp)
movl $0x0, -0x130(%rbp)
cmpl $0x3, -0x130(%rbp)
jge 0x14da2
movl $0x8, %edi
callq 0x3040
movq %rax, -0x278(%rbp)
jmp 0x14d35
movq -0x278(%rbp), %rdx
movq -0x118(%rbp), %rax
movslq -0x130(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x10, %edi
callq 0x3040
movq %rax, -0x280(%rbp)
jmp 0x14d61
movq -0x280(%rbp), %rdx
movq -0x120(%rbp), %rax
movslq -0x130(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x130(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
jmp 0x14d15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x15486
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3090
jmp 0x14db1
jmp 0x14db3
leaq -0x30(%rbp), %rdi
callq 0x33f0
testb $0x1, %al
jne 0x14dc2
jmp 0x14dd3
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3090
jmp 0x14dd1
jmp 0x14db3
leaq 0xc69c(%rip), %rsi      # 0x21476
leaq -0x30(%rbp), %rdi
callq 0x169d0
movb %al, -0x281(%rbp)
jmp 0x14deb
movb -0x281(%rbp), %al
testb $0x1, %al
jne 0x14dfa
jmp 0x153e6
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3320
jmp 0x14e09
leaq 0xc600(%rip), %rsi      # 0x21410
leaq -0x50(%rbp), %rdi
callq 0x16a00
movb %al, -0x282(%rbp)
jmp 0x14e21
movb -0x282(%rbp), %al
testb $0x1, %al
jne 0x14e2d
jmp 0x14e68
movq 0x111bc(%rip), %rdi     # 0x25ff0
leaq 0xc5d7(%rip), %rsi      # 0x21412
callq 0x3240
movq %rax, -0x290(%rbp)
jmp 0x14e49
movq -0x290(%rbp), %rdi
movq 0x11169(%rip), %rsi     # 0x25fc0
callq 0x3270
jmp 0x14e5e
movl $0x1, %edi
callq 0x32e0
movq 0x11181(%rip), %rdi     # 0x25ff0
leaq 0xc621(%rip), %rsi      # 0x21497
callq 0x3240
movq %rax, -0x298(%rbp)
jmp 0x14e84
movq -0x298(%rbp), %rdi
movq 0x1112e(%rip), %rsi     # 0x25fc0
callq 0x3270
jmp 0x14e99
jmp 0x14e9b
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3310
movb %al, -0x299(%rbp)
jmp 0x14eb6
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x14ec5
jmp 0x153e4
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3320
movq %rax, -0x2a8(%rbp)
jmp 0x14edb
movq -0x2a8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3310
movb %al, -0x2a9(%rbp)
jmp 0x14ef9
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x14f05
jmp 0x14f2e
leaq 0xc53e(%rip), %rsi      # 0x2144a
leaq -0x50(%rbp), %rdi
callq 0x169d0
movb %al, -0x2aa(%rbp)
jmp 0x14f1d
movb -0x2aa(%rbp), %al
testb $0x1, %al
jne 0x14f29
jmp 0x14f2e
jmp 0x153e4
movq 0x110bb(%rip), %rdi     # 0x25ff0
leaq -0x50(%rbp), %rsi
callq 0x3220
movq %rax, -0x2b8(%rbp)
jmp 0x14f47
movq -0x2b8(%rbp), %rdi
movq 0x1106b(%rip), %rsi     # 0x25fc0
callq 0x3270
jmp 0x14f5c
movl $0x0, -0x17c(%rbp)
movl -0x17c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x153df
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3170
jmp 0x14f84
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3320
movq %rax, -0x2c0(%rbp)
jmp 0x14f9a
movq -0x2c0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3320
movq %rax, -0x2c8(%rbp)
jmp 0x14fb6
movq -0x2c8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3320
movq %rax, -0x2d0(%rbp)
jmp 0x14fd2
movq -0x2d0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3320
movq %rax, -0x2d8(%rbp)
jmp 0x14fee
movq -0x2d8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x3320
movq %rax, -0x2e0(%rbp)
jmp 0x1500a
movq -0x2e0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3320
jmp 0x1501f
movq -0x8(%rbp), %rdi
movq -0x120(%rbp), %rax
movq (%rax), %rsi
callq 0x31e0
movq %rax, -0x2e8(%rbp)
jmp 0x1503b
movq -0x2e8(%rbp), %rdi
movq -0x120(%rbp), %rax
movq (%rax), %rsi
addq $0x8, %rsi
callq 0x31e0
movq %rax, -0x2f0(%rbp)
jmp 0x1505e
movq -0x2f0(%rbp), %rdi
movq -0x120(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x31e0
movq %rax, -0x2f8(%rbp)
jmp 0x1507e
movq -0x2f8(%rbp), %rdi
movq -0x120(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
callq 0x31e0
movq %rax, -0x300(%rbp)
jmp 0x150a2
movq -0x300(%rbp), %rdi
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x31e0
movq %rax, -0x308(%rbp)
jmp 0x150c2
movq -0x308(%rbp), %rdi
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rsi
addq $0x8, %rsi
callq 0x31e0
jmp 0x150df
leaq -0x1a0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3120
jmp 0x150f1
leaq -0x1a0(%rbp), %rdi
callq 0x14040
movl %eax, -0x30c(%rbp)
jmp 0x15105
movl -0x30c(%rbp), %ecx
movq -0x118(%rbp), %rax
movq (%rax), %rax
movl %ecx, (%rax)
leaq -0x1a0(%rbp), %rdi
callq 0x3180
leaq -0x1c0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3120
jmp 0x15138
leaq -0x1c0(%rbp), %rdi
callq 0x14040
movl %eax, -0x310(%rbp)
jmp 0x1514c
movl -0x310(%rbp), %ecx
movq -0x118(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x4(%rax)
leaq -0x1c0(%rbp), %rdi
callq 0x3180
leaq -0x1e0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3120
jmp 0x15180
leaq -0x1e0(%rbp), %rdi
callq 0x14040
movl %eax, -0x314(%rbp)
jmp 0x15194
movl -0x314(%rbp), %ecx
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
leaq -0x1e0(%rbp), %rdi
callq 0x3180
leaq -0x200(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3120
jmp 0x151c8
leaq -0x200(%rbp), %rdi
callq 0x14040
movl %eax, -0x318(%rbp)
jmp 0x151dc
movl -0x318(%rbp), %ecx
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x4(%rax)
leaq -0x200(%rbp), %rdi
callq 0x3180
leaq -0x220(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x3120
jmp 0x15211
leaq -0x220(%rbp), %rdi
callq 0x14040
movl %eax, -0x31c(%rbp)
jmp 0x15225
movl -0x31c(%rbp), %ecx
movq -0x118(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, (%rax)
leaq -0x220(%rbp), %rdi
callq 0x3180
leaq -0x240(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3120
jmp 0x15259
leaq -0x240(%rbp), %rdi
callq 0x14040
movl %eax, -0x320(%rbp)
jmp 0x1526d
movl -0x320(%rbp), %ecx
movq -0x118(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x4(%rax)
leaq -0x240(%rbp), %rdi
callq 0x3180
movl -0x10(%rbp), %eax
movl %eax, -0x324(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3120
jmp 0x152a8
movl -0x324(%rbp), %edi
movq -0x118(%rbp), %rdx
movq -0x120(%rbp), %rcx
leaq -0x260(%rbp), %rsi
callq 0xc720
jmp 0x152ca
leaq -0x260(%rbp), %rdi
callq 0x3180
movl -0x17c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
jmp 0x14f66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x3180
jmp 0x15486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x3180
jmp 0x15486
jmp 0x14e9b
jmp 0x153e6
movq -0x118(%rbp), %rax
movq %rax, -0x330(%rbp)
cmpq $0x0, %rax
je 0x15406
movq -0x330(%rbp), %rdi
callq 0x3330
movq -0x120(%rbp), %rax
movq %rax, -0x338(%rbp)
cmpq $0x0, %rax
je 0x15426
movq -0x338(%rbp), %rdi
callq 0x3330
leaq -0x110(%rbp), %rdi
callq 0x3180
leaq -0xf0(%rbp), %rdi
callq 0x3180
leaq -0xd0(%rbp), %rdi
callq 0x3180
leaq -0xb0(%rbp), %rdi
callq 0x3180
leaq -0x90(%rbp), %rdi
callq 0x3180
leaq -0x70(%rbp), %rdi
callq 0x3180
leaq -0x50(%rbp), %rdi
callq 0x3180
leaq -0x30(%rbp), %rdi
callq 0x3180
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
leaq -0x110(%rbp), %rdi
callq 0x3180
leaq -0xf0(%rbp), %rdi
callq 0x3180
leaq -0xd0(%rbp), %rdi
callq 0x3180
leaq -0xb0(%rbp), %rdi
callq 0x3180
leaq -0x90(%rbp), %rdi
callq 0x3180
leaq -0x70(%rbp), %rdi
callq 0x3180
leaq -0x50(%rbp), %rdi
callq 0x3180
leaq -0x30(%rbp), %rdi
callq 0x3180
movq -0x128(%rbp), %rdi
callq 0x3420
nopl (%rax)