On Mon, 2008-08-04 at 11:14 -0500, Barry Smith wrote:
Send us the code. This is suppose to be easy stuff.
I have attached the code. Ahmed
Barry
On Aug 4, 2008, at 11:09 AM, Ahmed El Zein wrote:
On Mon, 2008-08-04 at 23:13 +0800, Zi-Hao Wei wrote:
On Mon, Aug 4, 2008 at 10:53 PM, Ahmed El Zein <[email protected]> wrote:
my code looks like: ierr = MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr); ierr = MatSetSizes(A,M,N,M,N); CHKERRQ(ierr); ierr = MatSetType(A, MATSEQAIJ); CHKERRQ(ierr); ierr = MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); [...lots of MatSetValue() calls...] ierr = MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);
I think that the code should be ierr = MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr); ierr = MatSetSizes(A,M,N,M,N); CHKERRQ(ierr); ierr = MatSetType(A, MATSEQAIJ); CHKERRQ(ierr); [...lots of MatSetValue() calls...] ierr = MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); ierr = MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr);
The routines MatAssemblyBegin and MatAssemblyEnd should be called after completing all calls to MatSetValues(). You are right of course. But if these 2 calls are meant to be right after each other, why isn't there just one MatAssembly() call versus a Begin and End call?
btw fixing this did not affect the problem I had.
Ahmed