[petsc-dev] VecRestoreSubVector
Patrick Lacasse
patrick.m.lacasse at gmail.com
Wed Apr 30 10:21:38 CDT 2014
Hi,
I have a matnest defined by ISGeneral (will be ISStride in future, but
not now).
When calling MatMultTranspose, it calls Vec[Get|Restore]SubVector.
In this call, the state of the vector is
saved PetscObjectComposedDataSetInt
and then PetscObjectComposedDataGetInt.
As I understand this last macro, it doesn't gives back the saved data if
... the state has changed.
So the line
if (valid && savedstate < newstate) {
is never satisfied because valid means "the state didn't changed".
Maybe
if (valid) {
would to the right thing (but it gives compiler warning that savedstate is
unused)
or
if(((PetscObject)*Y)->intcomposedstate[id] == ((PetscObject)*Y)->state))
but I feel like using private attributes.
How could it be done properly?
Maybe the gcontinuous value could be saved instead of the state, so that it
won't need to be communicated twice each time? (Or it can be an attribute
of the IS so that it need to be communicated only once at all).
Also, instead of an assertion I tried to implement it for non-continuous IS
(in the file attached), is it good?
+ if (!gcontiguous) {
+ VecScatter scatter;
+ ierr = VecScatterCreate(*Y,NULL,X,is,&scatter);CHKERRQ(ierr);
+ ierr =
VecScatterBegin(scatter,*Y,X,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
+ ierr =
VecScatterEnd(scatter,*Y,X,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
+ ierr = VecScatterDestroy(&scatter);CHKERRQ(ierr);
+ }
thanks,
Patrick Lacasse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140430/5f67f1d4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-VecRestoreSubVector-handles-non-contiguous-SubVector.patch
Type: text/x-patch
Size: 2194 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140430/5f67f1d4/attachment.bin>
More information about the petsc-dev
mailing list