[petsc-dev] Problem with l2g IS created by VecCreateGhostBlock
Garth Wells
gnw20 at cam.ac.uk
Thu May 17 11:41:55 CDT 2018
I'm seeing an issue because I previously built my own l2g IS, whereas
now I'm relying on the IS created by VecCreateGhostBlock.
For a vector with 8 entries and block size 2 (i.e, 4 blocks), and
arranged:
P0: Owns blocks: 0
Ghost blocks: 1, 2
P1: Owns blocks: 1, 2, 3
Ghost blocks: None
I expected the local-to-global IS created by VecCreateGhostBlock on
proc 1 to be:
0 1
1 2
2 3
But I get
0 2
1 3
2 4
The below code illustrates (run with 2 procs). I'm using the dev master
branch (updated just now).
Am I doing something wrong?
Garth
#include <petsc.h>
static char help[] = "Test ghost vec";
int main(int argc, char **argv)
{
PetscInitialize(&argc, &argv, (char *)0, help);
PetscMPIInt rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
Vec x;
if (rank == 0)
{
PetscInt ghst[2] = {1, 2};
VecCreateGhostBlock(PETSC_COMM_WORLD, 2, 2, PETSC_DECIDE, 2, ghst,
&x);
}
else if (rank == 1)
{
VecCreateGhostBlock(PETSC_COMM_WORLD, 2, 6, PETSC_DECIDE, 0, NULL,
&x);
ISLocalToGlobalMapping mapping;
VecGetLocalToGlobalMapping(x, &mapping);
ISLocalToGlobalMappingView(mapping, PETSC_VIEWER_STDOUT_SELF);
}
return 0;
}
More information about the petsc-dev
mailing list