#NEWLINE# def apply( self , mat , arg , result ) : #NEWLINE# #INDENT# ' Applies preconditioner.\n\n        Args\n        ----\n        arg : PetSC Vector\n            Incoming vector\n\n        result : PetSC Vector\n            Empty vector into which we return the preconditioned arg\n        ' #NEWLINE# if ( self . preconditioner is None ) : #NEWLINE# #INDENT# result . array [ : ] = _get_petsc_vec_array ( arg ) #NEWLINE# return #NEWLINE# #UNINDENT# system = self . system #NEWLINE# mode = self . mode #NEWLINE# voi = self . voi #NEWLINE# if ( mode == 'fwd' ) : #NEWLINE# #INDENT# ( sol_vec , rhs_vec ) = ( system . dumat [ voi ] , system . drmat [ voi ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( sol_vec , rhs_vec ) = ( system . drmat [ voi ] , system . dumat [ voi ] ) #NEWLINE# #UNINDENT# rhs_vec . vec [ : ] = _get_petsc_vec_array ( arg ) #NEWLINE# system . clear_dparams ( ) #NEWLINE# dumat = OrderedDict ( ) #NEWLINE# dumat [ voi ] = system . dumat [ voi ] #NEWLINE# drmat = OrderedDict ( ) #NEWLINE# drmat [ voi ] = system . drmat [ voi ] #NEWLINE# with system . _dircontext : #NEWLINE# #INDENT# system . solve_linear ( dumat , drmat , ( voi , ) , mode = mode , solver = self . preconditioner ) #NEWLINE# #UNINDENT# result . array [ : ] = sol_vec . vec