@@ -734,56 +734,25 @@ Real PetscLinearSolver<T>::get_initial_residual()
734734template < typename T >
735735void PetscLinearSolver < T > ::set_petsc_solver_type ()
736736{
737+ #define CaseKSPSetType (SolverType , KSPT ) \
738+ case SolverType: \
739+ LibmeshPetscCall(KSPSetType (_ksp, const_cast<KSPType>(KSPT))); \
740+ return;
741+
737742 switch (this -> _solver_type )
738743 {
739-
740- case CG :
741- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPCG )));
742- return ;
743-
744- case CR :
745- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPCR )));
746- return ;
747-
748- case CGS :
749- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPCGS )));
750- return ;
751-
752- case BICG :
753- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPBICG )));
754- return ;
755-
756- case TCQMR :
757- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPTCQMR )));
758- return ;
759-
760- case TFQMR :
761- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPTFQMR )));
762- return ;
763-
764- case LSQR :
765- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPLSQR )));
766- return ;
767-
768- case BICGSTAB :
769- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPBCGS )));
770- return ;
771-
772- case MINRES :
773- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPMINRES )));
774- return ;
775-
776- case GMRES :
777- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPGMRES )));
778- return ;
779-
780- case RICHARDSON :
781- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPRICHARDSON )));
782- return ;
783-
784- case CHEBYSHEV :
785- LibmeshPetscCall (KSPSetType (_ksp , const_cast < KSPType > (KSPCHEBYSHEV )));
786- return ;
744+ CaseKSPSetType (CG , KSPCG )
745+ CaseKSPSetType (CR , KSPCR )
746+ CaseKSPSetType (CGS , KSPCGS )
747+ CaseKSPSetType (BICG , KSPBICG )
748+ CaseKSPSetType (TCQMR , KSPTCQMR )
749+ CaseKSPSetType (TFQMR , KSPTFQMR )
750+ CaseKSPSetType (LSQR , KSPLSQR )
751+ CaseKSPSetType (BICGSTAB , KSPBCGS )
752+ CaseKSPSetType (MINRES , KSPMINRES )
753+ CaseKSPSetType (GMRES , KSPGMRES )
754+ CaseKSPSetType (RICHARDSON , KSPRICHARDSON )
755+ CaseKSPSetType (CHEBYSHEV , KSPCHEBYSHEV )
787756
788757 default :
789758 libMesh ::err << "ERROR: Unsupported PETSC Solver: "
0 commit comments