// File: jamesliu516[P]amrdg2d/solveAMR.cpp
// Function: charg_sol_grid(bodygridclass*)
void charg_sol_grid(OctCell *pg)//pg为网格单元的指针
{
	bool refflag;
    Vec2D tpvec;
    double jl0,jl1,jl2,jl3;
    double maxhxy;
    maxhxy=max2(hx,hy);
	switch(AMRP)
	{	
	case 0: 
        refflag=(pg->tcur > refine_coe*Sigma_curl
            || pg->tdiv > refine_coe1*Sigma_div);
        break;
	case 1: refflag=(pg->tdiv > refine_coe*Sigma_div); break;	
	case 2: refflag=(pg->tcur > refine_coe*Sigma_curl); break;
	case 3: refflag=(pg->pio > refine_coe*Sigma_pio); break;
	case 4: 
        refflag=(pg->tdiv > refine_coe*Sigma_div
            || pg->pio > refine_coe1*Sigma_pio);
        break;
    case 5:
        refflag=(pg->tdiv > refine_coe*Sigma_div || pg->trbamr);
        break;
	}

	if(refflag==true)
	{
#if IS_TUBE==1
        tpvec[0]=pg->xc1;
        tpvec[1]=pg->yc1;
        jl0=fabs(tpvec-ExtPnt0);
        jl1=fabs(tpvec-ExtPnt1);
        jl2=fabs(tpvec-ExtPnt2);
        jl3=fabs(tpvec-ExtPnt3);

        if(jl0>3.0*maxhxy && jl1>3.0*maxhxy
            && jl2 > 3.0*maxhxy && jl3>3.0*maxhxy)
#endif
            solrefcell.push_back(pg);

		//solrefcell[Namr]=pg;//用于存放需要加密的网格单元地址的数组
	    //Namr++;//记录需要加密的网格单元的数目
	}
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
leaq 0x88(%rsp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x1e1a0
movsd 0x41de(%rip), %xmm0     # 0x3f028
movsd %xmm0, 0x60(%rsp)
movq 0xa0(%rsp), %rax
movsd 0x240(%rax), %xmm0
movsd 0x4b80(%rip), %xmm1     # 0x3f9e8
mulsd 0x23848(%rip), %xmm1    # 0x5e6b8
movb $0x1, %al
ucomisd %xmm1, %xmm0
movb %al, 0x1f(%rsp)
ja 0x3aea7
movq 0xa0(%rsp), %rax
movsd 0x248(%rax), %xmm0
movsd 0x4b64(%rip), %xmm1     # 0x3f9f8
mulsd 0x23824(%rip), %xmm1    # 0x5e6c0
ucomisd %xmm1, %xmm0
seta %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
andb $0x1, %al
movb %al, 0x9f(%rsp)
movb 0x9f(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x3b08a
movq 0xa0(%rsp), %rax
movsd 0x278(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
callq 0x1e9b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0xa0(%rsp), %rax
movsd 0x280(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x88(%rsp), %rdi
movl $0x1, %esi
callq 0x1e9b0
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0x88(%rsp), %rdi
leaq 0x159a7(%rip), %rsi     # 0x508e0
callq 0x1e880
movsd %xmm0, 0x50(%rsp)
movsd %xmm1, 0x58(%rsp)
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
callq 0x1e210
movsd %xmm0, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x1597d(%rip), %rsi     # 0x508f0
callq 0x1e880
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x48(%rsp)
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
callq 0x1e210
movsd %xmm0, 0x78(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x15956(%rip), %rsi     # 0x50900
callq 0x1e880
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
callq 0x1e210
movsd %xmm0, 0x70(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x1592f(%rip), %rsi     # 0x50910
callq 0x1e880
movsd %xmm0, 0x20(%rsp)
movsd %xmm1, 0x28(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x1e210
movsd %xmm0, 0x68(%rsp)
movsd 0x80(%rsp), %xmm0
movsd 0x4036(%rip), %xmm1     # 0x3f050
mulsd 0x60(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3b088
movsd 0x78(%rsp), %xmm0
movsd 0x401c(%rip), %xmm1     # 0x3f050
mulsd 0x60(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3b088
movsd 0x70(%rsp), %xmm0
movsd 0x4002(%rip), %xmm1     # 0x3f050
mulsd 0x60(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3b088
movsd 0x68(%rsp), %xmm0
movsd 0x3fe8(%rip), %xmm1     # 0x3f050
mulsd 0x60(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3b088
leaq 0x10365(%rip), %rdi     # 0x4b3e0
leaq 0xa0(%rsp), %rsi
callq 0x1b460
jmp 0x3b08a
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)