Stefano Zampini avatar Stefano Zampini committed 7cbb387

PCBDDC: allow compilation without metis header

Coarse problem type default to PARALLEL_BDDC
Some irrelevant warning will show up without metis headers (will be solved soon)

Comments (0)

Files changed (2)

src/ksp/pc/impls/bddc/bddc.c

 
 /* -------------------------------------------------------------------------- */
 
+/* BDDC requires metis 5.0.1 for multilevel */
+#if defined(PETSC_HAVE_METIS)
+#include "metis.h"
+#define MetisInt    idx_t
+#define MetisScalar real_t
+#endif
+
 #undef __FUNCT__  
 #define __FUNCT__ "PCBDDCSetUpCoarseEnvironment"
 static PetscErrorCode PCBDDCSetUpCoarseEnvironment(PC pc,PetscScalar* coarse_submat_vals)
   ierr = MPI_Allreduce(&im_active,&active_procs,1,MPIU_INT,MPI_SUM,prec_comm);CHKERRQ(ierr);
 
   /* adapt coarse problem type */
+#if defined(PETSC_HAVE_METIS)
   if (pcbddc->coarse_problem_type == MULTILEVEL_BDDC) {
     if (pcbddc->current_level < pcbddc->max_levels) {
       if ( (active_procs/pcbddc->coarsening_ratio) < 2 ) {
       }
       pcbddc->coarse_problem_type = PARALLEL_BDDC;
     }
-  }  
+  }
+#else
+  pcbddc->coarse_problem_type = PARALLEL_BDDC;
+#endif
 
   switch(pcbddc->coarse_problem_type){
 
     case(MULTILEVEL_BDDC):   /* we define a coarse mesh where subdomains are elements */
     {
+#if defined(PETSC_HAVE_METIS)
       /* we need additional variables */
       MetisInt    n_subdomains,n_parts,objval,ncon,faces_nvtxs;
       MetisInt    *metis_coarse_subdivision;
         ierr = PetscFree(total_ranks_recv);CHKERRQ(ierr);
         ierr = PetscFree(displacements_recv);CHKERRQ(ierr);
       }
+#endif
       break;
     }
 

src/ksp/pc/impls/bddc/bddc.h

 #include <../src/ksp/pc/impls/is/pcis.h>
 #include "bddcstructs.h"
 
-/* BDDC requires metis 5.0.1 for multilevel */
-#include "metis.h"
-#define MetisInt    idx_t
-#define MetisScalar real_t
-
 typedef enum {SCATTERS_BDDC,GATHERS_BDDC} CoarseCommunicationsType;
 
 /* Private context (data structure) for the BDDC preconditioner.  */
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.