#undef __FUNCT__ #define __FUNCT__ "UninterpolateSF" PetscErrorCode UninterpolateSF(DM dm, DM dmNew) { PetscSF sfPoint, sfPointNew; const PetscSFNode *remotePoints; PetscSFNode *gremotePoints; const PetscInt *localPoints; PetscInt *glocalPoints, *newLocation, *newRemoteLocation; PetscInt numRoots, numLeaves, l, pEnd; PetscInt newLeaves=0,countLeaf=0; PetscMPIInt rank; PetscErrorCode ierr; PetscFunctionBegin; ierr = MPI_Comm_rank(PETSC_COMM_WORLD, &rank);CHKERRQ(ierr); /* Get original SF information */ ierr = DMGetPointSF(dm, &sfPoint);CHKERRQ(ierr); ierr = DMGetPointSF(dmNew, &sfPointNew);CHKERRQ(ierr); ierr = DMPlexGetDepthStratum(dm,0,NULL,&pEnd);CHKERRQ(ierr); ierr = PetscSFGetGraph(sfPoint, &numRoots, &numLeaves, &localPoints, &remotePoints);CHKERRQ(ierr); /* Allocate space for cells and vertices */ for (l = 0; l < numLeaves; ++l) if (localPoints[l] < pEnd) newLeaves++; /* Fill in roots */ if (pEnd >= 0) { ierr = PetscMalloc2(pEnd,&newLocation,pEnd,&newRemoteLocation);CHKERRQ(ierr); for (l=0; l