![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __FIXED_POINT_ITERATION_H 00005 #define __FIXED_POINT_ITERATION_H 00006 00007 #include <dolfin/constants.h> 00008 #include <dolfin/Iteration.h> 00009 00010 namespace dolfin 00011 { 00012 class Solution; 00013 class RHS; 00014 class Adaptivity; 00015 class TimeSlab; 00016 class Element; 00017 class ElementGroup; 00018 class ElementGroupList; 00019 00027 00028 class FixedPointIteration 00029 { 00030 public: 00031 00033 FixedPointIteration(Solution& u, RHS& f, Adaptivity& adaptivity); 00034 00036 ~FixedPointIteration(); 00037 00039 bool iterate(TimeSlab& timeslab); 00040 00042 bool iterate(ElementGroupList& list); 00043 00045 real iterate(ElementGroup& group); 00046 00048 real iterate(Element& element); 00049 00051 void reset(ElementGroupList& list); 00052 00054 void reset(ElementGroup& group); 00055 00057 void reset(Element& element); 00058 00060 void stabilization(real& alpha, unsigned int& m) const; 00061 00063 void report() const; 00064 00065 private: 00066 00067 // Start iteration on group list 00068 void start(ElementGroupList& list); 00069 00070 // Start iteration on element group 00071 void start(ElementGroup& group); 00072 00073 // Start iteration on element 00074 void start(Element& element); 00075 00076 // End iteration on group list 00077 void end(ElementGroupList& list); 00078 00079 // End iteration on element group 00080 void end(ElementGroup& group); 00081 00082 // End iteration on element 00083 void end(Element& element); 00084 00085 // Update group list 00086 void update(ElementGroupList& list, Iteration::Increments& d); 00087 00088 // Update element group 00089 void update(ElementGroup& group, Iteration::Increments& d); 00090 00091 // Update element 00092 void update(Element& element, Iteration::Increments& d); 00093 00094 // Stabilize group list 00095 void stabilize(ElementGroupList& list, const Iteration::Increments& d, 00096 unsigned int n); 00097 00098 // Stabilize element group 00099 void stabilize(ElementGroup& group, const Iteration::Increments& r, 00100 unsigned int n); 00101 00102 // Stabilize element 00103 void stabilize(Element& element, const Iteration::Increments& d, 00104 unsigned int n); 00105 00106 // Check convergence for group list 00107 bool converged(ElementGroupList& list, const Iteration::Increments& d, 00108 unsigned int n); 00109 00110 // Check convergence for element group 00111 bool converged(ElementGroup& group, const Iteration::Increments& d, 00112 unsigned int n); 00113 00114 // Check convergence for element 00115 bool converged(Element& element, const Iteration::Increments& d, 00116 unsigned int n); 00117 00118 // Check divergence for group list 00119 bool diverged(ElementGroupList& list, const Iteration::Increments& d, 00120 unsigned int n, Iteration::State& newstate); 00121 00122 // Check divergence for element group 00123 bool diverged(ElementGroup& group, const Iteration::Increments& d, 00124 unsigned int n, Iteration::State& newstate); 00125 00126 // Check divergence for element 00127 bool diverged(Element& element, const Iteration::Increments& d, 00128 unsigned int n, Iteration::State& newstate); 00129 00131 void init(ElementGroup& group); 00132 00133 // Update initial data for element 00134 void init(Element& element); 00135 00136 // Change state 00137 void changeState(Iteration::State newstate); 00138 00139 // Write debug info for group list iteration 00140 void debug(ElementGroupList& list, const Iteration::Increments& d, 00141 unsigned int n); 00142 00143 // Write debug info for element group iteration 00144 void debug(ElementGroup& group, const Iteration::Increments& d, 00145 unsigned int n); 00146 00147 // Write debug info for element iteration 00148 void debug(Element& element, const Iteration::Increments& d, 00149 unsigned int n); 00150 00151 //--- Data for fixed point iteration --- 00152 00153 // Solution 00154 Solution& u; 00155 00156 // Right-hand side f 00157 RHS& f; 00158 00159 // Maximum number of iterations 00160 unsigned int maxiter; 00161 00162 // Maximum allowed divergence 00163 real maxdiv; 00164 00165 // Maximum allowed convergence 00166 real maxconv; 00167 00168 // Tolerance for discrete residual 00169 real tol; 00170 00171 // Check if we should debug iterations 00172 bool debug_iter; 00173 00174 // Current state 00175 Iteration* state; 00176 00177 }; 00178 00179 } 00180 00181 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.