| plexreorder.c (7737a2283cf556a0edfb21b038abf2d3e4668ed6) | plexreorder.c (dd5a1fb8a1b1dc1df5cd02569a30d8a384bbbc95) |
|---|---|
| 1#include <petsc-private/dmpleximpl.h> /*I "petscdmplex.h" I*/ 2#include <petsc-private/matorderimpl.h> /*I "petscmat.h" I*/ 3 4#undef __FUNCT__ 5#define __FUNCT__ "DMPlexCreateOrderingClosure_Static" 6PetscErrorCode DMPlexCreateOrderingClosure_Static(DM dm, PetscInt numPoints, const PetscInt pperm[], PetscInt **clperm, PetscInt **invclperm) 7{ 8 PetscInt *perm, *iperm; --- 132 unchanged lines hidden (view full) --- 141 ierr = PetscSectionDestroy(§ionNew);CHKERRQ(ierr); 142 } 143 plexNew = (DM_Plex *) (*pdm)->data; 144 /* Ignore ltogmap, ltogmapb */ 145 /* Ignore sf, defaultSF */ 146 /* Ignore globalVertexNumbers, globalCellNumbers */ 147 /* Remap coordinates */ 148 { | 1#include <petsc-private/dmpleximpl.h> /*I "petscdmplex.h" I*/ 2#include <petsc-private/matorderimpl.h> /*I "petscmat.h" I*/ 3 4#undef __FUNCT__ 5#define __FUNCT__ "DMPlexCreateOrderingClosure_Static" 6PetscErrorCode DMPlexCreateOrderingClosure_Static(DM dm, PetscInt numPoints, const PetscInt pperm[], PetscInt **clperm, PetscInt **invclperm) 7{ 8 PetscInt *perm, *iperm; --- 132 unchanged lines hidden (view full) --- 141 ierr = PetscSectionDestroy(§ionNew);CHKERRQ(ierr); 142 } 143 plexNew = (DM_Plex *) (*pdm)->data; 144 /* Ignore ltogmap, ltogmapb */ 145 /* Ignore sf, defaultSF */ 146 /* Ignore globalVertexNumbers, globalCellNumbers */ 147 /* Remap coordinates */ 148 { |
| 149 DM cdm, cdmNew; 150 PetscSection csection, csectionNew; 151 Vec coordinates, coordinatesNew; 152 PetscScalar *coords, *coordsNew; 153 PetscInt pStart, pEnd, p; | 149 DM cdm, cdmNew; 150 PetscSection csection, csectionNew; 151 Vec coordinates, coordinatesNew; 152 PetscScalar *coords, *coordsNew; 153 const PetscInt *pperm; 154 PetscInt pStart, pEnd, p; |
| 154 155 ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr); 156 ierr = DMGetDefaultSection(cdm, &csection);CHKERRQ(ierr); 157 ierr = PetscSectionPermute(csection, perm, &csectionNew);CHKERRQ(ierr); 158 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr); 159 ierr = VecDuplicate(coordinates, &coordinatesNew);CHKERRQ(ierr); 160 ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr); 161 ierr = VecGetArray(coordinatesNew, &coordsNew);CHKERRQ(ierr); 162 ierr = PetscSectionGetChart(csectionNew, &pStart, &pEnd);CHKERRQ(ierr); | 155 156 ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr); 157 ierr = DMGetDefaultSection(cdm, &csection);CHKERRQ(ierr); 158 ierr = PetscSectionPermute(csection, perm, &csectionNew);CHKERRQ(ierr); 159 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr); 160 ierr = VecDuplicate(coordinates, &coordinatesNew);CHKERRQ(ierr); 161 ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr); 162 ierr = VecGetArray(coordinatesNew, &coordsNew);CHKERRQ(ierr); 163 ierr = PetscSectionGetChart(csectionNew, &pStart, &pEnd);CHKERRQ(ierr); |
| 164 ierr = ISGetIndices(perm, &pperm);CHKERRQ(ierr); |
|
| 163 for (p = pStart; p < pEnd; ++p) { 164 PetscInt dof, off, offNew, d; 165 166 ierr = PetscSectionGetDof(csectionNew, p, &dof);CHKERRQ(ierr); 167 ierr = PetscSectionGetOffset(csection, p, &off);CHKERRQ(ierr); | 165 for (p = pStart; p < pEnd; ++p) { 166 PetscInt dof, off, offNew, d; 167 168 ierr = PetscSectionGetDof(csectionNew, p, &dof);CHKERRQ(ierr); 169 ierr = PetscSectionGetOffset(csection, p, &off);CHKERRQ(ierr); |
| 168 ierr = PetscSectionGetOffset(csectionNew, p, &offNew);CHKERRQ(ierr); | 170 ierr = PetscSectionGetOffset(csectionNew, pperm[p], &offNew);CHKERRQ(ierr); |
| 169 for (d = 0; d < dof; ++d) coordsNew[offNew+d] = coords[off+d]; 170 } | 171 for (d = 0; d < dof; ++d) coordsNew[offNew+d] = coords[off+d]; 172 } |
| 173 ierr = ISRestoreIndices(perm, &pperm);CHKERRQ(ierr); |
|
| 171 ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr); 172 ierr = VecRestoreArray(coordinatesNew, &coordsNew);CHKERRQ(ierr); 173 ierr = DMGetCoordinateDM(*pdm, &cdmNew);CHKERRQ(ierr); 174 ierr = DMSetDefaultSection(cdmNew, csectionNew);CHKERRQ(ierr); 175 ierr = DMSetCoordinatesLocal(*pdm, coordinatesNew);CHKERRQ(ierr); 176 ierr = PetscSectionDestroy(&csectionNew);CHKERRQ(ierr); 177 ierr = VecDestroy(&coordinatesNew);CHKERRQ(ierr); 178 } --- 61 unchanged lines hidden --- | 174 ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr); 175 ierr = VecRestoreArray(coordinatesNew, &coordsNew);CHKERRQ(ierr); 176 ierr = DMGetCoordinateDM(*pdm, &cdmNew);CHKERRQ(ierr); 177 ierr = DMSetDefaultSection(cdmNew, csectionNew);CHKERRQ(ierr); 178 ierr = DMSetCoordinatesLocal(*pdm, coordinatesNew);CHKERRQ(ierr); 179 ierr = PetscSectionDestroy(&csectionNew);CHKERRQ(ierr); 180 ierr = VecDestroy(&coordinatesNew);CHKERRQ(ierr); 181 } --- 61 unchanged lines hidden --- |