// File: /workspace/github_cpp_makefile_star2_O3/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 0xe4ad(%rip), %rax      # 0x15218
movq (%rax), %r14
cmpq %rax, %r14
je 0x6fe3
movq %rcx, %rbx
movq 0x10(%r14), %rax
movl -0x2c(%rbp), %ecx
cmpl %ecx, 0x98(%rax)
jne 0x6fd3
movl $0x6, %edx
movq 0xe257(%rip), %r15      # 0x14ff0
movq %r15, %rdi
leaq 0xa458(%rip), %rsi      # 0x111fb
callq 0x2240
movq 0x10(%r14), %rax
movl 0x98(%rax), %esi
movq %r15, %rdi
callq 0x2340
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2160
leaq 0xe84d(%rip), %rcx      # 0x15638
movq 0x8(%rcx), %rax
cmpq (%rcx), %rax
je 0x6fd3
xorl %r13d, %r13d
movq %r14, -0x48(%rbp)
movq 0x10(%r14), %rdi
callq 0x418c
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %r12
movq 0x20(%r12), %rdx
movq -0x38(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0x6fb1
testq %rdx, %rdx
je 0x6e41
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq 0x18(%r12), %rdi
callq 0x2220
testl %eax, %eax
jne 0x6fb1
movl $0x7, %eax
movq -0x40(%rbp), %rsi
movq -0x38(%rsi,%rax,8), %rcx
movl (%rcx), %edx
movl %edx, (%r12,%rax,8)
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%r12,%rax,8)
incq %rax
cmpq $0xa, %rax
jne 0x6e4a
movslq (%r12), %rax
testq %rax, %rax
jle 0x6fb1
movl 0x4(%r12), %ecx
xorl %edx, %edx
testl %ecx, %ecx
jle 0x6fa5
movl 0x8(%r12), %esi
leaq 0xe35a(%rip), %rdi      # 0x151e8
movslq (%rdi), %rdi
leaq 0xe354(%rip), %r8       # 0x151ec
movslq (%r8), %r8
addq %rdi, %r8
leaq 0xe34b(%rip), %r9       # 0x151f0
movslq (%r9), %r9
addq %rdi, %r9
leaq 0xe342(%rip), %r10      # 0x151f4
movslq (%r10), %r10
addq %rdi, %r10
xorl %r11d, %r11d
testl %esi, %esi
jle 0x6f99
xorl %r15d, %r15d
cmpq %rdi, %rdx
jge 0x6ee7
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 0x6f07
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 0x6f29
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 0x6f4a
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 0x6f6c
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 0x6f8d
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 0x6ec6
incq %r11
cmpq %rcx, %r11
jne 0x6ebb
incq %rdx
cmpq %rax, %rdx
jne 0x6e7a
incq %r13
leaq 0xe67d(%rip), %rcx      # 0x15638
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq %r13, %rax
movq -0x48(%rbp), %r14
ja 0x6dff
movq (%r14), %r14
cmpq 0xdfcb(%rip), %r14      # 0x14fa8
jne 0x6d7a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq