[petsc-users] [PATCH 2/2] Call KSPSetFromOptions before setting fieldsplit-specific options

Jed Brown jedbrown at mcs.anl.gov
Sun Sep 8 00:54:50 CDT 2013


PCFieldSplitSetIS is ignored if the PC type is not set to "fieldsplit".
The command line option -pc_type is processed in KSPSetFromOptions and
any manual fieldsplit-specific configuration must be done afterward.
---
 ex2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ex2.c b/ex2.c
index 82f1d97..94cea2c 100644
--- a/ex2.c
+++ b/ex2.c
@@ -54,13 +54,13 @@ int main(int argc,char **args)
   KSPGetPC(ksp,&pc);
   KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);
 
+  KSPSetFromOptions(ksp);
+
   PCFieldSplitSetIS(pc, "1", is_row1);
   PCFieldSplitSetIS(pc, "2", is_row2);
   ISDestroy(&is_row1);
   ISDestroy(&is_row2);
-  
-  KSPSetFromOptions(ksp);
-  
+
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Solve the linear system
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-- 
1.8.4



More information about the petsc-users mailing list