1. Lisandro Dalcin
  2. PetIGA

Commits

Lisandro Dalcin  committed d914d98

Remove backward compatibility hackery for ancient petsc-3.2

  • Participants
  • Parent commits b14c7c1
  • Branches default

Comments (0)

Files changed (15)

File include/petiga.h

View file
 */
 
 #include <petsc.h>
-#if PETSC_VERSION_(3,2,0)
-#include <private/petscimpl.h>
-#else
 #include <petsc-private/petscimpl.h>
-#endif
 #include <petscts2.h>
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#define PETSC_EXTERN extern
-#endif
-
 typedef ISLocalToGlobalMapping LGMap;
 #define LGMap LGMap
 
 /* ---------------------------------------------------------------- */
 
 #ifndef PETSC_VERSION_EQ
-#define PETSC_VERSION_EQ(MAJOR,MINOR,SUBMINOR) \
-  (PETSC_VERSION_(MAJOR,MINOR,SUBMINOR))
-#endif
-#ifndef PETSC_VERSION_LT
-#define PETSC_VERSION_LT(MAJOR,MINOR,SUBMINOR) \
-  (PETSC_VERSION_MAJOR < (MAJOR) ||            \
-   (PETSC_VERSION_MAJOR == (MAJOR) &&          \
-    (PETSC_VERSION_MINOR < (MINOR) ||          \
-     (PETSC_VERSION_MINOR == (MINOR) &&        \
-      (PETSC_VERSION_SUBMINOR < (SUBMINOR))))))
-#define PETSC_VERSION_LE(MAJOR,MINOR,SUBMINOR) \
-  (PETSC_VERSION_LT(MAJOR,MINOR,SUBMINOR) ||   \
-   PETSC_VERSION_EQ(MAJOR,MINOR,SUBMINOR))
+#define PETSC_VERSION_EQ PETSC_VERSION_
 #endif
 #ifndef PETSC_VERSION_GT
 #define PETSC_VERSION_GT(MAJOR,MINOR,SUBMINOR) \
   (!PETSC_VERSION_LE(MAJOR,MINOR,SUBMINOR))
+#endif
+#ifndef PETSC_VERSION_GE
 #define PETSC_VERSION_GE(MAJOR,MINOR,SUBMINOR) \
   (!PETSC_VERSION_LT(MAJOR,MINOR,SUBMINOR))
 #endif
 #define PetscValidRealPointer PetscValidDoublePointer
 #endif
 
-#if PETSC_VERSION_LE(3,2,0)
-#define PetscObjectTypeCompare PetscTypeCompare
-#endif
-
 /* ---------------------------------------------------------------- */
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_END
-#endif
-
 #endif/*PETIGA_H*/

File include/petscts2.h

View file
 #define __PETSCTS2_H
 #include <petscts.h>
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#define PETSC_EXTERN extern
-#endif
-
 typedef PetscErrorCode (*TSIFunction2)(TS,PetscReal,Vec,Vec,Vec,Vec,void*);
 typedef PetscErrorCode (*TSIJacobian2)(TS,PetscReal,Vec,Vec,Vec,PetscReal,PetscReal,Mat*,Mat*,MatStructure*,void*);
 PETSC_EXTERN PetscErrorCode TSSetIFunction2(TS,Vec,TSIFunction2,void*);
 PETSC_EXTERN PetscErrorCode TSAlpha2SetParams(TS,PetscReal,PetscReal,PetscReal,PetscReal);
 PETSC_EXTERN PetscErrorCode TSAlpha2GetParams(TS,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_END
-#endif
-
 #endif/*__PETSCTS2_H*/

File src/petigabl.h

View file
                          PetscBLASInt*);
 EXTERN_C_END
 
-#if PETSC_VERSION_(3,3,0) || PETSC_VERSION_(3,2,0)
+#if PETSC_VERSION_LE(3,3,0)
 #undef PetscBLASIntCast
-#undef __FUNCT__
+#undef  __FUNCT__
 #define __FUNCT__ "PetscBLASIntCast"
 PETSC_STATIC_INLINE PetscErrorCode PetscBLASIntCast(PetscInt a,PetscBLASInt *b)
 {

File src/petigagrid.c

View file
 #include "petigagrid.h"
-#if PETSC_VERSION_(3,2,0)
-#include <private/petscimpl.h>
-#else
 #include <petsc-private/petscimpl.h>
-#endif
 
 #undef  __FUNCT__
 #define __FUNCT__ "IGA_Grid_Create"

File src/petigagrid.h

View file
 
 #include <petsc.h>
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#define PETSC_EXTERN extern
-#endif
-
 #ifndef LGMap
 #define LGMap ISLocalToGlobalMapping
 #endif
                                                    const PetscInt[],
                                                    Vec*,VecScatter*,VecScatter*);
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#endif
-
 #endif/*PETIGAGRID_H*/

File src/petigamat.c

View file
 #include "petiga.h"
 #include "petigagrid.h"
-#if PETSC_VERSION_LE(3,2,0)
-#include "private/matimpl.h"
-#endif
 
 #if PETSC_VERSION_LE(3,3,0)
 #undef MatType
     N *= iga->node_sizes[i];
   }
   ierr = MatCreate(comm,&A);CHKERRQ(ierr);
-#if PETSC_VERSION_LE(3,2,0)
-  ierr = MatSetType(A,iga->mattype);CHKERRQ(ierr);
-  ierr = MatSetSizes(A,bs*n,bs*n,bs*N,bs*N);CHKERRQ(ierr);
-#else
   ierr = MatSetSizes(A,bs*n,bs*n,bs*N,bs*N);CHKERRQ(ierr);
   ierr = MatSetBlockSize(A,bs);CHKERRQ(ierr);
   ierr = MatSetType(A,iga->mattype);CHKERRQ(ierr);
-#endif
   ierr = MatSetFromOptions(A);CHKERRQ(ierr);
   ierr = PetscObjectCompose((PetscObject)A,"IGA",(PetscObject)iga);CHKERRQ(ierr);
   *mat = A;
   }
 
   if (is) {ierr = MatSetUp(A);CHKERRQ(ierr);}
-#if PETSC_VERSION_LE(3,2,0)
-#else
   ierr = MatSetLocalToGlobalMapping(A,iga->lgmap,iga->lgmap);CHKERRQ(ierr);
   ierr = MatSetLocalToGlobalMappingBlock(A,iga->lgmapb,iga->lgmapb);CHKERRQ(ierr);
-#endif
   if (is) {
     const MatType mtype = (bs > 1) ? MATBAIJ : MATAIJ;
     ierr = MatISGetLocalMat(A,&A);CHKERRQ(ierr);
     ierr = MatSetUp(A);CHKERRQ(ierr);
   }
 
-#if PETSC_VERSION_LE(3,2,0)
-  /* XXX This is a vile hack. Perhaps we should just check for      */
-  /* SeqDense and MPIDense that are the only I care about right now */
-  if ((*mat)->ops->setblocksize) {
-    ierr = MatSetBlockSize(*mat,bs);CHKERRQ(ierr);
-  } else {
-    ierr = PetscLayoutSetBlockSize((*mat)->rmap,bs);CHKERRQ(ierr);
-    ierr = PetscLayoutSetBlockSize((*mat)->cmap,bs);CHKERRQ(ierr);
-  }
-  if (!is) {
-    ierr = MatSetLocalToGlobalMapping(*mat,iga->lgmap,iga->lgmap);CHKERRQ(ierr);
-    ierr = MatSetLocalToGlobalMappingBlock(*mat,iga->lgmapb,iga->lgmapb);CHKERRQ(ierr);
-  }
-#endif
-
   if (aij || baij || sbaij) {
     PetscInt i,j,k;
     PetscInt nnz = maxnnz,*indices=0,*ubrows=0,*ubcols=0;PetscScalar *values=0;

File src/petigapart.c

View file
 #include "petigapart.h"
-#if PETSC_VERSION_(3,2,0)
-#include <private/petscimpl.h>
-#else
 #include <petsc-private/petscimpl.h>
-#endif
 
 PETSC_STATIC_INLINE
 PetscInt IGA_CUT2D(PetscInt M,PetscInt N,

File src/petigapart.h

View file
 
 #include <petsc.h>
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#define PETSC_EXTERN extern
-#endif
-
 PETSC_EXTERN PetscErrorCode IGA_Partition(PetscInt,PetscInt,
                                           PetscInt,const PetscInt[],
                                           PetscInt[],PetscInt[]);
                                            const PetscInt[],const PetscInt[],
                                            const PetscInt[],PetscInt[],PetscInt[]);
 
-#if PETSC_VERSION_(3,2,0)
-PETSC_EXTERN_CXX_BEGIN
-#endif
-
 #endif/*PETIGAPART_H*/

File src/petigapc.c

View file
 }
 #endif
 
-#if PETSC_VERSION_LE(3,2,0)
-#undef PetscBTCreate
-#undef  __FUNCT__
-#define __FUNCT__ "PetscBTCreate"
-PETSC_STATIC_INLINE PetscErrorCode PetscBTCreate(PetscInt m,PetscBT *array)
-{
-  return PetscMalloc((m/PETSC_BITS_PER_BYTE+1)*sizeof(char),array) || PetscBTMemzero(m,*array);
-}
-#undef PetscBTDestroy
-#undef  __FUNCT__
-#define __FUNCT__ "PetscBTDestroy"
-PETSC_STATIC_INLINE PetscErrorCode PetscBTDestroy(PetscBT *array)
-{
-  return PetscFree(*array);
-}
-#endif
-
 PETSC_STATIC_INLINE
 #undef  __FUNCT__
 #define __FUNCT__ "ComputeBDDCBoundary"

File src/petigapcb.c

View file
 #include "petiga.h"
 #include "petigagrid.h"
-#if PETSC_VERSION_(3,2,0)
-#include <private/pcimpl.h>
-#else
 #include <petsc-private/pcimpl.h>
-#endif
 #include "petigabl.h"
 
 #if PETSC_VERSION_LE(3,3,0)
   ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr);
 
   ierr = MatCreate(comm,&mat);CHKERRQ(ierr);
-  #if PETSC_VERSION_(3,2,0)
-  ierr = MatSetType(mat,mtype);CHKERRQ(ierr);
-  ierr = MatSetSizes(mat,m,n,M,N);CHKERRQ(ierr);
-  #else
   ierr = MatSetSizes(mat,m,n,M,N);CHKERRQ(ierr);
   ierr = MatSetBlockSize(mat,bs);CHKERRQ(ierr);
   ierr = MatSetType(mat,mtype);CHKERRQ(ierr);
-  #endif
   ierr = InferMatrixType(mat,&aij,&baij,&sbaij);CHKERRQ(ierr);
 
  if (aij || baij || sbaij) {

File src/petigapce.c

View file
 #include "petiga.h"
-#if PETSC_VERSION_LE(3,2,0)
-#include <private/pcimpl.h>
-#else
 #include <petsc-private/pcimpl.h>
-#endif
 #include "petigabl.h"
 
 #if PETSC_VERSION_LE(3,3,0)
           ierr = MatCreate(comm,&mat);CHKERRQ(ierr);
           ierr = MatSetType(mat,mtype);CHKERRQ(ierr);
           ierr = MatSetSizes(mat,m,n,M,N);CHKERRQ(ierr);
-          #if PETSC_VERSION_GT(3,2,0)
           ierr = MatSetBlockSize(mat,bs);CHKERRQ(ierr);
-          #endif
 
           ierr = PetscMalloc1(ia[na],PetscInt,&newja);CHKERRQ(ierr);
           for (j=0; j<ia[na]; j++) newja[j] = ja[j] + cstart;
           if (baij)  {ierr = MatMPIBAIJSetPreallocationCSR (mat,bs,ia,newja,NULL);CHKERRQ(ierr);}
           if (sbaij) {ierr = MatMPISBAIJSetPreallocationCSR(mat,bs,ia,newja,NULL);CHKERRQ(ierr);}
           ierr = PetscFree(newja);CHKERRQ(ierr);
-          #if PETSC_VERSION_(3,2,0)
-          ierr = MatSetBlockSize(mat,bs);CHKERRQ(ierr);
-          #endif
         }
         ierr = MatRestoreRowIJ(Ad,0,PETSC_FALSE,compressed,&na,&ia,&ja,&done);CHKERRQ(ierr);
       }
     }
   }
-  if (!mat) {
-    #if PETSC_VERSION_(3,2,0)
-    ierr = MatDuplicate(A,MAT_DO_NOT_COPY_VALUES,&mat);CHKERRQ(ierr);
-    #else
-    ierr = MatDuplicate(A,MAT_SHARE_NONZERO_PATTERN,&mat);CHKERRQ(ierr);
-    #endif
-  }
+  if (!mat) {ierr = MatDuplicate(A,MAT_SHARE_NONZERO_PATTERN,&mat);CHKERRQ(ierr);}
   ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr);
   *B = mat;
   PetscFunctionReturn(0);

File src/petigareg.c

View file
 EXTERN_C_BEGIN
 #undef  __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_petiga"
-#if PETSC_VERSION_LE(3,3,3)
+#if PETSC_VERSION_LE(3,3,0)
 PetscErrorCode PetscDLLibraryRegister_petiga(const char path[])
 #else
 PetscErrorCode PetscDLLibraryRegister_petiga(void)

File src/petigavec.c

View file
 #include "petiga.h"
-#if PETSC_VERSION_(3,2,0)
-#include <private/vecimpl.h>
-#else
 #include <petsc-private/vecimpl.h>
+
+#if PETSC_VERSION_LE(3,3,0)
+EXTERN_C_BEGIN
+#endif
+PETSC_EXTERN PetscErrorCode VecView_MPI_DA(Vec,PetscViewer);
+PETSC_EXTERN PetscErrorCode VecLoad_Default_DA(Vec,PetscViewer);
+#if PETSC_VERSION_LE(3,3,0)
+EXTERN_C_END
 #endif
 
 #if PETSC_VERSION_LE(3,3,0)
-EXTERN_C_BEGIN
-extern       PetscErrorCode VecView_MPI_DA(Vec,PetscViewer);
-extern       PetscErrorCode VecLoad_Default_DA(Vec,PetscViewer);
-EXTERN_C_END
 #undef  __FUNCT__
 #define __FUNCT__ "VecSetDM"
 static PetscErrorCode VecSetDM(Vec v,DM dm)
   PetscFunctionReturn(0);
 }
 #else
-PETSC_EXTERN PetscErrorCode VecView_MPI_DA(Vec,PetscViewer);
-PETSC_EXTERN PetscErrorCode VecLoad_Default_DA(Vec,PetscViewer);
-#endif
 
 #undef  __FUNCT__
 #define __FUNCT__ "VecDuplicate_IGA"

File src/snesfdcolor.c

View file
 #include <petscsnes.h>
-#if PETSC_VERSION_(3,2,0)
-#include <private/petscimpl.h>
-#else
 #include <petsc-private/petscimpl.h>
-#endif
 
-#if PETSC_VERSION_(3,2,0)
-#define PETSC_EXTERN extern
-#endif
-
-#if PETSC_VERSION_(3,3,0) || PETSC_VERSION_(3,2,0)
+#if PETSC_VERSION_LE(3,3,0)
 #define SNESComputeJacobianDefaultColor SNESDefaultComputeJacobianColor
 #endif
 

File src/tsalpha2.c

View file
 #include <petscts2.h>
-#if PETSC_VERSION_(3,2,0)
-#include <private/tsimpl.h>                      /*I   "petscts.h"   I*/
-#else
 #include <petsc-private/tsimpl.h>                /*I   "petscts.h"   I*/
-#endif
 
-#if PETSC_VERSION_(3,3,0) || PETSC_VERSION_(3,2,0)
+#if PETSC_VERSION_LE(3,3,0)
 #define PetscObjectComposeFunction(o,n,f) \
         PetscObjectComposeFunction(o,n,"",(PetscVoidFunction)(f))
 #endif
 
-#if PETSC_VERSION_(3,2,0)
-#define PetscObjectTypeCompare PetscTypeCompare
-#define TSPreStage(ts,t) (0)
-#define ksp_its  linear_its
-#define snes_its nonlinear_its
-#endif
-
 typedef struct {
 
   PetscReal stage_time;
   PetscErrorCode ierr;
   PetscFunctionBegin;
   ierr = TSSetSolution2(ts,X,V);CHKERRQ(ierr);
-#if PETSC_VERSION_(3,3,0) || PETSC_VERSION_(3,2,0)
+#if PETSC_VERSION_LE(3,3,0)
   ierr = TSSolve(ts,X,NULL);CHKERRQ(ierr);
 #else
   ierr = TSSolve(ts,X);CHKERRQ(ierr);
   ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2SetParams_C",TSAlpha2SetParams_Alpha2);CHKERRQ(ierr);
   ierr = PetscObjectComposeFunction((PetscObject)ts,"TSAlpha2GetParams_C",TSAlpha2GetParams_Alpha2);CHKERRQ(ierr);
 
-#if PETSC_VERSION_(3,3,0) || PETSC_VERSION_(3,2,0)
+#if PETSC_VERSION_LE(3,3,0)
   if (ts->exact_final_time == PETSC_DECIDE) ts->exact_final_time = PETSC_FALSE;
 #endif