Commits

Matt Knepley committed 0c00f0a Merge

Merge branch 'knepley/feature-mat-orderings' into next

* knepley/feature-mat-orderings:
MatOrdering: Fixes for complex

  • Participants
  • Parent commits 18163ac, b51f950
  • Branches jed/next-seaice, knepley/fix-quadrature-order 2
    1. madams/sr1
    2. next-oct-2014

Comments (0)

Files changed (3)

File src/mat/order/hslmc64.c

 #include <petscsys.h>
 #include <petsc-private/matorderimpl.h>
 
+#ifdef PETSC_USE_COMPLEX
+
+PetscErrorCode HSLmc64AD(const PetscInt *job, PetscInt *m, PetscInt *n, 
+                         PetscInt *ne, const PetscInt *ip, const PetscInt *irn, PetscScalar *a, PetscInt *num, 
+                         PetscInt *perm, PetscInt *liw, PetscInt *iw, PetscInt *ldw, PetscScalar *dw,
+                         PetscInt *icntl, PetscScalar *cntl, PetscInt *info)
+{
+  SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "HSL MC64 does not support complex numbers");
+}
+
+#else
+
 /* Table of constant values */
 
 static PetscInt c__1 = 1;
     PetscFunctionReturn(0);
 
 }
+
+#endif /* PETSC_USE_COMPLEX */

File src/mat/order/spectral.c

 #define __FUNCT__ "MatGetOrdering_Spectral"
 PETSC_EXTERN PetscErrorCode MatGetOrdering_Spectral(Mat A, MatOrderingType type, IS *row, IS *col)
 {
-  Mat               L;
-  PetscInt         *perm, tmp;
-  const PetscScalar eps = 1.0e-12;
-  PetscErrorCode    ierr;
+  Mat             L;
+  PetscInt       *perm, tmp;
+  const PetscReal eps = 1.0e-12;
+  PetscErrorCode  ierr;
 
   PetscFunctionBegin;
   ierr = MatCreateLaplacian(A, eps, PETSC_FALSE, &L);CHKERRQ(ierr);
   /* Compute Fiedler vector (right now, all eigenvectors) */
   {
     Mat          LD;
-    PetscScalar *a, *realpart, *imagpart, *eigvec, *work, sdummy;
+    PetscScalar *a;
+    PetscReal   *realpart, *imagpart, *eigvec, *work;
+#ifndef PETSC_USE_COMPLEX
+    PetscReal    sdummy;
+#endif
     PetscBLASInt bn, bN, lwork, lierr, idummy;
     PetscInt     n, i, evInd;
 
     ierr = PetscBLASIntCast(1,&idummy);CHKERRQ(ierr);
     ierr = PetscMalloc4(n,PetscScalar,&realpart,n,PetscScalar,&imagpart,n*n,PetscScalar,&eigvec,lwork,PetscScalar,&work);CHKERRQ(ierr);
     ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr);
+#ifdef PETSC_USE_COMPLEX
+    SETERRQ(PetscObjectComm((PetscObject) A), PETSC_ERR_SUP, "Spectral partitioning does not support complex numbers");
+#else
     PetscStackCall("LAPACKgeev", LAPACKgeev_("N","V",&bn,a,&bN,realpart,imagpart,&sdummy,&idummy,eigvec,&bN,work,&lwork,&lierr));
+#endif
     if (lierr) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_LIB, "Error in LAPACK routine %d", (int) lierr);
     ierr = PetscFPTrapPop();CHKERRQ(ierr);
     /* Check lowest eigenvalue and eigenvector */

File src/mat/order/wbm.c

   cntl[0]  = 0.0;/*1e-8*/
 
   ierr = PetscMalloc3(liw,PetscInt,&iw,ldw,PetscScalar,&dw,nrow,PetscInt,&perm);CHKERRQ(ierr);
+#ifdef PETSC_USE_COMPLEX
   ierr = HSLmc64AD(&job, &ncol, &nrow, &nnz, ia, ja, a, &num, perm, &liw, iw, &ldw, dw, icntl, cntl, info);CHKERRQ(ierr);
+#else
+  SETERRQ(PetscObjectComm((PetscObject) mat), PETSC_ERR_SUP, "WBM using MC64 does not support complex numbers");
+#endif
   ierr = MatRestoreRowIJ(mat, 1, PETSC_TRUE, PETSC_TRUE, NULL, &ia, &ja, &done);CHKERRQ(ierr);
   for (i = 0; i < nrow; ++i) perm[i]--;
   /* If job == 5, dw[0..ncols] contains the column scaling and dw[ncols..ncols+nrows] contains the row scaling */