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