// File: jamesliu516[P]amrdg2d/outputgrid.cpp
// Function: outputcell(int)
void outputcell(int ij)
{
//
	ofstream fpxx;

	string proxfile1(FILE_PROX);
		
	string  str1=str0+proxfile1;
	
	ostringstream omess1;
	
	omess1 << str1 << ij<<".plt";
	
	//fpxx.open(filename1[ljm]);
	fpxx.open(omess1.str().c_str());
	
//
	long i;
	long k,j;
	
	Node *current;
	OctCell *lsbl;
	current = HeadListAllGrid;
	
	pointOutput=new PointJBoutput[NpointForOutput];
	cellOutput=new ControlCellOutput[NpointForOutput];

	while(current != NULL)
	{
		
		lsbl = current->cell;
		if(lsbl->flag % 2 == 0 && current->flg<=2 ) 
			PrintNode_bk(lsbl);
		current = current->next;
	}

//	for(i=1;i<=Nx*Ny;i++)
//	{
//		PrintNode(&bodygrid[i]);
//	}

        fpxx<<"TITLE =\"EULER SOLVER\"\n"
        <<"VARIABLES = \"X\", \"Y\"\n"
        <<"ZONE N=   "<<Np-1 << ",E=    "<<   NU-1<< ", F=FEPOINT, ET=QUADRILATERAL\n";  
        
         cout<<"Np= "<<Np-1<<", NU= "<<NU-1<<endl;
         
//	fprintf(fp,"TITLE = \" Bodygrid \"\n");
//	fprintf(fp,"VARIABLES = \"X\", \"Y\"\n");
//	fprintf(fp,"ZONE N=\t%d ,E=\t%d , F=FEPOINT, ET=QUADRILATERAL\n",Np-1,NU-1);
//	printf("Np=%d,NU=%d\n",Np,NU);

//	getch();
	for(j=1;j<Np;j++)
	{
	  fpxx<<pointOutput[j].x<<"      "<<pointOutput[j].y<<"\n";
     //   fprintf(fp,"%15.8e\t%15.8e\n",point[j].x,point[j].y);
	}
	for(k=1;k<NU;k++)
	{
		for(i=0;i<4;i++)
		{
		   //fprintf(fp,"%d\t",cell[k].cpoint[i]);
		    fpxx<<cellOutput[k].cpoint[i]<<"   ";

		}
		//fprintf(fp,"\n");
		fpxx<<"\n";
	}
	fpxx.close();
	
	delete[] pointOutput;
	delete[] cellOutput;
}

// Assembly:
subq $0x4c8, %rsp            # imm = 0x4C8
movl %edi, 0x4c4(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0x3410
leaq 0x29f(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0x3450
movq 0xa0(%rsp), %rdx
leaq 0x301b1(%rip), %rsi     # 0x3f220
leaq 0x2a0(%rsp), %rdi
callq 0x6330
jmp 0xf07e
leaq 0x29f(%rsp), %rdi
callq 0x32b0
leaq 0x4189e(%rip), %rsi     # 0x50930
leaq 0x268(%rsp), %rdi
leaq 0x2a0(%rsp), %rdx
callq 0x113d0
jmp 0xf0a9
leaq 0xf0(%rsp), %rdi
callq 0x3360
jmp 0xf0b8
leaq 0xf0(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x3220
movq %rax, 0x98(%rsp)
jmp 0xf0d7
movq 0x98(%rsp), %rdi
movl 0x4c4(%rsp), %esi
callq 0x3420
movq %rax, 0x90(%rsp)
jmp 0xf0f5
movq 0x90(%rsp), %rdi
leaq 0x3011f(%rip), %rsi     # 0x3f223
callq 0x3240
jmp 0xf10b
leaq 0xd0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3270
jmp 0xf122
leaq 0xd0(%rsp), %rdi
callq 0x3110
movq %rax, %rsi
leaq 0x2c0(%rsp), %rdi
movl $0x10, %edx
callq 0x3050
jmp 0xf146
leaq 0xd0(%rsp), %rdi
callq 0x34d8
leaq 0x41546(%rip), %rax     # 0x506a0
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
movl $0xc35000, %edi         # imm = 0xC35000
callq 0x3030
movq %rax, 0x88(%rsp)
jmp 0xf179
movq 0x88(%rsp), %rax
movq %rax, 0x41888(%rip)     # 0x50a10
movl $0xc35000, %edi         # imm = 0xC35000
callq 0x3030
movq %rax, 0x80(%rsp)
jmp 0xf19c
movq 0x80(%rsp), %rax
movq %rax, 0x4186d(%rip)     # 0x50a18
cmpq $0x0, 0xb0(%rsp)
je 0xf2c6
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movswl 0x1b0(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xf2ad
movq 0xb0(%rsp), %rax
movswl (%rax), %eax
cmpl $0x2, %eax
jg 0xf2ad
movq 0xa8(%rsp), %rdi
callq 0xec00
jmp 0xf211
jmp 0xf2ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x29f(%rsp), %rdi
callq 0x32b0
jmp 0xf619
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0xf60c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0xf5ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0xf5f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x34d8
jmp 0xf5f2
movq 0xb0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0xf1ab
leaq 0x2ff5b(%rip), %rsi     # 0x3f228
leaq 0x2c0(%rsp), %rdi
callq 0x3240
movq %rax, 0x78(%rsp)
jmp 0xf2e1
movq 0x78(%rsp), %rdi
leaq 0x2ff52(%rip), %rsi     # 0x3f23f
callq 0x3240
movq %rax, 0x70(%rsp)
jmp 0xf2f9
movq 0x70(%rsp), %rdi
leaq 0x2ff50(%rip), %rsi     # 0x3f255
callq 0x3240
movq %rax, 0x68(%rsp)
jmp 0xf311
movq 0x68(%rsp), %rdi
movl 0x3bf9c(%rip), %esi     # 0x4b2b8
decl %esi
callq 0x3420
movq %rax, 0x60(%rsp)
jmp 0xf32a
movq 0x60(%rsp), %rdi
leaq 0x2ff2a(%rip), %rsi     # 0x3f260
callq 0x3240
movq %rax, 0x58(%rsp)
jmp 0xf342
movq 0x58(%rsp), %rdi
movl 0x3bf6f(%rip), %esi     # 0x4b2bc
decl %esi
callq 0x3420
movq %rax, 0x50(%rsp)
jmp 0xf35b
movq 0x50(%rsp), %rdi
leaq 0x2ff01(%rip), %rsi     # 0x3f268
callq 0x3240
jmp 0xf36e
movq 0x3bc5b(%rip), %rdi     # 0x4afd0
leaq 0x2ff0b(%rip), %rsi     # 0x3f287
callq 0x3240
movq %rax, 0x48(%rsp)
jmp 0xf388
movq 0x48(%rsp), %rdi
movl 0x3bf25(%rip), %esi     # 0x4b2b8
decl %esi
callq 0x3420
movq %rax, 0x40(%rsp)
jmp 0xf3a1
movq 0x40(%rsp), %rdi
leaq 0x2fedf(%rip), %rsi     # 0x3f28c
callq 0x3240
movq %rax, 0x38(%rsp)
jmp 0xf3b9
movq 0x38(%rsp), %rdi
movl 0x3bef8(%rip), %esi     # 0x4b2bc
decl %esi
callq 0x3420
movq %rax, 0x30(%rsp)
jmp 0xf3d2
movq 0x30(%rsp), %rdi
movq 0x3bbda(%rip), %rsi     # 0x4afb8
callq 0x3290
jmp 0xf3e5
movq $0x1, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movslq 0x3beb8(%rip), %rcx     # 0x4b2b8
cmpq %rcx, %rax
jge 0xf4a5
movq 0x41600(%rip), %rax     # 0x50a10
movq 0xb8(%rsp), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm0
leaq 0x2c0(%rsp), %rdi
callq 0x3480
movq %rax, 0x28(%rsp)
jmp 0xf435
movq 0x28(%rsp), %rdi
leaq 0x30848(%rip), %rsi     # 0x3fc89
callq 0x3240
movq %rax, 0x20(%rsp)
jmp 0xf44d
movq 0x20(%rsp), %rdi
movq 0x415b7(%rip), %rax     # 0x50a10
movq 0xb8(%rsp), %rcx
shlq $0x4, %rcx
movsd 0x8(%rax,%rcx), %xmm0
callq 0x3480
movq %rax, 0x18(%rsp)
jmp 0xf477
movq 0x18(%rsp), %rdi
leaq 0x2fe67(%rip), %rsi     # 0x3f2ea
callq 0x3240
jmp 0xf48a
jmp 0xf48c
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0xf3f1
movq $0x1, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movslq 0x3bdfc(%rip), %rcx     # 0x4b2bc
cmpq %rcx, %rax
jge 0xf571
movq $0x0, 0xc8(%rsp)
cmpq $0x4, 0xc8(%rsp)
jge 0xf540
movq 0x41531(%rip), %rax     # 0x50a18
movq 0xc0(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0xc8(%rsp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0x2c0(%rsp), %rdi
callq 0x3420
movq %rax, 0x10(%rsp)
jmp 0xf515
movq 0x10(%rsp), %rdi
leaq 0x3076b(%rip), %rsi     # 0x3fc8c
callq 0x3240
jmp 0xf528
jmp 0xf52a
movq 0xc8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xc8(%rsp)
jmp 0xf4d5
leaq 0x2fda3(%rip), %rsi     # 0x3f2ea
leaq 0x2c0(%rsp), %rdi
callq 0x3240
jmp 0xf556
jmp 0xf558
movq 0xc0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xc0(%rsp)
jmp 0xf4b1
leaq 0x2c0(%rsp), %rdi
callq 0x3390
jmp 0xf580
movq 0x41489(%rip), %rax     # 0x50a10
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0xf59c
movq 0x8(%rsp), %rdi
callq 0x3340
movq 0x41475(%rip), %rax     # 0x50a18
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0xf5b6
movq (%rsp), %rdi
callq 0x3340
leaq 0xf0(%rsp), %rdi
callq 0x30b0
leaq 0x268(%rsp), %rdi
callq 0x34d8
leaq 0x2a0(%rsp), %rdi
callq 0x34d8
leaq 0x2c0(%rsp), %rdi
callq 0x33b0
addq $0x4c8, %rsp            # imm = 0x4C8
retq
leaq 0xf0(%rsp), %rdi
callq 0x30b0
leaq 0x268(%rsp), %rdi
callq 0x34d8
leaq 0x2a0(%rsp), %rdi
callq 0x34d8
leaq 0x2c0(%rsp), %rdi
callq 0x33b0
movq 0x290(%rsp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)