VecDuplicate()

(Rebecca) Xuefei YUAN xy2102 at columbia.edu
Wed Apr 15 17:50:30 CDT 2009


Hi,

I use VecDuplicate() to duplicate four vectors from x, whose da has  
DA_XPERIODIC, however, those four new vectors lost the properties of  
DA_XPERIODIC. How could I keep this XPERIODIC property?
----------------------------------------------------------------------------
ierr = DACreate2d(comm,DA_XPERIODIC,DA_STENCIL_STAR, -5, -5,  
PETSC_DECIDE, PETSC_DECIDE, 4, 2, 0, 0, &da);CHKERRQ(ierr);
ierr = DMMGSetDM(dmmg, (DM)da);CHKERRQ(ierr);


for (i = 0; i < parameters.numberOfLevels; i++){
	ierr = VecDuplicate(dmmg[i]->x, &appCtx[i].uOld1Vector);CHKERRQ(ierr);
	ierr = VecDuplicate(dmmg[i]->x, &appCtx[i].uOld2Vector);CHKERRQ(ierr);
	ierr = VecDuplicate(dmmg[i]->x, &appCtx[i].uOld3Vector);CHKERRQ(ierr);
	ierr = VecDuplicate(dmmg[i]->x, &appCtx[i].uOld4Vector);CHKERRQ(ierr);
}
-------------------------------------------------------------------

I tried to use VecCopy(), but it is wrong at line 1678:vector.c.

------------------------------------------------------------------
Breakpoint 4, VecCopy (x=0x8861070, y=0x886407c) at vector.c:1672
1672	  PetscReal      norms[4] = {0.0,0.0,0.0,0.0};
(gdb) n
1676	  PetscFunctionBegin;
(gdb) n
1677	  PetscValidHeaderSpecific(x,VEC_COOKIE,1);
(gdb)
1678	  PetscValidHeaderSpecific(y,VEC_COOKIE,2);
(gdb)
[0]PETSC ERROR: --------------------- Error Message  
------------------------------------
[0]PETSC ERROR: Invalid argument!
[0]PETSC ERROR: Wrong type of object: Parameter # 2!
------------------------------------------------------------------

Is there any better way to "duplicate" or "copy" the vector and make  
it preserve the da properties?

Thanks very much!

Cheers,

Rebecca






More information about the petsc-users mailing list