PETSc
    Aron Ahmadia 
    aja2111 at columbia.edu
       
    Sat Jan 27 17:41:02 CST 2007
    
    
  
Hi Brian,
I took a quick peek at the source for DAGetGlobalVector in the current release:
"
  for (i=0; i<DA_MAX_WORK_VECTORS; i++) {
    if (da->globalin[i]) {
      *g             = da->globalin[i];
      da->globalin[i] = PETSC_NULL;
      goto alldone;
    }
  }
  ierr = DACreateGlobalVector(da,g);CHKERRQ(ierr);
  alldone:
  for (i=0; i<DA_MAX_WORK_VECTORS; i++) {
    if (!da->globalout[i]) {
      da->globalout[i] = *g;
      break;
    }
 "
The two appear to be very similar, with this exception.  Get/Restore
work with one copy of the DA's global vector, but will make a copy if
one has already been checked out or none exist.
DACreateGlobalVector will always make a copy of the global vector,
regardless of the circumstances.   I think you're better off using Get
and Restore (less data copying) unless you'd like to work with
multiple copies for some reason.
~A
On 1/27/07, Brian Grierson <bag2107 at columbia.edu> wrote:
>
> Could you please tell me the difference between
>
> DACreateGlobalVector / VecDestroy
> and
> DAGetGlobalVector / DARestoreGlobalVector
>
>
>
>
>
>
>
>
>
>
>
> Brian A. Grierson
>
>
>
>
> Department of Applied Physics
>
> Columbia University
>
> Mobile: 646.259.1038
>
> Work:    212-854-4839
>
> bag2107 at columbia.edu
>
> bgrierson21 at gmail.com
>
> http://www.columbia.edu/~bag2107/http://www.apam.columbia.edu/ctx/ctx.html
>
>
    
    
More information about the petsc-users
mailing list