// File: /workspace/github_cpp_makefile_star2_O1/suhasjains[P]AMR-Solver/src/boundary.cpp
// Function: myOctree::set_FieldBc_FieldBcVal(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, myOctree::field_boundary_flags**, double**)
void set_FieldBc_FieldBcVal(int number, std::string name, FieldBc **bc, double **bcval ) {

	for (std::list<Octree*>::iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {	

	
		if((*it)->number==number) {

			std::cerr << "Block " <<  (*it)->number << std::endl;	


			for(int l = 0; l<scalar_fields.size() ; l++) {	

				Field *f = (*it)->get_block_data()->scalarfields[l];			

				if( f->name == name ) {
		
					//setting BC	
					//std::cerr << "Setting BC to " << (*it)->get_block_data()->scalarfields[l]->name << std::endl;
					for (int i=0; i<3; i++) {
					      	for (int j=0; j<2; j++) {
							 f->bc[i][j] = bc[i][j];

							 //std::cerr << (*it)->get_block_data()->scalarfields[l]->bc[i][j];
						}
					}
					

					//Setting BC values
					for(int i=0; i<f->Nx; i++) {
						for(int j=0; j<f->Ny; j++) {
							for(int k=0; k<f->Nz; k++) {
								if(i<pad)	f->val[i][j][k] = bcval[XDIR][LEFT]; 			
								if(i>=(nx_block + pad))	f->val[i][j][k] = bcval[XDIR][RIGHT]; 			
								if(j<pad)	f->val[i][j][k] = bcval[YDIR][LEFT]; 			
								if(j>=(ny_block + pad))	f->val[i][j][k] = bcval[YDIR][RIGHT]; 			
								if(k<pad)	f->val[i][j][k] = bcval[ZDIR][LEFT]; 			
								if(k>=(nz_block + pad))	f->val[i][j][k] = bcval[ZDIR][RIGHT]; 			
									
							}
						}
					}
				}
			}		
		}
	}	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x40(%rbp)
movq %rsi, -0x38(%rbp)
movl %edi, -0x2c(%rbp)
leaq 0xe52d(%rip), %rax      # 0x15208
movq (%rax), %r14
cmpq %rax, %r14
je 0x6f5b
movq %rcx, %rbx
movq 0x10(%r14), %rax
movl -0x2c(%rbp), %ecx
cmpl %ecx, 0x98(%rax)
jne 0x6f4b
movl $0x6, %edx
movq 0xe2e7(%rip), %r15      # 0x14ff0
movq %r15, %rdi
leaq 0xa4e8(%rip), %rsi      # 0x111fb
callq 0x2230
movq 0x10(%r14), %rax
movl 0x98(%rax), %esi
movq %r15, %rdi
callq 0x2330
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0xe8cd(%rip), %rcx      # 0x15628
movq 0x8(%rcx), %rax
cmpq (%rcx), %rax
je 0x6f4b
xorl %r13d, %r13d
movq %r14, -0x48(%rbp)
movq 0x10(%r14), %rdi
callq 0x4064
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %r12
movq 0x20(%r12), %rdx
movq -0x38(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0x6f29
testq %rdx, %rdx
je 0x6db1
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq 0x18(%r12), %rdi
callq 0x2210
testl %eax, %eax
jne 0x6f29
leaq 0x38(%r12), %rax
xorl %ecx, %ecx
movq -0x40(%rbp), %r8
movq (%r8,%rcx,8), %rdx
xorl %esi, %esi
movl (%rdx,%rsi,4), %edi
movl %edi, (%rax,%rsi,4)
incq %rsi
cmpq $0x1, %rsi
je 0x6dc2
incq %rcx
addq $0x8, %rax
cmpq $0x3, %rcx
jne 0x6dbc
movslq (%r12), %rax
testq %rax, %rax
jle 0x6f29
movl 0x4(%r12), %ecx
xorl %edx, %edx
testl %ecx, %ecx
jle 0x6f1d
movl 0x8(%r12), %esi
leaq 0xe3da(%rip), %rdi      # 0x151e0
movslq (%rdi), %rdi
leaq 0xe3d4(%rip), %r8       # 0x151e4
movslq (%r8), %r8
addq %rdi, %r8
leaq 0xe3cb(%rip), %r9       # 0x151e8
movslq (%r9), %r9
addq %rdi, %r9
leaq 0xe3c2(%rip), %r10      # 0x151ec
movslq (%r10), %r10
addq %rdi, %r10
xorl %r11d, %r11d
testl %esi, %esi
jle 0x6f11
xorl %r15d, %r15d
cmpq %rdi, %rdx
jge 0x6e5f
movq (%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
cmpq %r8, %rdx
jl 0x6e7f
movq (%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
cmpq %rdi, %r11
jge 0x6ea1
movq 0x8(%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
cmpq %r9, %r11
jl 0x6ec2
movq 0x8(%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
cmpq %rdi, %r15
jge 0x6ee4
movq 0x10(%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
cmpq %r10, %r15
jl 0x6f05
movq 0x10(%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rdx,8), %r14
movq (%r14,%r11,8), %r14
movsd %xmm0, (%r14,%r15,8)
incq %r15
cmpq %r15, %rsi
jne 0x6e3e
incq %r11
cmpq %rcx, %r11
jne 0x6e33
incq %rdx
cmpq %rax, %rdx
jne 0x6df2
incq %r13
leaq 0xe6f5(%rip), %rcx      # 0x15628
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq %r13, %rax
movq -0x48(%rbp), %r14
ja 0x6d6f
movq (%r14), %r14
cmpq 0xe053(%rip), %r14      # 0x14fa8
jne 0x6cea
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq