how to use PetscMap?

Satish Balay balay at mcs.anl.gov
Thu Nov 2 21:37:49 CST 2006


On Fri, 3 Nov 2006, Yixun Liu wrote:

> Hi,
> I did as you said,
> 
> PetscMap map;
> // PetscMapSetBlockSize(&map,n);
>  map.bs = 1;
>  ierr = PetscMapInitialize(PETSC_COMM_WORLD, &map);
>  ierr = PetscMapSetSize (&map, n);
>  ierr = PetscMapGetLocalRange(&map,&Istart,&Iend); CHKERRQ(ierr);

The following code should work.

Satish
>>>>>>>>>>>>>>>>.
#include "private/vecimpl.h"

  {
    PetscMap       map;
    PetscInt Istart,Iend;

    ierr = PetscMemzero(&map,sizeof(map));CHKERRQ(ierr);
    map.bs = 1;
    map.N = n;   /* global size */
    map.n = PETSC_DECIDE;  /* local size */
    ierr = PetscMapInitialize(PETSC_COMM_WORLD, &map);
    ierr = PetscMapGetLocalRange(&map,&Istart,&Iend); CHKERRQ(ierr);
    ierr = PetscFree(map.range);CHKERRQ(ierr);
  }




More information about the petsc-users mailing list