~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/la/EpetraKrylovSolver.cpp

  • Committer: Kent-Andre Mardal
  • Date: 2008-05-17 07:26:30 UTC
  • mto: (2668.7.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2670.
  • Revision ID: kent-and@simula.no-20080517072630-eywn6rchs6zsa0en
clean up

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
  int N_levels = 10;
59
59
 
60
60
  // output level
61
 
  ML_Set_PrintLevel(3);
 
61
//  ML_Set_PrintLevel(3);
62
62
 
63
63
  ML_Create(&ml_handle,N_levels);
64
64
 
65
65
  // wrap Epetra Matrix into ML matrix (data is NOT copied)
66
66
  EpetraMatrix2MLMatrix(ml_handle, 0, &(A.mat()));
67
67
 
68
 
  // as we are interested in smoothed aggregation, create a ML_Aggregate object
69
 
  // to store the aggregates
 
68
  // create a ML_Aggregate object to store the aggregates
70
69
  ML_Aggregate *agg_object;
71
70
  ML_Aggregate_Create(&agg_object);
72
71
 
73
 
  // specify max coarse size (ML will not coarse further is the matrix at a given level is
74
 
  // smaller than specified here)
 
72
  // specify max coarse size 
75
73
  ML_Aggregate_Set_MaxCoarseSize(agg_object,1);
76
74
 
77
75
  // generate the hierady
78
 
  N_levels = ML_Gen_MGHierarchy_UsingAggregation(ml_handle, 0,
79
 
                                                  ML_INCREASING, agg_object);
 
76
  N_levels = ML_Gen_MGHierarchy_UsingAggregation(ml_handle, 0, ML_INCREASING, agg_object);
80
77
 
81
 
  // Set a symmetric Gauss-Seidel smoother for the MG method (change
82
 
  // if the matrix is not symmetric)
83
 
  ML_Gen_Smoother_SymGaussSeidel(ml_handle, ML_ALL_LEVELS,
84
 
                                  ML_BOTH, 1, ML_DEFAULT);
 
78
  // Set a symmetric Gauss-Seidel smoother for the MG method 
 
79
  ML_Gen_Smoother_SymGaussSeidel(ml_handle, ML_ALL_LEVELS, ML_BOTH, 1, ML_DEFAULT);
85
80
 
86
81
  // generate solver
87
 
  ML_Gen_Solver    (ml_handle, ML_MGV, 0, N_levels-1);
 
82
  ML_Gen_Solver(ml_handle, ML_MGV, 0, N_levels-1);
88
83
 
89
84
  // wrap ML_Operator into Epetra_Operator
90
85
  ML_Epetra::MultiLevelOperator  MLop(ml_handle,A.mat().Comm(),A.mat().DomainMap(),A.mat().RangeMap());
91
86
 
92
 
  // ===================== E N D    O F  M L   S E C T I O N  ========================= //
93
 
  
94
87
  // set this operator as preconditioner for AztecOO
95
88
  linear_solver.SetPrecOperator(&MLop);
96
89