Commits

Satish Balay committed b91785b Merge

Merge branch 'balay/update-sowing' into knepley/feature-plex-generic-distribute

Comments (0)

Files changed (6)

config/PETSc/packages/sowing.py

 class Configure(PETSc.package.NewPackage):
   def __init__(self, framework):
     PETSc.package.NewPackage.__init__(self, framework)
-    self.download          = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/sowing-1.1.16d.tar.gz']
+    self.download          = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/sowing-1.1.16e.tar.gz']
     self.complex           = 1
     self.double            = 0
     self.requires32bitint  = 0

include/mpiuni/mpi.h

 
 #define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
 #define MPI_Comm_c2f(comm) (MPI_Fint)(comm)
+#define MPI_Type_f2c(type) (MPI_Datatype)(type)
+#define MPI_Type_c2f(type) (MPI_Fint)(type)
 
 #define MPI_Send(buf,count,datatype,dest,tag,comm)  \
      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\

src/dm/impls/da/dacreate.c

 
   PetscFunctionBegin;
   if (subdm) {
-    ierr = DMClone(dm, subdm);CHKERRQ(ierr);
+    PetscSF sf;
+    Vec     coords;
+    void   *ctx;
+    /* Cannot use DMClone since the dof stuff is mixed in. Ugh
+    ierr = DMClone(dm, subdm);CHKERRQ(ierr); */
+    ierr = DMCreate(PetscObjectComm((PetscObject)dm), subdm);CHKERRQ(ierr);
+    ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr);
+    ierr = DMSetPointSF(*subdm, sf);CHKERRQ(ierr);
+    ierr = DMGetApplicationContext(dm, &ctx);CHKERRQ(ierr);
+    ierr = DMSetApplicationContext(*subdm, ctx);CHKERRQ(ierr);
+    ierr = DMGetCoordinatesLocal(dm, &coords);CHKERRQ(ierr);
+    if (coords) {
+      ierr = DMSetCoordinatesLocal(*subdm, coords);CHKERRQ(ierr);
+    } else {
+      ierr = DMGetCoordinates(dm, &coords);CHKERRQ(ierr);
+      if (coords) {ierr = DMSetCoordinates(*subdm, coords);CHKERRQ(ierr);}
+    }
+
+    ierr = DMSetType(*subdm, DMDA);CHKERRQ(ierr);
+    ierr = DMDASetDim(*subdm, da->dim);CHKERRQ(ierr);
+    ierr = DMDASetSizes(*subdm, da->M, da->N, da->P);CHKERRQ(ierr);
+    ierr = DMDASetNumProcs(*subdm, da->m, da->n, da->p);CHKERRQ(ierr);
+    ierr = DMDASetBoundaryType(*subdm, da->bx, da->by, da->bz);CHKERRQ(ierr);
     ierr = DMDASetDof(*subdm, numFields);CHKERRQ(ierr);
+    ierr = DMDASetStencilType(*subdm, da->stencil_type);CHKERRQ(ierr);
+    ierr = DMDASetStencilWidth(*subdm, da->s);CHKERRQ(ierr);
+    ierr = DMDASetOwnershipRanges(*subdm, da->lx, da->ly, da->lz);CHKERRQ(ierr);
   }
   ierr = DMGetDefaultSection(dm, &section);CHKERRQ(ierr);
   if (section) {
   ierr = DMDASetStencilType(*newdm, da->stencil_type);CHKERRQ(ierr);
   ierr = DMDASetStencilWidth(*newdm, da->s);CHKERRQ(ierr);
   ierr = DMDASetOwnershipRanges(*newdm, da->lx, da->ly, da->lz);CHKERRQ(ierr);
+  ierr = DMSetUp(*newdm);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 

src/dm/impls/da/dalocal.c

 @*/
 PetscErrorCode DMDACreateSection(DM dm, PetscInt numComp[], PetscInt numVertexDof[], PetscInt numFaceDof[], PetscInt numCellDof[])
 {
-  DM_DA             *da = (DM_DA*) dm->data;
+  DM_DA            *da  = (DM_DA*) dm->data;
+  PetscSection      section;
   const PetscInt    dim = da->dim;
   PetscInt          numFields, numVertexTotDof = 0, numCellTotDof = 0, numFaceTotDof[3] = {0, 0, 0};
   PetscSF           sf;
       numFaceTotDof[2] += dim > 2 ? numFaceDof[f*dim+2] : 0;
     }
   }
-  ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), &dm->defaultSection);CHKERRQ(ierr);
+  ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), &section);CHKERRQ(ierr);
   if (numFields > 1) {
-    ierr = PetscSectionSetNumFields(dm->defaultSection, numFields);CHKERRQ(ierr);
+    ierr = PetscSectionSetNumFields(section, numFields);CHKERRQ(ierr);
     for (f = 0; f < numFields; ++f) {
       const char *name;
 
       ierr = DMDAGetFieldName(dm, f, &name);CHKERRQ(ierr);
-      ierr = PetscSectionSetFieldName(dm->defaultSection, f, name);CHKERRQ(ierr);
+      ierr = PetscSectionSetFieldName(section, f, name);CHKERRQ(ierr);
       if (numComp) {
-        ierr = PetscSectionSetFieldComponents(dm->defaultSection, f, numComp[f]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldComponents(section, f, numComp[f]);CHKERRQ(ierr);
       }
     }
   } else {
     numFields = 0;
   }
-  ierr = PetscSectionSetChart(dm->defaultSection, pStart, pEnd);CHKERRQ(ierr);
+  ierr = PetscSectionSetChart(section, pStart, pEnd);CHKERRQ(ierr);
   if (numVertexDof) {
     for (v = vStart; v < vEnd; ++v) {
       for (f = 0; f < numFields; ++f) {
-        ierr = PetscSectionSetFieldDof(dm->defaultSection, v, f, numVertexDof[f]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldDof(section, v, f, numVertexDof[f]);CHKERRQ(ierr);
       }
-      ierr = PetscSectionSetDof(dm->defaultSection, v, numVertexTotDof);CHKERRQ(ierr);
+      ierr = PetscSectionSetDof(section, v, numVertexTotDof);CHKERRQ(ierr);
     }
   }
   if (numFaceDof) {
     for (xf = xfStart; xf < xfEnd; ++xf) {
       for (f = 0; f < numFields; ++f) {
-        ierr = PetscSectionSetFieldDof(dm->defaultSection, xf, f, numFaceDof[f*dim+0]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldDof(section, xf, f, numFaceDof[f*dim+0]);CHKERRQ(ierr);
       }
-      ierr = PetscSectionSetDof(dm->defaultSection, xf, numFaceTotDof[0]);CHKERRQ(ierr);
+      ierr = PetscSectionSetDof(section, xf, numFaceTotDof[0]);CHKERRQ(ierr);
     }
     for (yf = yfStart; yf < yfEnd; ++yf) {
       for (f = 0; f < numFields; ++f) {
-        ierr = PetscSectionSetFieldDof(dm->defaultSection, yf, f, numFaceDof[f*dim+1]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldDof(section, yf, f, numFaceDof[f*dim+1]);CHKERRQ(ierr);
       }
-      ierr = PetscSectionSetDof(dm->defaultSection, yf, numFaceTotDof[1]);CHKERRQ(ierr);
+      ierr = PetscSectionSetDof(section, yf, numFaceTotDof[1]);CHKERRQ(ierr);
     }
     for (zf = zfStart; zf < zfEnd; ++zf) {
       for (f = 0; f < numFields; ++f) {
-        ierr = PetscSectionSetFieldDof(dm->defaultSection, zf, f, numFaceDof[f*dim+2]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldDof(section, zf, f, numFaceDof[f*dim+2]);CHKERRQ(ierr);
       }
-      ierr = PetscSectionSetDof(dm->defaultSection, zf, numFaceTotDof[2]);CHKERRQ(ierr);
+      ierr = PetscSectionSetDof(section, zf, numFaceTotDof[2]);CHKERRQ(ierr);
     }
   }
   if (numCellDof) {
     for (c = cStart; c < cEnd; ++c) {
       for (f = 0; f < numFields; ++f) {
-        ierr = PetscSectionSetFieldDof(dm->defaultSection, c, f, numCellDof[f]);CHKERRQ(ierr);
+        ierr = PetscSectionSetFieldDof(section, c, f, numCellDof[f]);CHKERRQ(ierr);
       }
-      ierr = PetscSectionSetDof(dm->defaultSection, c, numCellTotDof);CHKERRQ(ierr);
+      ierr = PetscSectionSetDof(section, c, numCellTotDof);CHKERRQ(ierr);
     }
   }
-  ierr = PetscSectionSetUp(dm->defaultSection);CHKERRQ(ierr);
+  ierr = PetscSectionSetUp(section);CHKERRQ(ierr);
   /* Create mesh point SF */
   ierr = DMDAGetNeighbors(dm, &neighbors);CHKERRQ(ierr);
   for (zn = 0; zn < (dim > 2 ? 3 : 1); ++zn) {
   if (nleaves != nleavesCheck) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_PLIB, "The number of leaves %d did not match the number of remote leaves %d", nleaves, nleavesCheck);
   ierr = PetscSFCreate(PetscObjectComm((PetscObject)dm), &sf);CHKERRQ(ierr);
   ierr = PetscSFSetGraph(sf, pEnd, nleaves, localPoints, PETSC_OWN_POINTER, remotePoints, PETSC_OWN_POINTER);CHKERRQ(ierr);
-  /* Create global section */
-  ierr = PetscSectionCreateGlobalSection(dm->defaultSection, sf, PETSC_FALSE, &dm->defaultGlobalSection);CHKERRQ(ierr);
+  ierr = DMSetPointSF(dm, sf);CHKERRQ(ierr);
   ierr = PetscSFDestroy(&sf);CHKERRQ(ierr);
-  /* Create default SF */
-  ierr = DMCreateDefaultSF(dm, dm->defaultSection, dm->defaultGlobalSection);CHKERRQ(ierr);
+  ierr = DMSetDefaultSection(dm, section);CHKERRQ(ierr);
+  ierr = PetscSectionDestroy(&section);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 

src/dm/impls/plex/plexcgns.c

         ierr = PetscMalloc(elementDataSize * sizeof(cgsize_t), &elements);CHKERRQ(ierr);
         ierr = cg_elements_read(cgid, 1, z, 1, elements, NULL);CHKERRQ(ierr);
         for (c_loc = start, off = 0; c_loc < end; ++c_loc, ++c) {
-          cellType = elements[off];
-          switch (cellType) {
+          switch (elements[off]) {
           case TRI_3:   numCorners = 3;break;
           case QUAD_4:  numCorners = 4;break;
           case TETRA_4: numCorners = 4;break;
           case HEXA_8:  numCorners = 8;break;
-          default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid cell type %d", (int) cellType);
+          default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid cell type %d", (int) elements[off]);
           }
           ierr = DMPlexSetConeSize(*dm, c, numCorners);CHKERRQ(ierr);
           off += numCorners+1;
       if (cellType == MIXED) {
         /* CGNS uses Fortran-based indexing, sieve uses C-style and numbers cell first then vertices. */
         for (c_loc = 0, v = 0; c_loc < numc; ++c_loc, ++c) {
-          cellType = elements[v]; ++v;
-          switch (cellType) {
+          switch (elements[v]) {
           case TRI_3:   numCorners = 3;break;
           case QUAD_4:  numCorners = 4;break;
           case TETRA_4: numCorners = 4;break;
           case HEXA_8:  numCorners = 8;break;
-          default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid cell type %d", (int) cellType);
+          default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Invalid cell type %d", (int) elements[v]);
           }
+          ++v;
           for (v_loc = 0; v_loc < numCorners; ++v_loc, ++v) {
             cone[v_loc] = elements[v]+numCells-1;
           }

src/dm/interface/dm.c

   if (dm->ops->clone) {
     ierr = (*dm->ops->clone)(dm, newdm);CHKERRQ(ierr);
   }
+  (*newdm)->setupcalled = PETSC_TRUE;
   ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr);
   ierr = DMSetPointSF(*newdm, sf);CHKERRQ(ierr);
   ierr = DMGetApplicationContext(dm, &ctx);CHKERRQ(ierr);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.