| [48b662] | 1 | /**
|
|---|
| 2 | * @file techniques.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 13:06:42 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Some examples for multigrid methods this library
|
|---|
| 7 | * might be used for.
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #ifndef TECHNIQUES_HPP_
|
|---|
| 12 | #define TECHNIQUES_HPP_
|
|---|
| 13 |
|
|---|
| 14 | #include <sstream>
|
|---|
| 15 | #include <string>
|
|---|
| 16 |
|
|---|
| 17 | #include "base/command_list.hpp"
|
|---|
| 18 |
|
|---|
| 19 | namespace VMG
|
|---|
| 20 | {
|
|---|
| 21 |
|
|---|
| 22 | class Techniques
|
|---|
| 23 | {
|
|---|
| 24 | public:
|
|---|
| 25 | static void SetCorrectionSchemeDirichlet(int minLevel, int maxLevel, int gamma)
|
|---|
| 26 | {
|
|---|
| 27 | CommandList* init = new CommandList();
|
|---|
| 28 | CommandList* loop = new CommandList();
|
|---|
| 29 | CommandList* finalize = new CommandList();
|
|---|
| 30 |
|
|---|
| 31 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 32 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 33 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 34 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 35 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 36 | init->AddCommand("CopyBoundary", "RHS:SOL");
|
|---|
| [dfed1c] | 37 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 38 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 39 |
|
|---|
| 40 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 41 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 42 |
|
|---|
| 43 | AddCycleGamma(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 44 |
|
|---|
| [dfed1c] | 45 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 46 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 47 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 48 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 49 |
|
|---|
| 50 | finalize->AddCommand("ExportSolution");
|
|---|
| 51 |
|
|---|
| 52 | init->Register("COMMANDLIST_INIT");
|
|---|
| 53 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 54 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | static void SetCorrectionSchemeDirichletDebug(int minLevel, int maxLevel, int gamma)
|
|---|
| 59 | {
|
|---|
| 60 | CommandList* init = new CommandList();
|
|---|
| 61 | CommandList* loop = new CommandList();
|
|---|
| 62 | CommandList* finalize = new CommandList();
|
|---|
| 63 |
|
|---|
| 64 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 65 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 66 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 67 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 68 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 69 | init->AddCommand("CopyBoundary", "RHS:SOL");
|
|---|
| [dfed1c] | 70 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 71 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| [dfed1c] | 72 | init->AddCommand("PrintAllSettings");
|
|---|
| [48b662] | 73 |
|
|---|
| 74 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 75 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 76 |
|
|---|
| 77 | AddCycleGammaDebug(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 78 |
|
|---|
| [dfed1c] | 79 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 80 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 81 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 82 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 83 |
|
|---|
| 84 | finalize->AddCommand("ExportSolution");
|
|---|
| 85 |
|
|---|
| 86 | init->Register("COMMANDLIST_INIT");
|
|---|
| 87 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 88 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | static void SetCorrectionSchemePeriodic(int minLevel, int maxLevel, int gamma)
|
|---|
| 92 | {
|
|---|
| 93 | CommandList* init = new CommandList();
|
|---|
| 94 | CommandList* loop = new CommandList();
|
|---|
| 95 | CommandList* finalize = new CommandList();
|
|---|
| 96 |
|
|---|
| 97 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 98 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 99 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 100 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 101 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| [dfed1c] | 102 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 103 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 104 |
|
|---|
| 105 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 106 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 107 |
|
|---|
| 108 | AddCycleGamma(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 109 |
|
|---|
| [dfed1c] | 110 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 111 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 112 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 113 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 114 |
|
|---|
| 115 | finalize->AddCommand("ExportSolution");
|
|---|
| 116 |
|
|---|
| 117 | init->Register("COMMANDLIST_INIT");
|
|---|
| 118 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 119 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | static void SetCorrectionSchemePeriodicDebug(int minLevel, int maxLevel, int gamma)
|
|---|
| 123 | {
|
|---|
| 124 | CommandList* init = new CommandList();
|
|---|
| 125 | CommandList* loop = new CommandList();
|
|---|
| 126 | CommandList* finalize = new CommandList();
|
|---|
| 127 |
|
|---|
| 128 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 129 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 130 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 131 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 132 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| [dfed1c] | 133 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 134 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| [dfed1c] | 135 | init->AddCommand("PrintAllSettings");
|
|---|
| [48b662] | 136 |
|
|---|
| 137 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 138 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 139 |
|
|---|
| 140 | AddCycleGammaDebug(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 141 |
|
|---|
| [dfed1c] | 142 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 143 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 144 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [716da7] | 145 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 146 |
|
|---|
| 147 | finalize->AddCommand("ExportSolution");
|
|---|
| 148 |
|
|---|
| 149 | init->Register("COMMANDLIST_INIT");
|
|---|
| 150 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 151 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | static void SetCorrectionSchemePeriodicParticle(int minLevel, int maxLevel, int gamma)
|
|---|
| 155 | {
|
|---|
| 156 | CommandList* init = new CommandList();
|
|---|
| 157 | CommandList* loop = new CommandList();
|
|---|
| 158 | CommandList* finalize = new CommandList();
|
|---|
| 159 |
|
|---|
| 160 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 161 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 162 | init->AddCommand("ImportRightHandSide");
|
|---|
| 163 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 164 | init->AddCommand("InitializeIterationCounter");
|
|---|
| 165 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 166 |
|
|---|
| 167 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 168 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 169 |
|
|---|
| 170 | AddCycleGamma(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 171 |
|
|---|
| 172 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 173 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 174 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| 175 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 176 |
|
|---|
| 177 | finalize->AddCommand("ExportSolution");
|
|---|
| 178 |
|
|---|
| 179 | init->Register("COMMANDLIST_INIT");
|
|---|
| 180 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 181 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | static void SetCorrectionSchemePeriodicParticleDebug(int minLevel, int maxLevel, int gamma)
|
|---|
| 185 | {
|
|---|
| 186 | CommandList* init = new CommandList();
|
|---|
| 187 | CommandList* loop = new CommandList();
|
|---|
| 188 | CommandList* finalize = new CommandList();
|
|---|
| 189 |
|
|---|
| 190 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 191 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 192 | init->AddCommand("ImportRightHandSide");
|
|---|
| 193 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 194 | init->AddCommand("InitializeIterationCounter");
|
|---|
| 195 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 196 | init->AddCommand("PrintAllSettings");
|
|---|
| 197 |
|
|---|
| 198 | loop->AddCommand("ClearCoarseLevels", "SOL");
|
|---|
| 199 | loop->AddCommand("ClearCoarseLevels", "RHS");
|
|---|
| 200 |
|
|---|
| 201 | AddCycleGammaDebug(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 202 |
|
|---|
| 203 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 204 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 205 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 206 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 207 |
|
|---|
| 208 | finalize->AddCommand("ExportSolution");
|
|---|
| 209 |
|
|---|
| 210 | init->Register("COMMANDLIST_INIT");
|
|---|
| 211 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 212 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | static void SetFullApproximationSchemeDirichlet(int minLevel, int maxLevel, int gamma)
|
|---|
| 216 | {
|
|---|
| 217 | CommandList* init = new CommandList();
|
|---|
| 218 | CommandList* loop = new CommandList();
|
|---|
| 219 | CommandList* finalize = new CommandList();
|
|---|
| 220 |
|
|---|
| 221 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 222 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 223 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 224 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 225 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 226 | init->AddCommand("CopyBoundary", "RHS:SOL");
|
|---|
| [dfed1c] | 227 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 228 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 229 |
|
|---|
| 230 | AddCycleGamma(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 231 |
|
|---|
| [dfed1c] | 232 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 233 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 234 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 235 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 236 |
|
|---|
| 237 | finalize->AddCommand("ExportSolution");
|
|---|
| 238 |
|
|---|
| 239 | init->Register("COMMANDLIST_INIT");
|
|---|
| 240 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 241 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | static void SetFullApproximationSchemeDirichletDebug(int minLevel, int maxLevel, int gamma)
|
|---|
| 245 | {
|
|---|
| 246 | CommandList* init = new CommandList();
|
|---|
| 247 | CommandList* loop = new CommandList();
|
|---|
| 248 | CommandList* finalize = new CommandList();
|
|---|
| 249 |
|
|---|
| 250 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 251 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 252 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 253 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 254 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| 255 | init->AddCommand("CopyBoundary", "RHS:SOL");
|
|---|
| [dfed1c] | 256 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 257 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| [dfed1c] | 258 | init->AddCommand("PrintAllSettings");
|
|---|
| [48b662] | 259 |
|
|---|
| 260 | AddCycleGammaDebug(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 261 |
|
|---|
| [dfed1c] | 262 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 263 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 264 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 265 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 266 |
|
|---|
| 267 | finalize->AddCommand("ExportSolution");
|
|---|
| 268 |
|
|---|
| 269 | init->Register("COMMANDLIST_INIT");
|
|---|
| 270 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 271 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | static void SetFullApproximationSchemePeriodic(int minLevel, int maxLevel, int gamma)
|
|---|
| 275 | {
|
|---|
| 276 | CommandList* init = new CommandList();
|
|---|
| 277 | CommandList* loop = new CommandList();
|
|---|
| 278 | CommandList* finalize = new CommandList();
|
|---|
| 279 |
|
|---|
| 280 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 281 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 282 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 283 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 284 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| [dfed1c] | 285 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 286 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| 287 |
|
|---|
| 288 | AddCycleGamma(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 289 |
|
|---|
| [dfed1c] | 290 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 291 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 292 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 293 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 294 |
|
|---|
| 295 | finalize->AddCommand("ExportSolution");
|
|---|
| 296 |
|
|---|
| 297 | init->Register("COMMANDLIST_INIT");
|
|---|
| 298 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 299 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | static void SetFullApproximationSchemePeriodicDebug(int minLevel, int maxLevel, int gamma)
|
|---|
| 303 | {
|
|---|
| 304 | CommandList* init = new CommandList();
|
|---|
| 305 | CommandList* loop = new CommandList();
|
|---|
| 306 | CommandList* finalize = new CommandList();
|
|---|
| 307 |
|
|---|
| 308 | init->AddCommand("ClearGrid", "RHS");
|
|---|
| 309 | init->AddCommand("ClearGrid", "SOL");
|
|---|
| 310 | init->AddCommand("ImportRightHandSide");
|
|---|
| [dfed1c] | 311 | init->AddCommand("ForceDiscreteCompatibility");
|
|---|
| [48b662] | 312 | init->AddCommand("CheckConsistency", "RHS");
|
|---|
| [dfed1c] | 313 | init->AddCommand("InitializeIterationCounter");
|
|---|
| [48b662] | 314 | init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
|
|---|
| [dfed1c] | 315 | init->AddCommand("PrintAllSettings");
|
|---|
| [48b662] | 316 |
|
|---|
| 317 | AddCycleGammaDebug(*loop, maxLevel-minLevel+1, gamma);
|
|---|
| 318 |
|
|---|
| [dfed1c] | 319 | loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
|
|---|
| 320 | loop->AddCommand("CheckResidual", "RESIDUAL");
|
|---|
| 321 | loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
|
|---|
| [48b662] | 322 | loop->AddCommand("CheckIterationCounter");
|
|---|
| 323 |
|
|---|
| 324 | finalize->AddCommand("ExportSolution");
|
|---|
| 325 |
|
|---|
| 326 | init->Register("COMMANDLIST_INIT");
|
|---|
| 327 | loop->Register("COMMANDLIST_LOOP");
|
|---|
| 328 | finalize->Register("COMMANDLIST_FINALIZE");
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 | private:
|
|---|
| 332 | static void AddCycleGamma(CommandList& list, int numLevels, int gamma)
|
|---|
| 333 | {
|
|---|
| 334 | for (int i=0; i<numLevels-1; i++) {
|
|---|
| 335 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 336 | list.AddCommand("Restrict");
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | list.AddCommand("Solve");
|
|---|
| 340 |
|
|---|
| 341 | for (int i=1; i<gamma; i++) {
|
|---|
| 342 |
|
|---|
| 343 | for (int j=0; j<numLevels-2; j++) {
|
|---|
| 344 |
|
|---|
| 345 | for (int k=0; k<=j; k++) {
|
|---|
| 346 | list.AddCommand("Prolongate");
|
|---|
| 347 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | for (int k=0; k<=j; k++) {
|
|---|
| 351 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 352 | list.AddCommand("Restrict");
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | list.AddCommand("Solve");
|
|---|
| 356 |
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| 359 | for (int j=numLevels-4; j>=0; j--) {
|
|---|
| 360 |
|
|---|
| 361 | for (int k=0; k<=j; k++) {
|
|---|
| 362 | list.AddCommand("Prolongate");
|
|---|
| 363 | list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | for (int k=0; k<=j; k++) {
|
|---|
| 367 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 368 | list.AddCommand("Restrict");
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | list.AddCommand("Solve");
|
|---|
| 372 | }
|
|---|
| 373 |
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 | for (int i=0; i<numLevels-1; i++) {
|
|---|
| 377 | list.AddCommand("Prolongate");
|
|---|
| 378 | list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
|
|---|
| 379 | }
|
|---|
| 380 | }
|
|---|
| 381 |
|
|---|
| 382 | static void AddCycleGammaDebug(CommandList& list, int numLevels, int gamma)
|
|---|
| 383 | {
|
|---|
| 384 | for (int i=0; i<numLevels-1; i++) {
|
|---|
| 385 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 386 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 387 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 388 | list.AddCommand("PrintDefect");
|
|---|
| 389 | list.AddCommand("Restrict");
|
|---|
| 390 | }
|
|---|
| 391 |
|
|---|
| 392 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 393 | list.AddCommand("Solve");
|
|---|
| [dfed1c] | 394 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 395 | list.AddCommand("PrintDefect");
|
|---|
| [48b662] | 396 |
|
|---|
| 397 | for (int i=1; i<gamma; i++) {
|
|---|
| 398 |
|
|---|
| 399 | for (int j=0; j<numLevels-2; j++) {
|
|---|
| 400 |
|
|---|
| 401 | for (int k=0; k<=j; k++) {
|
|---|
| 402 | list.AddCommand("Prolongate");
|
|---|
| 403 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 404 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 405 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 406 | list.AddCommand("PrintDefect");
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | for (int k=0; k<=j; k++) {
|
|---|
| 410 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 411 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 412 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 413 | list.AddCommand("PrintDefect");
|
|---|
| 414 | list.AddCommand("Restrict");
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 418 | list.AddCommand("Solve");
|
|---|
| 419 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 420 | list.AddCommand("PrintDefect");
|
|---|
| 421 |
|
|---|
| 422 | }
|
|---|
| 423 |
|
|---|
| 424 | for (int j=numLevels-4; j>=0; j--) {
|
|---|
| 425 |
|
|---|
| 426 | for (int k=0; k<=j; k++) {
|
|---|
| 427 | list.AddCommand("Prolongate");
|
|---|
| 428 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 429 | list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
|
|---|
| 430 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 431 | list.AddCommand("PrintDefect");
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | for (int k=0; k<=j; k++) {
|
|---|
| 435 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 436 | list.AddCommand("Smooth", "PRESMOOTHSTEPS");
|
|---|
| 437 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 438 | list.AddCommand("PrintDefect");
|
|---|
| 439 | list.AddCommand("Restrict");
|
|---|
| 440 | }
|
|---|
| 441 |
|
|---|
| 442 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 443 | list.AddCommand("Solve");
|
|---|
| 444 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 445 | list.AddCommand("PrintDefect");
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | }
|
|---|
| 449 |
|
|---|
| 450 | for (int i=0; i<numLevels-1; i++) {
|
|---|
| 451 | list.AddCommand("Prolongate");
|
|---|
| 452 | list.AddCommand("PrintGrid", "RHS");
|
|---|
| 453 | list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
|
|---|
| 454 | list.AddCommand("PrintGrid", "SOL");
|
|---|
| 455 | list.AddCommand("PrintDefect");
|
|---|
| 456 | }
|
|---|
| 457 | }
|
|---|
| 458 | };
|
|---|
| 459 |
|
|---|
| 460 | }
|
|---|
| 461 |
|
|---|
| 462 | #endif /* TECHNIQUES_HPP_ */
|
|---|