Commits

Matt Knepley committed da291f9 Merge

Merge branch 'knepley/builder-fix-deps' into next

* knepley/builder-fix-deps:
Builder: Jed changed the dependency info, fixed parsing
version: fix PETSC_VERSION_LT() to require PETSC_VERSION_RELEASE=1
Docs: Changes three papers which are now published
SNES ex72: Minimal fixes to make it build and run

Comments (0)

Files changed (5)

config/builder.py

     '''
     with file(depFile) as f:
       try:
-        target, deps = f.read().split(':')
+        target, deps = f.read().split(':', 1)
       except ValueError as e:
         self.logPrint('ERROR in dependency file %s: %s' % (depFile, str(e)))
     target = target.split()[0]
     if (target != self.sourceManager.getObjectName(source)): print target, self.sourceManager.getObjectName(source)
     assert(target == self.sourceManager.getObjectName(source))
+    deps = deps.split('\n\n')[0]
     deps = [d for d in deps.replace('\\','').split() if not os.path.splitext(d)[1] == '.mod']
     if not os.path.basename(deps[0]) == source:
       raise RuntimeError('ERROR: first dependency %s should be %s' % (deps[0], source))

include/petscversion.h

    (PETSC_VERSION_RELEASE  == 1))
 
 #define PETSC_VERSION_LT(MAJOR,MINOR,SUBMINOR)          \
-  (PETSC_VERSION_RELEASE == 0 &&                        \
+  (PETSC_VERSION_RELEASE == 1 &&                        \
    (PETSC_VERSION_MAJOR < (MAJOR) ||                    \
     (PETSC_VERSION_MAJOR == (MAJOR) &&                  \
      (PETSC_VERSION_MINOR < (MINOR) ||                  \

src/docs/tex/petsc.bib

   author  = {Amy Kreienkamp and Lucy Y. Liu and Mona S. Minkara and Matthew G. Knepley and Jaydeep P. Bardhan and Mala L. Radhakrishnan},
   title   = {Analysis of fast boundary-integral approximations for modeling electrostatic contributions of molecular binding},
   journal = {Molecular Based Mathematical Biology},
-  note    = {In review},
+  volume  = {1},
+  pages   = {124--150},
+  doi     = {10.2478/mlbmb-2013-0007},
+  issn    = {2299-3266},
+  month   = {June},
+  note    = {\url{http://www.degruyter.com/view/j/mlbmb.2012.1.issue/mlbmb-2013-0007/mlbmb-2013-0007.xml}},
   year    = {2013}
 }
 

src/docs/tex/petscapp.bib

 @article{AagaardKnepleyWilliams13,
   title   = {A Domain Decomposition Approach to Implementing Fault Slip in Finite-Element Models of Quasi-static and Dynamic Crustal Deformation},
   author  = {Brad T. Aagaard and Matthew G. Knepley and Charles A. Williams},
-  journal = {Journal of Geophysical Research},
-  note    = {In review},
+  journal = {Journal of Geophysical Research: Solid Earth},
+  issn    = {2169-9356},
+  url     = {http://dx.doi.org/10.1002/jgrb.50217},
+  doi     = {10.1002/jgrb.50217},
+  keywords = {fault slip, finite-element modeling, crustal deformation, earthquake physics},
   year    = {2013}
 }
 @inproceedings{AagaardKnepleyWilliams11,
   year      = {2013},
   isbn      = {978-3-642-16404-0},
 }
+@article{ZhengEtAl13,
+  title     = {Implementation of a multigrid solver on GPU for Stokes equations with strongly variable viscosity based on Matlab and CUDA},
+  author    = {Liang Zheng and Taras Gerya and Matthew G. Knepley and David A. Yuen and Huai Zhang and Yaolin Shi},
+  journal   = {IJHPCA},
+  url       = {http://hpc.sagepub.com/content/early/2013/03/03/1094342013478640.abstract},
+  year      = {2013}
+}
 @inbook{s2011,
   author = "B. Smith",
   chapter = "PETSc, the Portable, Extensible Toolkit for Scientific computing",

src/snes/examples/tutorials/ex72.c

   BCType        bcType;            /* The type of boundary conditions */
 } AppCtx;
 
-typedef struct {
-  DM     dm;
-  Vec    u;  /* The base vector for the Jacbobian action J(u) x */
-  Mat    J;  /* Preconditioner for testing */
-  AppCtx *user;
-} JacActionCtx;
-
 PetscScalar zero(const PetscReal coords[])
 {
   return 0.0;
 };
 
 #undef __FUNCT__
-#define __FUNCT__ "VecChop"
-PetscErrorCode VecChop(Vec v, PetscReal tol)
-{
-  PetscScalar    *a;
-  PetscInt       n, i;
-  PetscErrorCode ierr;
-
-  PetscFunctionBeginUser;
-  ierr = VecGetLocalSize(v, &n);CHKERRQ(ierr);
-  ierr = VecGetArray(v, &a);CHKERRQ(ierr);
-  for (i = 0; i < n; ++i) {
-    if (PetscAbsScalar(a[i]) < tol) a[i] = 0.0;
-  }
-  ierr = VecRestoreArray(v, &a);CHKERRQ(ierr);
-  PetscFunctionReturn(0);
-}
-
-#undef __FUNCT__
-#define __FUNCT__ "MatChop"
-PetscErrorCode MatChop(Mat A, PetscReal tol)
-{
-  PetscScalar    *newVals;
-  PetscInt       *newCols;
-  PetscInt       rStart, rEnd, numRows, maxRows, r, colMax = 0;
-  PetscErrorCode ierr;
-
-  PetscFunctionBeginUser;
-  ierr = MatGetOwnershipRange(A, &rStart, &rEnd);CHKERRQ(ierr);
-  for (r = rStart; r < rEnd; ++r) {
-    PetscInt ncols;
-
-    ierr   = MatGetRow(A, r, &ncols, NULL, NULL);CHKERRQ(ierr);
-    colMax = PetscMax(colMax, ncols);CHKERRQ(ierr);
-    ierr   = MatRestoreRow(A, r, &ncols, NULL, NULL);CHKERRQ(ierr);
-  }
-  numRows = rEnd - rStart;
-  ierr    = MPI_Allreduce(&numRows, &maxRows, 1, MPIU_INT, MPI_MAX, PETSC_COMM_WORLD);CHKERRQ(ierr);
-  ierr    = PetscMalloc2(colMax,PetscInt,&newCols,colMax,PetscScalar,&newVals);CHKERRQ(ierr);
-  for (r = rStart; r < rStart+maxRows; ++r) {
-    const PetscScalar *vals;
-    const PetscInt    *cols;
-    PetscInt          ncols, c;
-
-    if (r < rEnd) {
-      ierr = MatGetRow(A, r, &ncols, &cols, &vals);CHKERRQ(ierr);
-      for (c = 0; c < ncols; ++c) {
-        newCols[c] = cols[c];
-        newVals[c] = PetscAbsScalar(vals[c]) < tol ? 0.0 : vals[c];
-      }
-      ierr = MatRestoreRow(A, r, &ncols, &cols, &vals);CHKERRQ(ierr);
-      ierr = MatSetValues(A, 1, &r, ncols, newCols, newVals, INSERT_VALUES);CHKERRQ(ierr);
-    }
-    ierr = MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
-    ierr = MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
-  }
-  ierr = PetscFree2(newCols,newVals);CHKERRQ(ierr);
-  PetscFunctionReturn(0);
-}
-
-#undef __FUNCT__
 #define __FUNCT__ "CreateMesh"
 PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm)
 {
     DM distributedMesh = NULL;
 
     /* Distribute mesh over processes */
-    ierr = DMPlexDistribute(*dm, partitioner, &distributedMesh);CHKERRQ(ierr);
+    ierr = DMPlexDistribute(*dm, partitioner, 0, &distributedMesh);CHKERRQ(ierr);
     if (distributedMesh) {
       ierr = DMDestroy(dm);CHKERRQ(ierr);
       *dm  = distributedMesh;
   ierr = PetscMalloc4(dim,PetscReal,&coords,dim,PetscReal,&v0,dim*dim,PetscReal,&J,dim*dim,PetscReal,&invJ);CHKERRQ(ierr);
   ierr = DMPlexGetHeightStratum(user->dm, 0, &cStart, &cEnd);CHKERRQ(ierr);
   for (c = cStart; c < cEnd; ++c) {
-    const PetscScalar *x;
-    PetscReal         elemError = 0.0;
+    PetscScalar *x = NULL;
+    PetscReal    elemError = 0.0;
 
     ierr = DMPlexComputeCellGeometry(user->dm, c, v0, J, invJ, &detJ);CHKERRQ(ierr);
     if (detJ <= 0.0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Invalid determinant %g for element %d", detJ, c);
   ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr);
   ierr = DMGetDefaultSection(dm, &section);CHKERRQ(ierr);
   ierr = DMPlexGetCoordinateSection(dm, &cSection);CHKERRQ(ierr);
-  ierr = DMPlexGetCoordinateVec(dm, &coordinates);CHKERRQ(ierr);
+  ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr);
   ierr = PetscMalloc(numComp * sizeof(PetscScalar), &values);CHKERRQ(ierr);
   for (v = vStart; v < vEnd; ++v) {
     PetscScalar *coords;
   PetscErrorCode ierr;
 
   PetscFunctionBeginUser;
-  PetscValidHeaderSpecific(J, MAT_CLASSID, 1);
-  PetscValidHeaderSpecific(X, VEC_CLASSID, 2);
-  PetscValidHeaderSpecific(Y, VEC_CLASSID, 3);
   ierr = MatShellGetContext(J, &ctx);CHKERRQ(ierr);
   dm   = ctx->dm;
 
 
     ierr = SNESGetKSP(snes, &ksp);CHKERRQ(ierr);
     ierr = KSPGetPC(ksp, &pc);CHKERRQ(ierr);
-    ierr = DMPlexGetCoordinateVec(user.dm, &crd_vec);CHKERRQ(ierr);
+    ierr = DMGetCoordinatesLocal(user.dm, &crd_vec);CHKERRQ(ierr);
     ierr = VecGetLocalSize(crd_vec,&mlocal);CHKERRQ(ierr);
     ierr = PetscMalloc(SPATIAL_DIM_0*mlocal*sizeof(*coords),&coords);CHKERRQ(ierr);
     ierr = VecGetArrayRead(crd_vec,&v);CHKERRQ(ierr);