Hello,

I found DMGetLocalVector and DMCreateLocalVector generate Vec of
different size in my following codes

====================
call PetscSectionSetup(section,ierr)
call DMSetLocalSection(dm_mesh,section,ierr)
......do something

call PetscSectionSetup(section,ierr)
call DMSetLocalSection(dm_mesh,section,ierr)
......
call DMCreateLocalVector(dm_mesh,lvec,ierr);
call DMGetLocalVector(dm_mesh,llvec,ierr);
call VecGetSize(lvec,off,ierr)
call VecGetSize(llvec,offl,ierr)
call VecDestroy(lvec,ierr)
call DMRestoreLocalVector(dm_mesh,llvec,ierr);
========================
The pointer in the above program is that DMSetLocalSection is called two
times. As the petsc manual indicates, "Any existing Section will be
destroyed" after calling this function and To my understanding, a new
section should be set. Therefore,  The above program should obtain values
of *off* and *offl *the same. However, I found that they are different,
with *off *equal to the size defined by the new section and *offl* equal to
the size defined by the first one.

Any problem in above codes? And how can I obtain a Vector of the same size
by DMGetLocalVector and DMCreateLocalVector?

Much thanks for your help.

X. Yuan, Ph.D. in Solid Mechanics

Reply via email to