Commits

Stefano Zampini  committed 2976c77

PCBDDC: Remove trailing blanks

  • Participants
  • Parent commits 575ad6a

Comments (0)

Files changed (6)

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

    man pages
 */
 
-/* ---------------------------------------------------------------------------------------------------------------------------------------------- 
+/* ----------------------------------------------------------------------------------------------------------------------------------------------
    Implementation of BDDC preconditioner based on:
    C. Dohrmann "An approximate BDDC preconditioner", Numerical Linear Algebra with Applications Volume 14, Issue 2, pages 149-168, March 2007
    ---------------------------------------------------------------------------------------------------------------------------------------------- */
 static PetscErrorCode PCBDDCSetUpCoarseEnvironment(PC,PetscScalar*);
 
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCSetFromOptions_BDDC"
 PetscErrorCode PCSetFromOptions_BDDC(PC pc)
 {
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetPrimalVerticesLocalIS_BDDC"
 static PetscErrorCode PCBDDCSetPrimalVerticesLocalIS_BDDC(PC pc, IS PrimalVertices)
 {
   PetscFunctionBegin;
   ierr = ISDestroy(&pcbddc->user_primal_vertices);CHKERRQ(ierr);
   ierr = PetscObjectReference((PetscObject)PrimalVertices);CHKERRQ(ierr);
-  pcbddc->user_primal_vertices = PrimalVertices; 
+  pcbddc->user_primal_vertices = PrimalVertices;
   PetscFunctionReturn(0);
 }
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetPrimalVerticesLocalIS"
 /*@
  PCBDDCSetPrimalVerticesLocalIS - Set user defined primal vertices in PCBDDC.
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetCoarseProblemType_BDDC"
 static PetscErrorCode PCBDDCSetCoarseProblemType_BDDC(PC pc, CoarseProblemType CPT)
 {
   PC_BDDC  *pcbddc = (PC_BDDC*)pc->data;
 
   PetscFunctionBegin;
-  pcbddc->coarse_problem_type = CPT; 
+  pcbddc->coarse_problem_type = CPT;
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetCoarseProblemType"
 /*@
  PCBDDCSetCoarseProblemType - Set coarse problem type in PCBDDC.
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetCoarseningRatio_BDDC"
 static PetscErrorCode PCBDDCSetCoarseningRatio_BDDC(PC pc,PetscInt k)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetCoarseningRatio"
 /*@
  PCBDDCSetCoarseningRatio - Set coarsening ratio used in multilevel coarsening
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetMaxLevels_BDDC"
 static PetscErrorCode PCBDDCSetMaxLevels_BDDC(PC pc,PetscInt max_levels)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetMaxLevels"
 /*@
  PCBDDCSetMaxLevels - Sets the maximum number of levels within the multilevel approach.
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetNullSpace_BDDC"
 static PetscErrorCode PCBDDCSetNullSpace_BDDC(PC pc,MatNullSpace NullSpace)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetNullSpace"
 /*@
  PCBDDCSetNullSpace - Set NullSpace of global operator of BDDC preconditioned mat.
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetDirichletBoundaries_BDDC"
 static PetscErrorCode PCBDDCSetDirichletBoundaries_BDDC(PC pc,IS DirichletBoundaries)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetDirichletBoundaries"
 /*@
  PCBDDCSetDirichletBoundaries - Set index set defining subdomain part (in local ordering)
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetNeumannBoundaries_BDDC"
 static PetscErrorCode PCBDDCSetNeumannBoundaries_BDDC(PC pc,IS NeumannBoundaries)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetNeumannBoundaries"
 /*@
  PCBDDCSetNeumannBoundaries - Set index set defining subdomain part (in local ordering)
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGetDirichletBoundaries_BDDC"
 static PetscErrorCode PCBDDCGetDirichletBoundaries_BDDC(PC pc,IS *DirichletBoundaries)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGetDirichletBoundaries"
 /*@
  PCBDDCGetDirichletBoundaries - Get index set defining subdomain part (in local ordering)
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGetNeumannBoundaries_BDDC"
 static PetscErrorCode PCBDDCGetNeumannBoundaries_BDDC(PC pc,IS *NeumannBoundaries)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGetNeumannBoundaries"
 /*@
  PCBDDCGetNeumannBoundaries - Get index set defining subdomain part (in local ordering)
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetLocalAdjacencyGraph_BDDC"
 static PetscErrorCode PCBDDCSetLocalAdjacencyGraph_BDDC(PC pc, PetscInt nvtxs,const PetscInt xadj[],const PetscInt adjncy[], PetscCopyMode copymode)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetLocalAdjacencyGraph"
 /*@
  PCBDDCSetLocalAdjacencyGraph - Set CSR graph of local matrix for use of PCBDDC.
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetDofsSplitting_BDDC"
 static PetscErrorCode PCBDDCSetDofsSplitting_BDDC(PC pc,PetscInt n_is, IS ISForDofs[])
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetDofsSplitting"
 /*@
  PCBDDCSetDofsSplitting - Set index sets defining fields of local mat.
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCPreSolve_BDDC"
 /* -------------------------------------------------------------------------- */
 /*
   /* store the original rhs */
   ierr = VecCopy(rhs,pcbddc->original_rhs);CHKERRQ(ierr);
 
-  /* Take into account zeroed rows -> change rhs and store solution removed */    
+  /* Take into account zeroed rows -> change rhs and store solution removed */
   ierr = MatGetDiagonal(pc->pmat,pcis->vec1_global);CHKERRQ(ierr);
   ierr = VecPointwiseDivide(pcis->vec1_global,rhs,pcis->vec1_global);CHKERRQ(ierr);
   ierr = VecScatterBegin(matis->ctx,pcis->vec1_global,pcis->vec2_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCPostSolve_BDDC"
 /* -------------------------------------------------------------------------- */
 /*
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCSetUp_BDDC"
 /* -------------------------------------------------------------------------- */
 /*
    PCSetUp_BDDC - Prepares for the use of the BDDC preconditioner
-                  by setting data structures and options.   
+                  by setting data structures and options.
 
    Input Parameter:
 +  pc - the preconditioner context
 
    Application Interface Routine: PCApply()
  */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCApply_BDDC"
 PetscErrorCode PCApply_BDDC(PC pc,Vec r,Vec z)
 {
   if (pcbddc->inexact_prec_type) { ierr = MatMultAdd(pcis->A_II,pcis->vec1_D,pcis->vec3_D,pcis->vec3_D);CHKERRQ(ierr); }
   ierr = KSPSolve(pcbddc->ksp_D,pcis->vec3_D,pcbddc->vec4_D);CHKERRQ(ierr);
   ierr = VecScale(pcbddc->vec4_D,m_one);CHKERRQ(ierr);
-  if (pcbddc->inexact_prec_type) { ierr = VecAXPY (pcbddc->vec4_D,one,pcis->vec1_D);CHKERRQ(ierr); } 
-  ierr = VecAXPY (pcis->vec2_D,one,pcbddc->vec4_D);CHKERRQ(ierr); 
+  if (pcbddc->inexact_prec_type) { ierr = VecAXPY (pcbddc->vec4_D,one,pcis->vec1_D);CHKERRQ(ierr); }
+  ierr = VecAXPY (pcis->vec2_D,one,pcbddc->vec4_D);CHKERRQ(ierr);
   ierr = VecScatterBegin(pcis->global_to_D,pcis->vec2_D,z,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
   ierr = VecScatterEnd  (pcis->global_to_D,pcis->vec2_D,z,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCDestroy_BDDC"
 PetscErrorCode PCDestroy_BDDC(PC pc)
 {
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCMatFETIDPGetRHS_BDDC"
 static PetscErrorCode PCBDDCMatFETIDPGetRHS_BDDC(Mat fetidp_mat, Vec standard_rhs, Vec fetidp_flux_rhs)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCMatFETIDPGetRHS"
 /*@
  PCBDDCMatFETIDPGetRHS - Get rhs for FETIDP linear system.
 
    Input Parameters:
 +  fetidp_mat   - the FETIDP mat obtained by a call to PCBDDCCreateFETIDPOperators
-+  standard_rhs - the rhs of your linear system 
-  
++  standard_rhs - the rhs of your linear system
+
    Output Parameters:
 +  fetidp_flux_rhs   - the rhs of the FETIDP linear system
 
 }
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCMatFETIDPGetSolution_BDDC"
 static PetscErrorCode PCBDDCMatFETIDPGetSolution_BDDC(Mat fetidp_mat, Vec fetidp_flux_sol, Vec standard_sol)
 {
 
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCMatFETIDPGetSolution"
 /*@
  PCBDDCMatFETIDPGetSolution - Get Solution for FETIDP linear system.
    Input Parameters:
 +  fetidp_mat        - the FETIDP mat obtained by a call to PCBDDCCreateFETIDPOperators
 +  fetidp_flux_sol - the solution of the FETIDP linear system
-  
+
    Output Parameters:
 +  standard_sol      - the solution on the global domain
 
 extern PetscErrorCode FETIDPPCApply(PC,Vec,Vec);
 extern PetscErrorCode PCBDDCDestroyFETIDPPC(PC);
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCCreateFETIDPOperators_BDDC"
 static PetscErrorCode PCBDDCCreateFETIDPOperators_BDDC(PC pc, Mat *fetidp_mat, PC *fetidp_pc)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCCreateFETIDPOperators"
 /*@
  PCBDDCCreateFETIDPOperators - Create operators for FETIDP.
 
    Level: intermediate
 
-   Notes: The matrix used with this preconditioner must be of type MATIS 
+   Notes: The matrix used with this preconditioner must be of type MATIS
 
           Unlike more 'conventional' interface preconditioners, this iterates over ALL the
           degrees of freedom, NOT just those on the interface (this allows the use of approximate solvers
 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC,  MATIS
 M*/
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCCreate_BDDC"
 PETSC_EXTERN PetscErrorCode PCCreate_BDDC(PC pc)
 {
   pcbddc->coarse_ksp                 = 0;
   pcbddc->coarse_phi_B               = 0;
   pcbddc->coarse_phi_D               = 0;
-  pcbddc->vec1_P                     = 0;          
-  pcbddc->vec1_R                     = 0; 
-  pcbddc->vec2_R                     = 0; 
+  pcbddc->vec1_P                     = 0;
+  pcbddc->vec1_R                     = 0;
+  pcbddc->vec2_R                     = 0;
   pcbddc->local_auxmat1              = 0;
   pcbddc->local_auxmat2              = 0;
   pcbddc->R_to_B                     = 0;
   pcbddc->replicated_local_primal_values  = 0;
 
   /* create local graph structure */
-  ierr = PCBDDCGraphCreate(&pcbddc->mat_graph);CHKERRQ(ierr);  
+  ierr = PCBDDCGraphCreate(&pcbddc->mat_graph);CHKERRQ(ierr);
 
   /* scaling */
   pcbddc->use_deluxe_scaling         = PETSC_FALSE;
 /* All static functions from now on                                           */
 /* -------------------------------------------------------------------------- */
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetUseExactDirichlet"
 static PetscErrorCode PCBDDCSetUseExactDirichlet(PC pc,PetscBool use)
 {
 }
 
 /* -------------------------------------------------------------------------- */
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCCoarseSetUp"
 static PetscErrorCode PCBDDCCoarseSetUp(PC pc)
-{   
+{
   PetscErrorCode  ierr;
 
   PC_IS*            pcis = (PC_IS*)(pc->data);
       if (matstruct == SAME_NONZERO_PATTERN) {
         ierr = MatGetSubMatrix(matis->A,pcis->is_I_local,pcis->is_I_local,MAT_REUSE_MATRIX,&pcis->A_II);CHKERRQ(ierr);
       } else {
-        ierr = MatDestroy(&pcis->A_II);CHKERRQ(ierr); 
+        ierr = MatDestroy(&pcis->A_II);CHKERRQ(ierr);
         ierr = MatGetSubMatrix(matis->A,pcis->is_I_local,pcis->is_I_local,MAT_INITIAL_MATRIX,&pcis->A_II);CHKERRQ(ierr);
       }
     }
         ierr = PetscViewerASCIIPrintf(viewer,"--------------------------------------------------\n");CHKERRQ(ierr);
         ierr = PetscViewerASCIIPrintf(viewer,"Checking solution of Dirichlet and Neumann problems\n");CHKERRQ(ierr);
         ierr = PetscViewerASCIISynchronizedPrintf(viewer,"Subdomain %04d infinity error for Dirichlet solve = % 1.14e \n",PetscGlobalRank,value);CHKERRQ(ierr);
-        ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);        
+        ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
       }
       if (n_D && pcbddc->NullSpace && !use_exact_reduced && !pcbddc->inexact_prec_type) {
         ierr = PCBDDCNullSpaceAssembleCorrection(pc,pcis->is_I_local);
-      } 
+      }
       ierr = VecDuplicate(pcbddc->vec1_R,&temp_vec);CHKERRQ(ierr);
       ierr = VecSetRandom(pcbddc->vec1_R,NULL);CHKERRQ(ierr);
       ierr = MatMult(A_RR,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr);
       ierr = MPI_Allreduce(&use_exact,&use_exact_reduced,1,MPIU_INT,MPI_LAND,PetscObjectComm((PetscObject)pc));CHKERRQ(ierr);
       if (dbg_flag) {
         ierr = PetscViewerASCIISynchronizedPrintf(viewer,"Subdomain %04d infinity error for  Neumann  solve = % 1.14e \n",PetscGlobalRank,value);CHKERRQ(ierr);
-        ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);        
+        ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
       }
       if (n_R && pcbddc->NullSpace && !use_exact_reduced) { /* is it the right logic? */
         ierr = PCBDDCNullSpaceAssembleCorrection(pc,is_R_local);
-      } 
+      }
     }
     /* free Neumann problem's matrix */
     ierr = MatDestroy(&A_RR);CHKERRQ(ierr);
         ierr = VecGetArray(pcis->vec1_D,&array);CHKERRQ(ierr);
         ierr = MatSetValues(pcbddc->coarse_phi_D,n_D,auxindices,1,&i,array,INSERT_VALUES);CHKERRQ(ierr);
         ierr = VecRestoreArray(pcis->vec1_D,&array);CHKERRQ(ierr);
-      } 
+      }
       /* subdomain contribution to coarse matrix */
       ierr = VecGetArray(vec2_V,&array);CHKERRQ(ierr);
       for (j=0; j<n_vertices; j++) coarse_submat_vals[i*pcbddc->local_primal_size+j] = array[j];   /* WARNING -> column major ordering */
         for (j=0; j<n_constraints; j++) coarse_submat_vals[i*pcbddc->local_primal_size+j+n_vertices] = array[j];   /* WARNING -> column major ordering */
         ierr = VecRestoreArray(vec1_C,&array);CHKERRQ(ierr);
       }
- 
+
       if ( dbg_flag ) {
         /* assemble subdomain vector on nodes */
         ierr = VecSet(pcis->vec1_N,zero);CHKERRQ(ierr);
           ierr = VecGetArray(vec1_C,&array);CHKERRQ(ierr);
           for (j=0;j<n_constraints;j++) array2[j+n_vertices]=array[j];
           ierr = VecRestoreArray(vec1_C,&array);CHKERRQ(ierr);
-        } 
+        }
         ierr = VecRestoreArray(pcbddc->vec1_P,&array2);CHKERRQ(ierr);
         ierr = VecScale(pcbddc->vec1_P,m_one);CHKERRQ(ierr);
         /* check saddle point solution */
       }
     }
     ierr = PetscFree(idx_V_B);CHKERRQ(ierr);
- 
+
     for (i=0;i<n_constraints;i++){
       ierr = VecSet(vec2_C,zero);CHKERRQ(ierr);
       ierr = VecSetValue(vec2_C,i,m_one,INSERT_VALUES);CHKERRQ(ierr);
       ierr = VecGetArray(vec1_C,&array);CHKERRQ(ierr);
       for (j=0; j<n_constraints; j++) coarse_submat_vals[index*pcbddc->local_primal_size+j+n_vertices]=array[j]; /* WARNING -> column major ordering */
       ierr = VecRestoreArray(vec1_C,&array);CHKERRQ(ierr);
- 
+
       if ( dbg_flag ) {
         /* assemble subdomain vector on nodes */
         ierr = VecSet(pcis->vec1_N,zero);CHKERRQ(ierr);
       ierr = PetscFree(coarsefunctions_errors);CHKERRQ(ierr);
       ierr = PetscFree(constraints_errors);CHKERRQ(ierr);
     }
-    /* free memory */ 
+    /* free memory */
     if (n_vertices) {
       ierr = ISDestroy(&is_V_local);CHKERRQ(ierr);
       ierr = VecDestroy(&vec1_V);CHKERRQ(ierr);
     ierr = PCBDDCSetUpCoarseEnvironment(pc,coarse_submat_vals);CHKERRQ(ierr);
     ierr = PetscFree(coarse_submat_vals);CHKERRQ(ierr);
   }
-  /* free memory */ 
+  /* free memory */
   ierr = ISDestroy(&is_R_local);CHKERRQ(ierr);
 
   PetscFunctionReturn(0);
 #define MetisScalar real_t
 #endif
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetUpCoarseEnvironment"
 static PetscErrorCode PCBDDCSetUpCoarseEnvironment(PC pc,PetscScalar* coarse_submat_vals)
 {
 
 
-  Mat_IS    *matis    = (Mat_IS*)pc->pmat->data; 
+  Mat_IS    *matis    = (Mat_IS*)pc->pmat->data;
   PC_BDDC   *pcbddc   = (PC_BDDC*)pc->data;
   PC_IS     *pcis     = (PC_IS*)pc->data;
   MPI_Comm  prec_comm;
   ierr = MPI_Comm_size(prec_comm,&size_prec_comm);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(prec_comm,&rank_prec_comm);CHKERRQ(ierr);
   ierr = MatIsSymmetricKnown(pc->pmat,&setsym,&issym);CHKERRQ(ierr);
- 
+
   /* Assign global numbering to coarse dofs */
   {
     PetscInt     *auxlocal_primal,*aux_idx;
     j = 0;
     if (rank_prec_comm == 0 || pcbddc->coarse_problem_type == REPLICATED_BDDC || pcbddc->coarse_problem_type == MULTILEVEL_BDDC) {
       j = size_prec_comm;
-    } 
+    }
     ierr = PetscMalloc(j*sizeof(PetscMPIInt),&pcbddc->local_primal_sizes);CHKERRQ(ierr);
     ierr = PetscMalloc(j*sizeof(PetscMPIInt),&pcbddc->local_primal_displacements);CHKERRQ(ierr);
     /* Gather local_primal_size information for all processes  */
 
     /* First let's count coarse dofs.
        This code fragment assumes that the number of local constraints per connected component
-       is not greater than the number of nodes defined for the connected component 
+       is not greater than the number of nodes defined for the connected component
        (otherwise we will surely have linear dependence between constraints and thus a singular coarse problem) */
     ierr = PetscMalloc(pcbddc->local_primal_size*sizeof(PetscInt),&auxlocal_primal);CHKERRQ(ierr);
     ierr = PCBDDCGetPrimalVerticesLocalIdx(pc,&i,&aux_idx);CHKERRQ(ierr);
       ierr = VecScatterBegin(matis->ctx,pcis->vec1_global,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
       ierr = VecScatterEnd  (matis->ctx,pcis->vec1_global,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
       ierr = VecGetArray(pcis->vec1_N,&array);CHKERRQ(ierr);
-      for (i=0;i<pcis->n;i++) { 
+      for (i=0;i<pcis->n;i++) {
         if (array[i] == 1.0) {
           ierr = ISLocalToGlobalMappingApply(matis->mapping,1,&i,&j);CHKERRQ(ierr);
           ierr = PetscViewerASCIISynchronizedPrintf(viewer,"Subdomain %04d: WRONG COARSE INDEX %d (local %d)\n",PetscGlobalRank,j,i);CHKERRQ(ierr);
         ii[1]=k;
         ierr = PetscMalloc(k*sizeof(PetscInt),&jj);
         for (i=0; i<k; i++) jj[i]=new_ranks[pcis->neigh[i+1]];
-        ierr = PetscSortInt(k,jj);CHKERRQ(ierr); 
+        ierr = PetscSortInt(k,jj);CHKERRQ(ierr);
         ierr = MatCreateMPIAdj(test_coarse_comm,1,n_subdomains,ii,jj,NULL,&mat_adj);CHKERRQ(ierr);
         ierr = MatView(mat_adj,viewer_test);CHKERRQ(ierr);
         ierr = MatPartitioningCreate(test_coarse_comm,&mat_part);CHKERRQ(ierr);
         if (pcbddc->coarsening_ratio > 1) {
           if (n_subdomains>n_parts*heuristic_for_metis) {
             options[METIS_OPTION_IPTYPE]=METIS_IPTYPE_EDGE;
-            options[METIS_OPTION_OBJTYPE]=METIS_OBJTYPE_CUT; 
+            options[METIS_OPTION_OBJTYPE]=METIS_OBJTYPE_CUT;
             ierr = METIS_PartGraphKway(&faces_nvtxs,&ncon,faces_xadj,faces_adjncy,NULL,NULL,NULL,&n_parts,NULL,NULL,options,&objval,metis_coarse_subdivision);
             if (ierr != METIS_OK) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in METIS_PartGraphKway (metis error code %D) called from PCBDDCSetUpCoarseEnvironment\n",ierr);
           } else {
         }*/
 
         /* identify new decomposition in terms of ranks in the old communicator */
-        for (i=0;i<n_subdomains;i++) { 
+        for (i=0;i<n_subdomains;i++) {
           coarse_subdivision[ranks_stretching_ratio*i]=coarse_subdivision[ranks_stretching_ratio*i]*procs_jumps_coarse_comm;
         }
         /*printf("coarse_subdivision in old end new ranks\n");
         for (i=0;i<size_prec_comm;i++)
-          if (coarse_subdivision[i]!=MPI_PROC_NULL) { 
+          if (coarse_subdivision[i]!=MPI_PROC_NULL) {
             printf("%d=(%d %d), ",i,coarse_subdivision[i],coarse_subdivision[i]/procs_jumps_coarse_comm);
           } else {
             printf("%d=(%d %d), ",i,coarse_subdivision[i],coarse_subdivision[i]);
               ierr = MPI_Isend(send_buffer,send_size,MPIU_INT,rank_coarse_proc_send_to,999,prec_comm,&requests[count_recv]);CHKERRQ(ierr);
             }
             ierr = MPI_Waitall(count_recv+1,requests,MPI_STATUSES_IGNORE);CHKERRQ(ierr);
-            if (rank_coarse_proc_send_to != MPI_PROC_NULL ) { 
+            if (rank_coarse_proc_send_to != MPI_PROC_NULL ) {
               ierr = PetscFree(send_buffer);CHKERRQ(ierr);
             }
             j = 0;
               }
             }
             /* processes partecipating in coarse problem receive matrix data from their friends */
-            for (i=0;i<count_recv;i++) { 
+            for (i=0;i<count_recv;i++) {
               ierr = MPI_Irecv(&temp_coarse_mat_vals[localdispl2[i]],localsizes2[i],MPIU_SCALAR,ranks_recv[i],666,prec_comm,&requests[i]);CHKERRQ(ierr);
             }
             if (rank_coarse_proc_send_to != MPI_PROC_NULL ) {
                 aux_ins_indices[i]=j;
                 j++;
               }
-            }         
+            }
             for (i=0;i<count_recv;i++) {
               j = pcbddc->local_primal_sizes[ranks_recv[i]];
               for (k=0;k<j;k++) {
           active_rank = rank_prec_comm;
           ierr = ISCreateGeneral(coarse_comm,ins_local_primal_size,ins_local_primal_indices,PETSC_COPY_VALUES,&coarse_IS);CHKERRQ(ierr);
           ierr = ISLocalToGlobalMappingCreateIS(coarse_IS,&coarse_ISLG);CHKERRQ(ierr);
-          ierr = ISDestroy(&coarse_IS);CHKERRQ(ierr); 
+          ierr = ISDestroy(&coarse_IS);CHKERRQ(ierr);
         } else if (pcbddc->coarse_problem_type==PARALLEL_BDDC) {
           /* arrays for values insertion */
           ins_local_primal_size = pcbddc->local_primal_size;
           }
         }
         break;
-        
+
     }
 
     case(GATHERS_BDDC):
       ierr = MatSetFromOptions(pcbddc->coarse_mat);CHKERRQ(ierr);
       ierr = MatSetUp(matis_coarse_local_mat);CHKERRQ(ierr);
       ierr = MatSetOption(matis_coarse_local_mat,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr); /* local values stored in column major */
-      ierr = MatSetOption(matis_coarse_local_mat,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE);CHKERRQ(ierr); 
+      ierr = MatSetOption(matis_coarse_local_mat,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE);CHKERRQ(ierr);
     }
     /* preallocation */
     if (pcbddc->coarse_problem_type != MULTILEVEL_BDDC) {
     /* Allow user's customization */
     ierr = KSPSetOptionsPrefix(pcbddc->coarse_ksp,"coarse_");CHKERRQ(ierr);
     /* Set Up PC for coarse problem BDDC */
-    if (pcbddc->coarse_problem_type == MULTILEVEL_BDDC) { 
+    if (pcbddc->coarse_problem_type == MULTILEVEL_BDDC) {
       i = pcbddc->current_level+1;
       ierr = PCBDDCSetLevel(pc_temp,i);CHKERRQ(ierr);
       ierr = PCBDDCSetCoarseningRatio(pc_temp,pcbddc->coarsening_ratio);CHKERRQ(ierr);
       if (CoarseNullSpace) {
         ierr = PCBDDCSetNullSpace(pc_temp,CoarseNullSpace);CHKERRQ(ierr);
       }
-      if (dbg_flag) { 
+      if (dbg_flag) {
         ierr = PetscViewerASCIIPrintf(viewer,"----------------Level %d: Setting up level %d---------------\n",pcbddc->current_level,i);CHKERRQ(ierr);
         ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
       }

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

 #include "bddc.h"
 #include "bddcprivate.h"
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCCreateFETIDPMatContext"
 PetscErrorCode PCBDDCCreateFETIDPMatContext(PC pc, FETIDPMat_ctx *fetidpmat_ctx)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCCreateFETIDPPCContext"
 PetscErrorCode PCBDDCCreateFETIDPPCContext(PC pc, FETIDPPC_ctx *fetidppc_ctx)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCDestroyFETIDPMat"
 PetscErrorCode PCBDDCDestroyFETIDPMat(Mat A)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCDestroyFETIDPPC"
 PetscErrorCode PCBDDCDestroyFETIDPPC(PC pc)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetupFETIDPMatContext"
 PetscErrorCode PCBDDCSetupFETIDPMatContext(FETIDPMat_ctx fetidpmat_ctx )
 {
   for (i=0;i<pcis->n;i++){
     j = mat_graph->count[i]; /* RECALL: mat_graph->count[i] does not count myself */
     k = 0;
-    if (j > 0) { 
+    if (j > 0) {
       k = (mat_graph->neighbours_set[i][0] == -1 ?  1 : 0);
     }
     j = j - k ;
   ierr = PetscOptionsGetBool(NULL,"-fetidp_check",&test_fetidp,NULL);CHKERRQ(ierr);
 
   if (test_fetidp && !pcbddc->use_deluxe_scaling) {
-    
+
     ierr = PetscViewerASCIIGetStdout(comm,&viewer);CHKERRQ(ierr);
     ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_TRUE);CHKERRQ(ierr);
     ierr = PetscViewerASCIIPrintf(viewer,"----------FETI_DP TESTS--------------\n");CHKERRQ(ierr);
     ierr = PCBDDCScalingExtension(fetidpmat_ctx->pc,pcis->vec2_B,pcis->vec1_global);CHKERRQ(ierr);
     ierr = VecScatterBegin(pcis->global_to_B,pcis->vec1_global,pcis->vec2_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
     ierr = VecScatterEnd  (pcis->global_to_B,pcis->vec1_global,pcis->vec2_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
-   
+
     /* test E_D=I-P_D */
     scalar_value = 1.0;
     ierr = VecAXPY(pcis->vec1_B,scalar_value,pcis->vec2_B);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSetupFETIDPPCContext"
 PetscErrorCode PCBDDCSetupFETIDPPCContext(Mat fetimat, FETIDPPC_ctx fetidppc_ctx)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "FETIDPMatMult"
 PetscErrorCode FETIDPMatMult(Mat fetimat, Vec x, Vec y)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "FETIDPPCApply"
 PetscErrorCode FETIDPPCApply(PC fetipc, Vec x, Vec y)
 {

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

 #define DIRICHLET_MARK -2
 #define SPECIAL_MARK -3
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGraphASCIIView"
 PetscErrorCode PCBDDCGraphASCIIView(PCBDDCGraph graph, PetscInt verbosity_level, PetscViewer viewer)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGraphGetCandidatesIS"
 PetscErrorCode PCBDDCGraphGetCandidatesIS(PCBDDCGraph graph, PetscBool use_faces, PetscBool use_edges, PetscBool use_vertices, PetscInt *n_faces, IS *FacesIS[], PetscInt *n_edges, IS *EdgesIS[], IS *VerticesIS)
 {
   twodim_flag = PETSC_FALSE;
   for (i=0;i<graph->ncc;i++) {
     if (graph->cptr[i+1]-graph->cptr[i] > graph->custom_minimal_size) {
-      if (graph->count[graph->queue[graph->cptr[i]]] == 1) { 
+      if (graph->count[graph->queue[graph->cptr[i]]] == 1) {
         nfc++;
       } else { /* note that nec will be zero in 2d */
         nec++;
             ierr = ISCreateGeneral(PETSC_COMM_SELF,graph->cptr[i+1]-graph->cptr[i],&graph->queue[graph->cptr[i]],PETSC_COPY_VALUES,&ISForFaces[nfc]);CHKERRQ(ierr);
             nfc++;
           }
-        } 
+        }
       } else {
         if (use_edges) {
           ierr = ISCreateGeneral(PETSC_COMM_SELF,graph->cptr[i+1]-graph->cptr[i],&graph->queue[graph->cptr[i]],PETSC_COPY_VALUES,&ISForEdges[nec]);CHKERRQ(ierr);
       }
     }
     /* sort vertex set (by local ordering) */
-    ierr = PetscSortInt(nvc,idx);CHKERRQ(ierr); 
+    ierr = PetscSortInt(nvc,idx);CHKERRQ(ierr);
     ierr = ISCreateGeneral(PETSC_COMM_SELF,nvc,idx,PETSC_OWN_POINTER,&ISForVertices);CHKERRQ(ierr);
   }
   /* get back info */
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGraphComputeConnectedComponents"
 PetscErrorCode PCBDDCGraphComputeConnectedComponents(PCBDDCGraph graph)
 {
   for (i=0;i<graph->n_subsets;i++) {
     /* We are not sure that on a given subset of the local interface,
        with two connected components, the latters be the same among sharing subdomains */
-    if (graph->subset_ncc[i] > 1) { 
+    if (graph->subset_ncc[i] > 1) {
       adapt_interface=1;
       break;
     }
         new_adjncy[new_xadj[i]]=i;
       }
     }
-    ierr = PetscFree(aux_new_xadj);CHKERRQ(ierr); 
+    ierr = PetscFree(aux_new_xadj);CHKERRQ(ierr);
     for (i=0;i<graph->ncc;i++) {
       k = graph->cptr[i+1]-graph->cptr[i];
       for (j=0;j<k;j++) {
     ierr = PetscMalloc(2*cum_recv_counts[graph->n_subsets]*sizeof(*recv_buffer_subset),&recv_buffer_subset);CHKERRQ(ierr);
     ierr = PetscMalloc(cum_recv_counts[graph->n_subsets]*sizeof(MPI_Request),&send_requests);CHKERRQ(ierr);
     ierr = PetscMalloc(cum_recv_counts[graph->n_subsets]*sizeof(MPI_Request),&recv_requests);CHKERRQ(ierr);
-    for (i=0;i<cum_recv_counts[graph->n_subsets];i++) { 
+    for (i=0;i<cum_recv_counts[graph->n_subsets];i++) {
       send_requests[i]=MPI_REQUEST_NULL;
       recv_requests[i]=MPI_REQUEST_NULL;
     }
       for (k=0;k<graph->count[j];k++) {
         ierr = PetscMPIIntCast(graph->neighbours_set[j][k],&neigh);CHKERRQ(ierr);
         ierr = PetscMPIIntCast((PetscInt)(rank+1)*graph->count[j],&tag);CHKERRQ(ierr);
-        ierr = MPI_Isend(&graph->subset_ncc[i],1,MPIU_INT,neigh,tag,interface_comm,&send_requests[sum_requests]);CHKERRQ(ierr); 
+        ierr = MPI_Isend(&graph->subset_ncc[i],1,MPIU_INT,neigh,tag,interface_comm,&send_requests[sum_requests]);CHKERRQ(ierr);
         ierr = PetscMPIIntCast((PetscInt)(neigh+1)*graph->count[j],&tag);CHKERRQ(ierr);
-        ierr = MPI_Irecv(&recv_buffer_subset[sum_requests],1,MPIU_INT,neigh,tag,interface_comm,&recv_requests[sum_requests]);CHKERRQ(ierr); 
+        ierr = MPI_Irecv(&recv_buffer_subset[sum_requests],1,MPIU_INT,neigh,tag,interface_comm,&recv_requests[sum_requests]);CHKERRQ(ierr);
         sum_requests++;
       }
     }
     for (i=0;i<graph->n_subsets;i++) {
       for (j=cum_recv_counts[i];j<cum_recv_counts[i+1];j++){
         /* The first condition is natural (someone has a different number of ccs than me), the second one is just to be safe */
-        if ( graph->subset_ncc[i] != recv_buffer_subset[j] || graph->subset_ncc[i] > 1 ) { 
+        if ( graph->subset_ncc[i] != recv_buffer_subset[j] || graph->subset_ncc[i] > 1 ) {
           subset_cc_adapt[i] = PETSC_TRUE;
           break;
         }
           }
         }
       }
-    }  
+    }
     ierr = PetscMalloc(buffer_size*sizeof(*send_buffer),&send_buffer);CHKERRQ(ierr);
     /* now get from neighbours their ccs (in global numbering) and adapt them (in case it is needed) */
     ierr = PetscMalloc(graph->nvtxs*sizeof(*queue_in_global_numbering),&queue_in_global_numbering);CHKERRQ(ierr);
         for (k=0;k<graph->count[j];k++) {
           ierr = PetscMPIIntCast(graph->neighbours_set[j][k],&neigh);CHKERRQ(ierr);
           ierr = PetscMPIIntCast((PetscInt)(rank+1)*graph->count[j],&tag);CHKERRQ(ierr);
-          ierr = MPI_Isend(&sizes_of_sends[i],1,MPIU_INT,neigh,tag,interface_comm,&send_requests[sum_requests]);CHKERRQ(ierr); 
+          ierr = MPI_Isend(&sizes_of_sends[i],1,MPIU_INT,neigh,tag,interface_comm,&send_requests[sum_requests]);CHKERRQ(ierr);
           ierr = PetscMPIIntCast((PetscInt)(neigh+1)*graph->count[j],&tag);CHKERRQ(ierr);
           ierr = MPI_Irecv(&recv_buffer_subset[sum_requests+start_of_recv],1,MPIU_INT,neigh,tag,interface_comm,&recv_requests[sum_requests]);CHKERRQ(ierr);
           sum_requests++;
             temp_buffer_size++;
           } else {
             nodes_to_temp_buffer_indices[j] = -1;
-          } 
+          }
         }
         /* allocate some temporary space */
         ierr = PetscMalloc(temp_buffer_size*sizeof(PetscInt*),&temp_buffer);CHKERRQ(ierr);
         for (j=1;j<temp_buffer_size;j++) {
           temp_buffer[j] = temp_buffer[j-1]+cum_recv_counts[i+1]-cum_recv_counts[i];
         }
-        /* analyze contributions from neighbouring subdomains for i-th conn comp 
+        /* analyze contributions from neighbouring subdomains for i-th conn comp
            temp buffer structure:
            supposing part of the interface has dimension 5 (for example with global dofs 0,1,2,3,4)
            3 neighs procs with structured connected components:
                0, 1, 0; ];
            This way we can simply find intersections of ccs among neighs.
            For the example above, the graph->subset array will be modified to reproduce the following 4 connected components [0], [1], [2 3], [4];
-                                                                                                                                   */     
+                                                                                                                                   */
         for (j=0;j<cum_recv_counts[i+1]-cum_recv_counts[i];j++) {
           ins_val = 0;
           size_of_recv = recv_buffer_subset[sum_requests];  /* total size of recv from neighs */
   PetscFunctionReturn(0);
 }
 
-/* The following code has been adapted from function IsConnectedSubdomain contained 
+/* The following code has been adapted from function IsConnectedSubdomain contained
    in source file contig.c of METIS library (version 5.0.1)
-   It finds connected components for each subset  */                                
-#undef __FUNCT__  
+   It finds connected components for each subset  */
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCGraphComputeConnectedComponentsLocal"
 PetscErrorCode PCBDDCGraphComputeConnectedComponentsLocal(PCBDDCGraph graph)
 {
   PetscInt       i,j,k,first,last,nleft,ncc,pid,cum_queue,n,ncc_pid;
   PetscInt       *queue_global;
   PetscErrorCode ierr;
- 
+
   PetscFunctionBegin;
   /* quiet return if no csr info is available */
   if (!graph->xadj || !graph->adjncy) {
   ierr = PetscMemzero(graph->touched,graph->nvtxs*sizeof(*graph->touched));CHKERRQ(ierr);
   graph->n_subsets = 0;
   for (i=0;i<graph->nvtxs;i++) {
-    if (graph->which_dof[i] == DIRICHLET_MARK || !graph->count[i]) { 
+    if (graph->which_dof[i] == DIRICHLET_MARK || !graph->count[i]) {
       graph->touched[i] = PETSC_TRUE;
       graph->subset[i] = 0;
     }
       graph->count[shared[i][j]] += 1;
     }
   }
-  /* Allocate space for storing the set of neighbours for each node */ 
+  /* Allocate space for storing the set of neighbours for each node */
   if (graph->nvtxs) {
     ierr = PetscMalloc(k*sizeof(PetscInt),&graph->neighbours_set[0]);CHKERRQ(ierr);
   }
           SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_USER,"BDDC cannot have boundary nodes which are marked Neumann and Dirichlet at the same time! Local node %d is wrong!\n",k);
         }
         array2[k] = 1.0;
-      } 
+      }
     }
     ierr = ISRestoreIndices(dirichlet_is,(const PetscInt**)&is_indices);CHKERRQ(ierr);
     ierr = VecRestoreArray(local_vec,&array);CHKERRQ(ierr);
   }
   /* mark interior nodes as touched and belonging to partition number 0 */
   for (i=0;i<graph->nvtxs;i++) {
-    if (!graph->count[i]) {  
+    if (!graph->count[i]) {
       graph->touched[i] = PETSC_TRUE;
       graph->subset[i] = 0;
     }

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

 #include "bddc.h"
 #include "bddcprivate.h"
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCNullSpaceAssembleCoarse"
-PetscErrorCode PCBDDCNullSpaceAssembleCoarse(PC pc, MatNullSpace* CoarseNullSpace) 
+PetscErrorCode PCBDDCNullSpaceAssembleCoarse(PC pc, MatNullSpace* CoarseNullSpace)
 {
   PC_BDDC        *pcbddc = (PC_BDDC*)pc->data;
   Mat_IS         *matis = (Mat_IS*)pc->pmat->data;
   PetscReal      test_null;
   PetscErrorCode ierr;
 
-  PetscFunctionBegin;  
+  PetscFunctionBegin;
   tempCoarseNullSpace = 0;
   coarse_nsp_size = 0;
   coarse_nsp_vecs = 0;
   ierr = VecDestroy(&local_vec);CHKERRQ(ierr);
   ierr = VecDestroy(&local_primal_vec);CHKERRQ(ierr);
   *CoarseNullSpace = tempCoarseNullSpace;
-  PetscFunctionReturn(0);  
+  PetscFunctionReturn(0);
 }
 
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCApplyNullSpaceCorrectionPC"
-static PetscErrorCode PCBDDCApplyNullSpaceCorrectionPC(PC pc,Vec x,Vec y) 
+static PetscErrorCode PCBDDCApplyNullSpaceCorrectionPC(PC pc,Vec x,Vec y)
 {
   NullSpaceCorrection_ctx pc_ctx;
   PetscErrorCode          ierr;
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCDestroyNullSpaceCorrectionPC"
-static PetscErrorCode PCBDDCDestroyNullSpaceCorrectionPC(PC pc) 
+static PetscErrorCode PCBDDCDestroyNullSpaceCorrectionPC(PC pc)
 {
   NullSpaceCorrection_ctx pc_ctx;
   PetscErrorCode          ierr;
 /*PETSC_EXTERN PetscErrorCode PCBDDCApplyNullSpaceCorrectionPC(PC,Vec,Vec);
 PETSC_EXTERN PetscErrorCode PCBDDCDestroyNullSpaceCorrectionPC(PC);*/
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCNullSpaceAssembleCorrection"
 PetscErrorCode PCBDDCNullSpaceAssembleCorrection(PC pc,IS local_dofs)
 {
   }
   ierr = KSPGetOperators(*local_ksp,&local_mat,&local_pmat,&local_mat_struct);CHKERRQ(ierr);
 
-  /* Get null space vecs */ 
+  /* Get null space vecs */
   ierr = MatNullSpaceGetVecs(pcbddc->NullSpace,&nnsp_has_cnst,&nnsp_size,&nullvecs);CHKERRQ(ierr);
   basis_size = nnsp_size;
   if (nnsp_has_cnst) {
   ierr = MatDenseGetArray(shell_ctx->basis_mat,&basis_mat);CHKERRQ(ierr);
   ierr = MatDenseGetArray(shell_ctx->Kbasis_mat,&Kbasis_mat);CHKERRQ(ierr);
 
-  /* Restrict local null space on selected dofs (Dirichlet or Neumann) 
+  /* Restrict local null space on selected dofs (Dirichlet or Neumann)
      and compute matrices N and K*N */
   ierr = VecDuplicate(shell_ctx->work_full_1,&work1);CHKERRQ(ierr);
   ierr = VecDuplicate(shell_ctx->work_full_1,&work2);CHKERRQ(ierr);
   ierr = MatCreateSeqDense(PETSC_COMM_SELF,basis_size,basis_size,array_mat,&inv_small_mat);CHKERRQ(ierr);
   ierr = MatMatMult(shell_ctx->basis_mat,inv_small_mat,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&shell_ctx->Lbasis_mat);CHKERRQ(ierr);
   ierr = PetscFree(array_mat);CHKERRQ(ierr);
-  ierr = MatDestroy(&inv_small_mat);CHKERRQ(ierr); 
-  ierr = MatDestroy(&small_mat);CHKERRQ(ierr); 
+  ierr = MatDestroy(&inv_small_mat);CHKERRQ(ierr);
+  ierr = MatDestroy(&small_mat);CHKERRQ(ierr);
   ierr = MatScale(shell_ctx->Kbasis_mat,m_one);CHKERRQ(ierr);
 
   /* Rebuild local PC */

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

 #include "bddcprivate.h"
 #include <petscblaslapack.h>
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCResetCustomization"
 PetscErrorCode PCBDDCResetCustomization(PC pc)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCResetTopography"
 PetscErrorCode PCBDDCResetTopography(PC pc)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCResetSolvers"
 PetscErrorCode PCBDDCResetSolvers(PC pc)
 {
 #undef __FUNCT__
 #define __FUNCT__ "PCBDDCSolveSaddlePoint"
 static PetscErrorCode  PCBDDCSolveSaddlePoint(PC pc)
-{ 
+{
   PetscErrorCode ierr;
   PC_BDDC*       pcbddc = (PC_BDDC*)(pc->data);
 
 #undef __FUNCT__
 #define __FUNCT__ "PCBDDCApplyInterfacePreconditioner"
 PetscErrorCode  PCBDDCApplyInterfacePreconditioner(PC pc)
-{ 
+{
   PetscErrorCode ierr;
   PC_BDDC*        pcbddc = (PC_BDDC*)(pc->data);
   PC_IS*            pcis = (PC_IS*)  (pc->data);
 #undef __FUNCT__
 #define __FUNCT__ "PCBDDCScatterCoarseDataBegin"
 PetscErrorCode PCBDDCScatterCoarseDataBegin(PC pc,Vec vec_from, Vec vec_to, InsertMode imode, ScatterMode smode)
-{ 
+{
   PetscErrorCode ierr;
   PC_BDDC*       pcbddc = (PC_BDDC*)(pc->data);
 
 #undef __FUNCT__
 #define __FUNCT__ "PCBDDCScatterCoarseDataEnd"
 PetscErrorCode PCBDDCScatterCoarseDataEnd(PC pc,Vec vec_from, Vec vec_to, InsertMode imode, ScatterMode smode)
-{ 
+{
   PetscErrorCode ierr;
   PC_BDDC*       pcbddc = (PC_BDDC*)(pc->data);
   PetscScalar*   array_to;
           } else { /* no communications needed for SCATTER_REVERSE since needed data is already present */
             if (imode == ADD_VALUES) {
               for (i=0;i<pcbddc->local_primal_size;i++) {
-                array_to[i]+=array_from[pcbddc->local_primal_indices[i]]; 
+                array_to[i]+=array_from[pcbddc->local_primal_indices[i]];
               }
             } else {
               for (i=0;i<pcbddc->local_primal_size;i++) {
-                array_to[i]=array_from[pcbddc->local_primal_indices[i]]; 
+                array_to[i]=array_from[pcbddc->local_primal_indices[i]];
               }
             }
           }
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCConstraintsSetUp"
 PetscErrorCode PCBDDCConstraintsSetUp(PC pc)
-{   
+{
   PetscErrorCode ierr;
   PC_IS*         pcis = (PC_IS*)(pc->data);
   PC_BDDC*       pcbddc = (PC_BDDC*)pc->data;
   ierr = MatGetNearNullSpace(pc->pmat,&nearnullsp);CHKERRQ(ierr);
   if (nearnullsp) {
     ierr = MatNullSpaceGetVecs(nearnullsp,&nnsp_has_cnst,&nnsp_size,&nearnullvecs);CHKERRQ(ierr);
-  } else { /* if near null space is not provided it uses constants */ 
+  } else { /* if near null space is not provided it uses constants */
     nnsp_has_cnst = PETSC_TRUE;
-    use_nnsp_true = PETSC_TRUE; 
+    use_nnsp_true = PETSC_TRUE;
   }
   if (nnsp_has_cnst) {
     nnsp_addone = 1;
     } else {
       used_IS = &ISForFaces[i-n_ISForEdges];
     }
-    ierr = ISGetSize(*used_IS,&j);CHKERRQ(ierr); 
+    ierr = ISGetSize(*used_IS,&j);CHKERRQ(ierr);
     total_counts += j;
     max_size_of_constraint = PetscMax(j,max_size_of_constraint);
   }
         temp_indices_to_constraint_B[temp_indices[total_counts]]=local_to_B[is_indices[i]];
         temp_quadrature_constraint[temp_indices[total_counts]]=1.0;
         temp_indices[total_counts+1]=temp_indices[total_counts]+1;
-        change_basis[total_counts]=PETSC_FALSE; 
+        change_basis[total_counts]=PETSC_FALSE;
         total_counts++;
       }
     } else { /* consider vertices for which exist at least a localnearnullsp which is not null there */
             temp_indices_to_constraint_B[temp_indices[total_counts]]=local_to_B[is_indices[i]];
             temp_quadrature_constraint[temp_indices[total_counts]]=1.0;
             temp_indices[total_counts+1]=temp_indices[total_counts]+1;
-            change_basis[total_counts]=PETSC_FALSE; 
-            total_counts++; 
+            change_basis[total_counts]=PETSC_FALSE;
+            total_counts++;
             used_vertex=PETSC_TRUE;
           }
           ierr = VecRestoreArrayRead(localnearnullsp[k],(const PetscScalar**)&array_vector);CHKERRQ(ierr);
       }
       temp_indices[total_counts+1]=temp_indices[total_counts]+size_of_constraint;  /* store new starting point */
       change_basis[total_counts]=boolforface;
-      total_counts++; 
+      total_counts++;
     }
     for (k=0;k<nnsp_size;k++) {
       ierr = VecGetArrayRead(localnearnullsp[k],(const PetscScalar**)&array_vector);CHKERRQ(ierr);
 #else
 /*  LAPACK call is missing here! TODO */
       SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP, "Not yet implemented for complexes when PETSC_MISSING_GESVD = 1");
-#endif   
+#endif
       if (lierr) {
         SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYEVX Lapack routine %d",(int)lierr);
-      } 
+      }
       ierr = PetscFPTrapPop();CHKERRQ(ierr);
       /* retain eigenvalues greater than tol: note that lapack SYEV gives eigs in ascending order */
       j=0;
           if (i == local_primal_size -1 ||  temp_start_ptr != temp_indices_to_constraint_B[temp_indices[i+1]]) {
             compute_submatrix = PETSC_TRUE;
           }
-        } 
+        }
         if (compute_submatrix) {
           if (temp_constraints > 1 || pcbddc->use_nnsp_true) {
             useksp = PETSC_TRUE;
           for (s=0;s<dual_dofs;s++) {
             is_indices[0] = s;
             for (j=0;j<temp_constraints;j++) {
-              for (k=0;k<temp_constraints;k++) { 
+              for (k=0;k<temp_constraints;k++) {
                 temp_basis[j*temp_constraints+k]=temp_quadrature_constraint[temp_indices[start_constraint+k]+s+j+1];
               }
               work[j]=-temp_quadrature_constraint[temp_indices[start_constraint+j]+s];
             ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr);
             LAPACKgesv_(&Bt,&Bone,temp_basis,&Bt,ipiv,work,&Bt,&lierr);
             if ( lierr ) {
-              SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GESV Lapack routine %d",(int)lierr);          
+              SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GESV Lapack routine %d",(int)lierr);
             }
             ierr = PetscFPTrapPop();CHKERRQ(ierr);
             j = temp_indices_to_constraint_B[temp_indices[start_constraint]+s];
           }
           /* prepare for the next cycle */
           temp_constraints = 0;
-          if (i != local_primal_size -1 ) { 
+          if (i != local_primal_size -1 ) {
             temp_start_ptr = temp_indices_to_constraint_B[temp_indices[i+1]];
           }
         }
     ierr = PetscFree(ipiv);CHKERRQ(ierr);
     ierr = PetscFree(is_indices);CHKERRQ(ierr);
   }
-  /* free workspace no longer needed */ 
+  /* free workspace no longer needed */
   ierr = PetscFree(rwork);CHKERRQ(ierr);
   ierr = PetscFree(work);CHKERRQ(ierr);
   ierr = PetscFree(temp_basis);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCAnalyzeInterface"
 PetscErrorCode PCBDDCAnalyzeInterface(PC pc)
 {
   PC_BDDC     *pcbddc = (PC_BDDC*)pc->data;
   PC_IS       *pcis = (PC_IS*)pc->data;
-  Mat_IS      *matis  = (Mat_IS*)pc->pmat->data; 
+  Mat_IS      *matis  = (Mat_IS*)pc->pmat->data;
   PetscInt    bs,ierr,i,vertex_size;
-  PetscViewer viewer=pcbddc->dbg_viewer;  
+  PetscViewer viewer=pcbddc->dbg_viewer;
 
   PetscFunctionBegin;
   /* Init local Graph struct */
       }
       max_size_of_constraint = PetscMax(size_of_constraint,max_size_of_constraint);
       ierr = MatRestoreRow(pcbddc->ConstraintMatrix,i,&size_of_constraint,NULL,NULL);CHKERRQ(ierr);
-    }    
+    }
     ierr = PetscMalloc(n*sizeof(PetscInt),&constraints_index);CHKERRQ(ierr);
     ierr = PetscMalloc(max_size_of_constraint*sizeof(PetscInt),&row_cmat_global_indices);CHKERRQ(ierr);
     ierr = PetscMalloc(local_size*sizeof(PetscBool),&touched);CHKERRQ(ierr);
         constraints_index[n++] = row_cmat_indices[min_loc];
       }
       ierr = MatRestoreRow(pcbddc->ConstraintMatrix,i,&size_of_constraint,(const PetscInt**)&row_cmat_indices,NULL);CHKERRQ(ierr);
-    }  
+    }
   }
   ierr = PetscFree(touched);CHKERRQ(ierr);
   ierr = PetscFree(row_cmat_global_indices);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCSubsetNumbering"
 PetscErrorCode PCBDDCSubsetNumbering(MPI_Comm comm,ISLocalToGlobalMapping l2gmap, PetscInt n_local_dofs, PetscInt local_dofs[], PetscInt local_dofs_mult[], PetscInt* n_global_subset, PetscInt* global_numbering_subset[])
 {
   PetscMPIInt    *dof_sizes,*dof_displs;
   PetscBool      first_found;
   PetscErrorCode ierr;
- 
+
   PetscFunctionBegin;
   /* mpi buffers */
   MPI_Comm_size(comm,&size_prec_comm);
   ierr = PetscFree(dof_sizes);CHKERRQ(ierr);
   ierr = PetscFree(dof_displs);CHKERRQ(ierr);
   /* return pointer to global ordering of local dofs */
-  *global_numbering_subset = temp_global_dofs; 
+  *global_numbering_subset = temp_global_dofs;
   PetscFunctionReturn(0);
 }

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

 extern PetscErrorCode PCBDDCScalingDestroyDeluxe(PC);
 extern PetscErrorCode PCBDDCScalingSetUpDeluxe(PC);
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingExtension_Basic"
 static PetscErrorCode PCBDDCScalingExtension_Basic(PC pc, Vec local_interface_vector, Vec global_vector)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingExtension_Deluxe"
 static PetscErrorCode PCBDDCScalingExtension_Deluxe(PC pc, Vec x, Vec y)
 {
   PC_BDDC*            pcbddc=(PC_BDDC*)pc->data;
   PCBDDCDeluxeScaling deluxe_ctx = pcbddc->deluxe_ctx;
   PetscScalar         *array_x,*array_D,*array;
-  PetscScalar         zero=0.0; 
+  PetscScalar         zero=0.0;
   PetscInt            i;
   PetscMPIInt         color_rank;
   PetscErrorCode      ierr;
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingExtension"
 PetscErrorCode PCBDDCScalingExtension(PC pc, Vec local_interface_vector, Vec global_vector)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingRestriction_Basic"
 static PetscErrorCode PCBDDCScalingRestriction_Basic(PC pc, Vec global_vector, Vec local_interface_vector)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingRestriction_Deluxe"
 static PetscErrorCode PCBDDCScalingRestriction_Deluxe(PC pc, Vec x, Vec y)
-{ 
+{
   PC_IS*              pcis=(PC_IS*)pc->data;
   PC_BDDC*            pcbddc=(PC_BDDC*)pc->data;
   PCBDDCDeluxeScaling deluxe_ctx = pcbddc->deluxe_ctx;
-  PetscScalar         *array_y,*array_D,zero=0.0; 
+  PetscScalar         *array_y,*array_D,zero=0.0;
   PetscInt            i;
   PetscErrorCode      ierr;
 
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingRestriction"
 PetscErrorCode PCBDDCScalingRestriction(PC pc, Vec global_vector, Vec local_interface_vector)
 {
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingSetUp"
 PetscErrorCode PCBDDCScalingSetUp(PC pc)
 {
   ierr = VecScatterEnd(pcis->global_to_B,pcis->vec1_global,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
   ierr = VecPointwiseDivide(pcis->D,pcis->D,pcis->vec1_B);CHKERRQ(ierr);
   /* now setup */
-  /* if (pcbddc->use_deluxe_scaling) { */ 
-  if (PETSC_FALSE) { 
+  /* if (pcbddc->use_deluxe_scaling) { */
+  if (PETSC_FALSE) {
     ierr = PCBDDCScalingCreateDeluxe(pc);CHKERRQ(ierr);
     ierr = PCBDDCScalingSetUpDeluxe(pc);CHKERRQ(ierr);
     ierr = PetscObjectComposeFunction((PetscObject)pc,"PCBDDCScalingRestriction_C",PCBDDCScalingRestriction_Deluxe);CHKERRQ(ierr);
       ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr);
       ierr = VecScatterBegin(pcis->global_to_B,pcis->vec1_B,pcis->vec1_global,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
       ierr = VecScatterEnd(pcis->global_to_B,pcis->vec1_B,pcis->vec1_global,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
-      ierr = VecView(pcis->vec1_global,viewer);CHKERRQ(ierr);    
+      ierr = VecView(pcis->vec1_global,viewer);CHKERRQ(ierr);
     }
     /* restriction -> from parallel to local */
     ierr = VecSetRandom(pcis->vec1_global,NULL);CHKERRQ(ierr);
       ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr);
       ierr = VecScatterBegin(pcis->global_to_B,pcis->vec1_B,pcis->vec1_global,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
       ierr = VecScatterEnd(pcis->global_to_B,pcis->vec1_B,pcis->vec1_global,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr);
-      ierr = VecView(pcis->vec1_global,viewer);CHKERRQ(ierr);    
+      ierr = VecView(pcis->vec1_global,viewer);CHKERRQ(ierr);
     }
   }
   PetscFunctionReturn(0);
 }
 
-#undef __FUNCT__  
+#undef __FUNCT__
 #define __FUNCT__ "PCBDDCScalingDestroy"
 PetscErrorCode PCBDDCScalingDestroy(PC pc)
 {
 
   PetscFunctionBegin;
   /* if (pcbddc->use_deluxe_scaling) { */
-  if (PETSC_FALSE) { 
+  if (PETSC_FALSE) {
     ierr = PCBDDCScalingDestroyDeluxe(pc);CHKERRQ(ierr);
   }
   ierr = VecDestroy(&pcbddc->work_scaling);CHKERRQ(ierr);