[petsc-dev] broken DMGetInterpolation_DA !!!!

Barry Smith bsmith at mcs.anl.gov
Thu Jul 21 16:48:44 CDT 2011

  Whoever wrote the DMGetInterpolation_DA_Q1() for when coordinates are provided in DA

   1) it is completely broken for the periodic case!

   2) it doesn't actually use the coordinates provided by the user in the DA ; it uses uniform coordinates it cooks up on the fly

/* compute local coordinate arrays */
    nxi  = ratioi + 1;
    neta = ratioj + 1;
    ierr = PetscMalloc(sizeof(PetscScalar)*nxi,&xi);CHKERRQ(ierr);
    ierr = PetscMalloc(sizeof(PetscScalar)*neta,&eta);CHKERRQ(ierr);
    for (li=0; li<nxi; li++) {
      xi[li] = -1.0 + (PetscScalar)li*(2.0/(PetscScalar)(nxi-1));
    for (lj=0; lj<neta; lj++) {
      eta[lj] = -1.0 + (PetscScalar)lj*(2.0/(PetscScalar)(neta-1));

so why does it even exist?

Needless to say we are using the periodic boundary conditions and frustrated by the fact that it gives the wrong matrices. Tempted to rip out all the coordinate version of the interpolation cause I don't see it what it provides that the non-coordinate (the if (!vcoors) { branch of the code) provides and at least the non-coordinate version works for periodic boundary conditions. I know someone worked for a long time on the coordinate version but I don't know why.

Is anyone willing to look at this?


More information about the petsc-dev mailing list