1. petsc
  2. PETSc
  3. petsc

Commits

Matt Knepley  committed 9a10367 Merge

Merge branch 'knepley/fix-plex-refine-unsplit' into knepley/pylith

* knepley/fix-plex-refine-unsplit:
DMPlex: In hybrid face construction, orientation was wrong for faces from unsplit edges
tests: move ex151 out of complex tests to avoid compile errors on windows
Microsoft C++ compiler needs extra care with complex numbers and casting
DMPlex: C++ has fucking namespaces, use them assholes
Field has 3 components therefor need to initialize three components, Microsoft C compiler demands it
SNESASPIN: Test for ex16 with ASPIN
SNESASPIN: Fix for the case of zero iterations
Mat: Doc fix for MatSetOption() Reported-by: Christiaan Klaij <C.Klaij@marin.nl>
PCML: Doc fix Reported-by: Xiangdong <epscodes@gmail.com>
When configuring with MPIUni remove any MPI includes in the $PETSC_DIR/PETSC_ARCH/include directory that may have been put there by earlier ./configure runs.

  • Participants
  • Parent commits 7b2be12, 212cc91
  • Branches knepley/pylith, next-apr-2016 1
    1. sarich/feature-tao-pounders-off-diagonal-terms

Comments (0)

Files changed (12)

File config/PETSc/Configure.py

View file
  • Ignore whitespace
   def Dump(self):
     ''' Actually put the values into the configuration files '''
     # eventually everything between -- should be gone
+    if self.mpi.usingMPIUni:
+      #
+      # Remove any MPI/MPICH include files that may have been put here by previous runs of ./configure
+      self.executeShellCommand('rm -rf  '+os.path.join(self.petscdir.dir,self.arch.arch,'include','mpi*')+' '+os.path.join(self.petscdir.dir,self.arch.arch,'include','opa*'))
+
 #-----------------------------------------------------------------------------------------------------
 
     # Sometimes we need C compiler, even if built with C++

File include/petscmath.h

View file
  • Ignore whitespace
 #define MPIU_2INT MPI_2INT
 #endif
 
-PETSC_STATIC_INLINE PetscInt PetscPowInt(PetscInt base,PetscInt power) {
+PETSC_STATIC_INLINE PetscInt PetscPowInt(PetscInt base,PetscInt power) 
+{
   PetscInt result = 1;
   while (power) {
     if (power & 1) result *= base;
   }
   return result;
 }
-PETSC_STATIC_INLINE PetscReal PetscPowRealInt(PetscReal base,PetscInt power) {
+
+PETSC_STATIC_INLINE PetscReal PetscPowRealInt(PetscReal base,PetscInt power) 
+{
   PetscReal result = 1;
   if (power < 0) {
     power = -power;
   return result;
 }
 
-PETSC_STATIC_INLINE PetscScalar PetscPowScalarInt(PetscScalar base,PetscInt power) {
+PETSC_STATIC_INLINE PetscScalar PetscPowScalarInt(PetscScalar base,PetscInt power) 
+{
   PetscScalar result = 1;
   if (power < 0) {
     power = -power;
   return result;
 }
 
+PETSC_STATIC_INLINE PetscScalar PetscPowScalarReal(PetscScalar base,PetscReal power)
+{
+  PetscScalar cpower = power;
+  return PetscPowScalar(base,cpower);
+}
 #endif

File src/dm/impls/plex/plexfem.c

View file
  • Ignore whitespace
 - user - The user context
 
   Output Parameter:
-. I  - The interpolation matrix
+. In  - The interpolation matrix
 
   Note:
   The first member of the user context must be an FEMContext.
 
 .seealso: DMPlexComputeJacobianFEM()
 @*/
-PetscErrorCode DMPlexComputeInterpolatorFEM(DM dmc, DM dmf, Mat I, void *user)
+PetscErrorCode DMPlexComputeInterpolatorFEM(DM dmc, DM dmf, Mat In, void *user)
 {
   DM_Plex          *mesh  = (DM_Plex *) dmc->data;
   PetscFEM         *fem   = (PetscFEM *) user;
     rCellDof += rNb*Nc;
     cCellDof += cNb*Nc;
   }
-  ierr = MatZeroEntries(I);CHKERRQ(ierr);
+  ierr = MatZeroEntries(In);CHKERRQ(ierr);
   ierr = PetscMalloc1(rCellDof*cCellDof,&elemMat);CHKERRQ(ierr);
   ierr = PetscMemzero(elemMat, rCellDof*cCellDof * sizeof(PetscScalar));CHKERRQ(ierr);
   for (fieldI = 0, offsetI = 0; fieldI < Nf; ++fieldI) {
   }
   if (mesh->printFEM > 1) {ierr = DMPrintCellMatrix(0, name, rCellDof, cCellDof, elemMat);CHKERRQ(ierr);}
   for (c = cStart; c < cEnd; ++c) {
-    ierr = DMPlexMatSetClosureRefined(dmf, fsection, fglobalSection, dmc, csection, cglobalSection, I, c, elemMat, INSERT_VALUES);CHKERRQ(ierr);
+    ierr = DMPlexMatSetClosureRefined(dmf, fsection, fglobalSection, dmc, csection, cglobalSection, In, c, elemMat, INSERT_VALUES);CHKERRQ(ierr);
   }
   for (f = 0; f < Nf; ++f) {ierr = PetscFEDestroy(&feRef[f]);CHKERRQ(ierr);}
   ierr = PetscFree(feRef);CHKERRQ(ierr);
   ierr = PetscFree(elemMat);CHKERRQ(ierr);
-  ierr = MatAssemblyBegin(I, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
-  ierr = MatAssemblyEnd(I, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
+  ierr = MatAssemblyBegin(In, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
+  ierr = MatAssemblyEnd(In, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
   if (mesh->printFEM) {
     ierr = PetscPrintf(PETSC_COMM_WORLD, "%s:\n", name);CHKERRQ(ierr);
-    ierr = MatChop(I, 1.0e-10);CHKERRQ(ierr);
-    ierr = MatView(I, PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
+    ierr = MatChop(In, 1.0e-10);CHKERRQ(ierr);
+    ierr = MatView(In, PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
   }
 #if 0
   ierr = PetscLogEventEnd(DMPLEX_InterpolatorFEM,dmc,dmf,0,0);CHKERRQ(ierr);

File src/dm/impls/plex/plexsubmesh.c

View file
  • Ignore whitespace
         ierr = DMPlexSetSupport(sdm, newp, supportNew);CHKERRQ(ierr);
         /* Add hybrid face */
         coneNew[0] = newp;
+        coneNew[1] = newp;
         ierr = PetscFindInt(cone[0], numUnsplitPoints[dep-1], unsplitPoints[dep-1], &v);CHKERRQ(ierr);
         if (v < 0) SETERRQ1(comm, PETSC_ERR_ARG_WRONG, "Vertex %d is not an unsplit vertex", cone[0]);
-        coneNew[1] = v + pMaxNew[dep] + numSplitPoints[dep] + numSplitPoints[dep-1];
-        coneNew[2] = newp;
+        coneNew[2] = v + pMaxNew[dep] + numSplitPoints[dep] + numSplitPoints[dep-1];
         ierr = PetscFindInt(cone[1], numUnsplitPoints[dep-1], unsplitPoints[dep-1], &v);CHKERRQ(ierr);
         if (v < 0) SETERRQ1(comm, PETSC_ERR_ARG_WRONG, "Vertex %d is not an unsplit vertex", cone[1]);
         coneNew[3] = v + pMaxNew[dep] + numSplitPoints[dep] + numSplitPoints[dep-1];

File src/ksp/pc/impls/ml/ml.c

View file
  • Ignore whitespace
        and the restriction/interpolation operators wrapped as PETSc shell matrices.
 
    Options Database Key:
-   Multigrid options(inherited)
+   Multigrid options(inherited):
 +  -pc_mg_cycles <1>: 1 for V cycle, 2 for W-cycle (MGSetCycles)
 .  -pc_mg_smoothup <1>: Number of post-smoothing steps (MGSetNumberSmoothUp)
 .  -pc_mg_smoothdown <1>: Number of pre-smoothing steps (MGSetNumberSmoothDown)
-   -pc_mg_type <multiplicative>: (one of) additive multiplicative full kascade
+-  -pc_mg_type <multiplicative>: (one of) additive multiplicative full kascade
    ML options:
-.  -pc_ml_PrintLevel <0>: Print level (ML_Set_PrintLevel)
++  -pc_ml_PrintLevel <0>: Print level (ML_Set_PrintLevel)
 .  -pc_ml_maxNlevels <10>: Maximum number of levels (None)
 .  -pc_ml_maxCoarseSize <1>: Maximum coarsest mesh size (ML_Aggregate_Set_MaxCoarseSize)
 .  -pc_ml_CoarsenScheme <Uncoupled>: (one of) Uncoupled Coupled MIS METIS

File src/mat/examples/tests/makefile

View file
  • Ignore whitespace
                                  ex133.PETSc ex133.rm ex134.PETSc runex134 ex134.rm ex135.PETSc runex135 ex135.rm ex136.PETSc ex136.rm \
                                  ex137.PETSc runex137 ex137.rm \
                                  ex139.PETSc runex139 ex139.rm ex141.PETSc runex141 ex141.rm \
-                                 ex151.PETSc runex151 runex151_2 runex151_2b runex151_3 runex151_3b ex151.rm \
                                  ex159.PETSc runex159 runex159_nest ex159.rm \
                                  ex160.PETSc runex160 ex160.rm  ex161.PETSc runex161 runex161_2 runex161_3 runex161_4 runex161_5 ex161.rm \
                                  ex164.PETSc runex164 ex164.rm
                                  ex15.PETSc runex15 ex15.rm ex20.PETSc runex20 ex20.rm ex21.PETSc runex21 ex21.rm ex35.PETSc \
                                  runex35 ex35.rm  ex48.PETSc runex48 ex48.rm ex71.PETSc ex71.rm \
                                  ex95.PETSc  ex95.rm ex101.PETSc runex101 ex101.rm
-TESTEXAMPLES_C_NOCOMPLEX       = ex32.PETSc ex32.rm  ex50.PETSc ex50.rm
+TESTEXAMPLES_C_NOCOMPLEX       = ex32.PETSc ex32.rm  ex50.PETSc ex50.rm \
+                                 ex151.PETSc runex151 runex151_2 runex151_2b runex151_3 runex151_3b ex151.rm
 TESTEXAMPLES_DATAFILESPATH     = ex40.PETSc runex40 ex40.rm ex41.PETSc runex41 ex41.rm ex42.PETSc runex42 \
                                  ex42.rm  ex41.PETSc ex41.rm ex47.PETSc ex47.rm ex53.PETSc runex53 ex53.rm \
                                  ex94.PETSc runex94_matmatmult runex94_matmatmult_2 runex94_scalable0 runex94_scalable1 \

File src/mat/interface/matrix.c

View file
  • Ignore whitespace
    data structure.
 
    When (re)assembling a matrix, we can restrict the input for
-   efficiency/debugging purposes.  These options include
+   efficiency/debugging purposes.  These options include:
 +    MAT_NEW_NONZERO_LOCATIONS - additional insertions will be allowed if they generate a new nonzero (slow)
 .    MAT_NEW_DIAGONALS - new diagonals will be allowed (for block diagonal format only)
 .    MAT_IGNORE_OFF_PROC_ENTRIES - drops off-processor entries

File src/snes/examples/tutorials/ex7.c

View file
  • Ignore whitespace
 #define __FUNCT__ "constantResidual"
 PetscErrorCode constantResidual(PetscReal lambda, PetscBool isLower, int i, int j, PetscReal hx, PetscReal hy, Field r[])
 {
-  Field       rLocal[3] = {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}};
+  Field       rLocal[3] = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}};
   PetscScalar phi[3]    = {0.0, 0.0, 0.0};
   PetscReal   xI = i*hx, yI = j*hy, hxhy = hx*hy;
   Field       res;
 #define __FUNCT__ "nonlinearResidual"
 PetscErrorCode nonlinearResidual(PetscReal lambda, Field u[], Field r[])
 {
-  Field       rLocal[3] = {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}};
+  Field       rLocal[3] = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}};
   PetscScalar phi[3]    = {0.0, 0.0, 0.0};
   Field       res;
   PetscInt    q;

File src/snes/examples/tutorials/makefile

View file
  • Ignore whitespace
            -npc_snes_type fas -npc_fas_levels_snes_type ncg -npc_fas_levels_snes_max_it 3 -npc_snes_monitor_short \
 	   > ex16_2.tmp 2>&1; ${DIFF} output/ex16_2.out ex16_2.tmp || printf "${PWD}\nPossible problem with with ex16_2, diffs above\n=========================================\n"; \
            ${RM} -f ex16_2.tmp
+runex16_3:
+	-@${MPIEXEC} ./ex16 -da_refine 1 -da_overlap 3 -da_local_subdomains 4 -snes_type aspin -rad 10.0 -young 10. -ploading 0.0 -loading -0.5 -snes_monitor_short -ksp_monitor_short \
+        -npc_sub_snes_rtol 1e-1 -ksp_rtol 1e-3 \
+	> ex16_3.tmp 2>&1; ${DIFF} output/ex16_3.out ex16_3.tmp || printf "${PWD}\nPossible problem with with ex16_3, diffs above\n=========================================\n"; \
+        ${RM} -f ex16_3.tmp
 runex19:
 	-@${MPIEXEC} -n 2 ./ex19 -da_refine 3 -snes_monitor_short -pc_type mg -ksp_type fgmres -pc_mg_type full > ex19_1.tmp 2>&1; \
 	   if (${DIFF} output/ex19_1.out ex19_1.tmp) then true; \
                                  runex5_5_nasm runex5_5_newton_asm_dmda runex5_5_newton_gasm_dmda \
                                  runex5_6 ex5.rm ex7.PETSc runex7 ex7.rm\
                                  ex14.PETSc runex14 runex14_2 runex14_3 ex14.rm \
-                                 ex15.PETSc runex15 runex15_3 runex15_lag_jac runex15_lag_pc ex15.rm ex18.PETSc runex18 ex18.rm \
+                                 ex15.PETSc runex15 runex15_3 runex15_lag_jac runex15_lag_pc ex15.rm \
+                                 ex16.PETSc runex16_3 ex16.rm \
+                                 ex18.PETSc runex18 ex18.rm \
                                  ex19.PETSc runex19 runex19_2 runex19_bcols1 runex19_2_bcols1 runex19_fdcoloring_wp runex19_fdcoloring_ds \
                                  runex19_fdcoloring_wp_bcols1 runex19_fdcoloring_ds_bcols1 \
                                  runex19_fdcoloring_wp_baij runex19_fdcoloring_ds_baij runex19_5 \

File src/snes/examples/tutorials/output/ex16_3.out

View file
  • Ignore whitespace
+lambda: 2.777778 mu: 4.166667
+  0 SNES Function norm 18.7531 
+    0 KSP Residual norm 18.7531 
+    1 KSP Residual norm 8.05256 
+    2 KSP Residual norm 8.04786 
+    3 KSP Residual norm 4.27617 
+    4 KSP Residual norm 3.62967 
+    5 KSP Residual norm 1.71735 
+    6 KSP Residual norm 0.588593 
+    7 KSP Residual norm 0.202214 
+    8 KSP Residual norm 0.0806734 
+    9 KSP Residual norm 0.0669857 
+   10 KSP Residual norm 0.0623931 
+   11 KSP Residual norm 0.0538008 
+   12 KSP Residual norm 0.016186 
+  1 SNES Function norm 10.4021 
+    0 KSP Residual norm 10.4021 
+    1 KSP Residual norm 3.42492 
+    2 KSP Residual norm 2.21113 
+    3 KSP Residual norm 0.950724 
+    4 KSP Residual norm 0.760002 
+    5 KSP Residual norm 0.306077 
+    6 KSP Residual norm 0.235119 
+    7 KSP Residual norm 0.129355 
+    8 KSP Residual norm 0.122988 
+    9 KSP Residual norm 0.102518 
+   10 KSP Residual norm 0.0355132 
+   11 KSP Residual norm 0.0163353 
+   12 KSP Residual norm 0.0140545 
+   13 KSP Residual norm 0.0106957 
+   14 KSP Residual norm 0.00616451 
+  2 SNES Function norm 1.00734 
+    0 KSP Residual norm 1.00734 
+    1 KSP Residual norm 0.567055 
+    2 KSP Residual norm 0.471574 
+    3 KSP Residual norm 0.21098 
+    4 KSP Residual norm 0.0997817 
+    5 KSP Residual norm 0.0539412 
+    6 KSP Residual norm 0.0336272 
+    7 KSP Residual norm 0.0273344 
+    8 KSP Residual norm 0.0236243 
+    9 KSP Residual norm 0.0173613 
+   10 KSP Residual norm 0.0124758 
+   11 KSP Residual norm 0.00736045 
+   12 KSP Residual norm 0.00236986 
+   13 KSP Residual norm 0.000516898 
+  3 SNES Function norm 0.0226603 
+    0 KSP Residual norm 0.0226603 
+    1 KSP Residual norm 0.0140148 
+    2 KSP Residual norm 0.00726117 
+    3 KSP Residual norm 0.00452695 
+    4 KSP Residual norm 0.0023784 
+    5 KSP Residual norm 0.00146327 
+    6 KSP Residual norm 0.000756808 
+    7 KSP Residual norm 0.000213204 
+    8 KSP Residual norm 8.1835e-05 
+    9 KSP Residual norm 7.0229e-05 
+   10 KSP Residual norm 6.42218e-05 
+   11 KSP Residual norm 6.0983e-05 
+   12 KSP Residual norm 4.25973e-05 
+   13 KSP Residual norm 3.51369e-05 
+   14 KSP Residual norm 2.39262e-05 
+   15 KSP Residual norm 2.33202e-05 
+   16 KSP Residual norm 2.25052e-05 
+  4 SNES Function norm 3.60231e-05 
+    0 KSP Residual norm 3.60231e-05 
+    1 KSP Residual norm 2.83768e-05 
+    2 KSP Residual norm 2.63883e-05 
+    3 KSP Residual norm 2.62197e-05 
+    4 KSP Residual norm 2.60675e-05 
+    5 KSP Residual norm 2.20031e-05 
+    6 KSP Residual norm 1.62981e-05 
+    7 KSP Residual norm 1.11855e-05 
+    8 KSP Residual norm 4.77946e-06 
+    9 KSP Residual norm 3.38491e-06 
+   10 KSP Residual norm 3.18286e-06 
+   11 KSP Residual norm 3.03849e-06 
+   12 KSP Residual norm 2.56911e-06 
+   13 KSP Residual norm 1.86423e-06 
+   14 KSP Residual norm 1.04632e-06 
+   15 KSP Residual norm 3.12907e-07 
+   16 KSP Residual norm 1.2336e-07 
+   17 KSP Residual norm 3.52811e-08 
+  5 SNES Function norm 3.52358e-08 
+Number of SNES iterations = 5

File src/snes/impls/nasm/aspin.c

View file
  • Ignore whitespace
   PetscBool      match;
   MPI_Comm       comm;
   KSP            ksp;
-  PC             pc;
   Vec            *x,*b;
   Vec            W;
   SNES           npc;
+  Mat            subJ,subpJ;
 
   PetscFunctionBegin;
   ierr = MatShellGetContext(m,&ctx);CHKERRQ(ierr);
   for (i=0;i<n;i++) {
     ierr = VecScatterEnd(oscatter[i],W,b[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
     ierr = VecSet(x[i],0.);CHKERRQ(ierr);
+    ierr = SNESGetJacobian(subsnes[i],&subJ,&subpJ,NULL,NULL);CHKERRQ(ierr);
     ierr = SNESGetKSP(subsnes[i],&ksp);CHKERRQ(ierr);
-    ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
-    ierr = PCApply(pc,b[i],x[i]);CHKERRQ(ierr);
+    ierr = KSPSetOperators(ksp,subJ,subpJ);CHKERRQ(ierr);
+    ierr = KSPSolve(ksp,b[i],x[i]);CHKERRQ(ierr);
     ierr = VecScatterBegin(oscatter[i],x[i],Y,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
   }
   for (i=0;i<n;i++) {

File src/ts/examples/tutorials/ex10.c

View file
  • Ignore whitespace
               chi_t = -chi / T * T_t,
               a     = 1.,
               a_t   = 0,
-              b     = 4. * rd->m_p / rd->rho * PetscPowScalar(2. * PETSC_PI * rd->m_e * rd->I_H / PetscSqr(rd->h),1.5) * PetscExpScalar(-chi) * PetscPowScalar(chi,1.5), /* Eq 7 */
+              b     = 4. * rd->m_p / rd->rho * PetscPowScalarReal(2. * PETSC_PI * rd->m_e * rd->I_H / PetscSqr(rd->h),1.5) * PetscExpScalar(-chi) * PetscPowScalarReal(chi,1.5), /* Eq 7 */
               b_t   = -b*chi_t + 1.5*b/chi*chi_t,
               c     = -b,
               c_t   = -b_t;
       x[i].T = RDRadiationTemperature(rd,x[i].E);
       break;
     case 3:
-      x[i].E = 7.56e-2 * rd->unit.Joule / PetscPowScalar(rd->unit.meter,3);
+      x[i].E = 7.56e-2 * rd->unit.Joule / PetscPowScalarInt(rd->unit.meter,3);
       x[i].T = RDRadiationTemperature(rd,x[i].E);
       break;
     default: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"No initial state %D",rd->initial);