source: ThirdParty/vmg/src/cycles/cycle.cpp@ 33a694

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since 33a694 was 7faa5c, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit 'de061d9d851257a04e924d4472df4523d33bb08b' as 'ThirdParty/vmg'

  • Property mode set to 100644
File size: 4.3 KB
Line 
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 cycle.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Wed Jun 27 14:45:29 2012
23 *
24 * @brief Base class for multigrid cycles.
25 *
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <libvmg_config.h>
30#endif
31
32#include "base/command_list.hpp"
33#include "cycles/cycle.hpp"
34
35using namespace VMG;
36
37void Cycle::AddCycle(CommandList& list, int numLevels, int gamma)
38{
39 for (int i=0; i<numLevels-1; i++) {
40 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
41 list.AddCommand("Restrict");
42 }
43
44 list.AddCommand("Solve");
45
46 for (int i=1; i<gamma; i++) {
47
48 for (int j=0; j<numLevels-2; j++) {
49
50 for (int k=0; k<=j; k++) {
51 list.AddCommand("Prolongate");
52 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
53 }
54
55 for (int k=0; k<=j; k++) {
56 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
57 list.AddCommand("Restrict");
58 }
59
60 list.AddCommand("Solve");
61
62 }
63
64 for (int j=numLevels-4; j>=0; j--) {
65
66 for (int k=0; k<=j; k++) {
67 list.AddCommand("Prolongate");
68 list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
69 }
70
71 for (int k=0; k<=j; k++) {
72 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
73 list.AddCommand("Restrict");
74 }
75
76 list.AddCommand("Solve");
77 }
78
79 }
80
81 for (int i=0; i<numLevels-1; i++) {
82 list.AddCommand("Prolongate");
83 list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
84 }
85}
86
87void Cycle::AddCycleDebug(CommandList& list, int numLevels, int gamma)
88{
89 for (int i=0; i<numLevels-1; i++) {
90 list.AddCommand("PrintGrid", "RHS");
91 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
92 list.AddCommand("PrintGrid", "SOL");
93 list.AddCommand("PrintDefect");
94 list.AddCommand("Restrict");
95 }
96
97 list.AddCommand("PrintGrid", "RHS");
98 list.AddCommand("Solve");
99 list.AddCommand("PrintGrid", "SOL");
100 list.AddCommand("PrintDefect");
101
102 for (int i=1; i<gamma; i++) {
103
104 for (int j=0; j<numLevels-2; j++) {
105
106 for (int k=0; k<=j; k++) {
107 list.AddCommand("Prolongate");
108 list.AddCommand("PrintGrid", "RHS");
109 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
110 list.AddCommand("PrintGrid", "SOL");
111 list.AddCommand("PrintDefect");
112 }
113
114 for (int k=0; k<=j; k++) {
115 list.AddCommand("PrintGrid", "RHS");
116 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
117 list.AddCommand("PrintGrid", "SOL");
118 list.AddCommand("PrintDefect");
119 list.AddCommand("Restrict");
120 }
121
122 list.AddCommand("PrintGrid", "RHS");
123 list.AddCommand("Solve");
124 list.AddCommand("PrintGrid", "SOL");
125 list.AddCommand("PrintDefect");
126
127 }
128
129 for (int j=numLevels-4; j>=0; j--) {
130
131 for (int k=0; k<=j; k++) {
132 list.AddCommand("Prolongate");
133 list.AddCommand("PrintGrid", "RHS");
134 list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
135 list.AddCommand("PrintGrid", "SOL");
136 list.AddCommand("PrintDefect");
137 }
138
139 for (int k=0; k<=j; k++) {
140 list.AddCommand("PrintGrid", "RHS");
141 list.AddCommand("Smooth", "PRESMOOTHSTEPS");
142 list.AddCommand("PrintGrid", "SOL");
143 list.AddCommand("PrintDefect");
144 list.AddCommand("Restrict");
145 }
146
147 list.AddCommand("PrintGrid", "RHS");
148 list.AddCommand("Solve");
149 list.AddCommand("PrintGrid", "SOL");
150 list.AddCommand("PrintDefect");
151 }
152
153 }
154
155 for (int i=0; i<numLevels-1; i++) {
156 list.AddCommand("Prolongate");
157 list.AddCommand("PrintGrid", "RHS");
158 list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
159 list.AddCommand("PrintGrid", "SOL");
160 list.AddCommand("PrintDefect");
161 }
162}
Note: See TracBrowser for help on using the repository browser.