<div dir="ltr">Hello there,<div><br></div><div>I'm using your Application Ordering (AO) objects to switch between vectors with my application ordering to petsc ordering. I built a little routine which helps me to gather the information in the proper order:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>SUBROUTINE VecApplicationToPetsc(DataMngr,AppVec,ierr)</div></div><div><div><br></div></div><div><div> IMPLICIT NONE</div></div><div><div><br></div></div><div><div>#include <petsc/finclude/petscsys.h></div></div><div><div>#include <petsc/finclude/petscvec.h></div></div><div><div>#include <petsc/finclude/petscis.h></div></div><div><div>#include <petsc/finclude/petscdm.h></div></div><div><div>#include <petsc/finclude/petscdmda.h></div></div><div><div>#include <petsc/finclude/petscao.h></div></div><div><div><br></div></div><div><div> PetscErrorCode,INTENT(INOUT) :: ierr</div></div><div><div> DM,INTENT(IN) :: DataMngr</div></div><div><div> Vec,INTENT(INOUT) :: AppVec ! it outs as PetscVec</div></div><div><div><br></div></div><div><div> AO :: AppOrd</div></div><div><div> PetscInt :: RangeLow,RangeHigh,i</div></div><div><div> IS :: PetscIS,AppIS</div></div><div><div> VecScatter :: Scatter</div></div><div><div> Vec :: PetscVec</div></div><div><div><br></div></div><div><div> ! It obtains a temporal vector to store in PETSc ordering</div></div><div><div> CALL DMCreateGlobalVector(DataMngr,PetscVec,ierr)</div></div><div><div> CALL AOCreate(PETSC_COMM_WORLD,AppOrd,ierr)</div></div><div><div> CALL DMDAGetAO(DataMngr,AppOrd,ierr)</div></div><div><div> CALL VecGetOwnershipRange(PetscVec,RangeLow,RangeHigh,ierr)</div></div><div><div> CALL ISCreateGeneral(PETSC_COMM_WORLD,RangeHigh-RangeLow,(/(i,i=RangeLow,RangeHigh)/),PETSC_COPY_VALUES,PetscIS,ierr)</div></div><div><div> CALL ISDuplicate(PetscIS,AppIS,ierr)</div></div><div><div> CALL ISCopy(PetscIS,AppIS,ierr)</div></div><div><div> CALL AOPetscToApplicationIS(AppOrd,AppIS,ierr)</div></div><div><div> CALL VecScatterCreate(AppVec,AppIS,PetscVec,PetscIS,Scatter,ierr)</div></div><div><div> CALL VecScatterBegin(Scatter,AppVec,PetscVec,INSERT_VALUES,SCATTER_FORWARD,ierr)</div></div><div><div> CALL VecScatterEnd(Scatter,AppVec,PetscVec,INSERT_VALUES,SCATTER_FORWARD,ierr)</div></div><div><div><br></div></div><div><div> CALL VecScatterDestroy(Scatter,ierr)</div></div><div><div> CALL ISDestroy(AppIS,ierr)</div></div><div><div> CALL ISDestroy(PetscIS,ierr)</div></div><div><div> CALL AODestroy(AppOrd,ierr)</div></div><div><div> CALL VecCopy(PetscVec,AppVec,ierr)</div></div><div><div> CALL VecDestroy(PetscVec,ierr)</div></div><div><div><br></div></div><div><div>END SUBROUTINE VecApplicationToPetsc</div></div></blockquote><div><br></div><div><div>It is working well for my purpose, but just the first time I call it; the second time I call it, the AO object give me back an error. The most obviously way to avoid it is creating AO, IS and VecScatter objects just one time, but I don't want to handle those variables through my whole program.</div><div><br></div><div>Am I doing something wrong with the AO object?</div><div><br></div><div>Thank you.</div></div><div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br><div><span style="color:rgb(136,136,136)">-- <br><span style="font-family:Tahoma">Att:<br style="text-indent:0px!important"><br style="text-indent:0px!important">Santiago Ospina De Los Ríos<br style="text-indent:0px!important">National University of Colombia<br></span></span></div></div></div></div></div></div>
</div></div>