Changeset f57182 for src/level/level_operator_fas.cpp
- Timestamp:
- Mar 30, 2013, 2:44:52 PM (13 years ago)
- Children:
- 8180d8
- Parents:
- d13e27
- git-author:
- Julian Iseringhausen <isering@…> (06/11/12 14:02:16)
- git-committer:
- Julian Iseringhausen <isering@…> (03/30/13 14:44:52)
- File:
-
- 1 edited
-
src/level/level_operator_fas.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/level/level_operator_fas.cpp
rd13e27 rf57182 30 30 #endif 31 31 32 #include <limits> 33 32 34 #include "base/discretization.hpp" 35 #include "base/helper.hpp" 33 36 #include "base/index.hpp" 34 37 #include "comm/comm.hpp" … … 56 59 Grid& rhs_c_undist = comm.GetCoarserGrid(rhs); 57 60 61 Index begin_c = rhs_c_undist.Local().FinerBegin(); 62 Index end_c = rhs_c_undist.Local().FinerEnd(); 63 58 64 Index begin_f = rhs_f.Local().Begin(); 59 65 Index end_f = rhs_f.Local().End(); 60 66 61 67 if (rhs_c_undist.Global().BoundaryType() == GlobalCoarsened) { 68 begin_c += rhs_c_undist.Local().BoundarySize1(); 69 end_c -= rhs_c_undist.Local().BoundarySize2(); 62 70 begin_f += rhs_f.Local().BoundarySize1(); 63 71 end_f -= rhs_f.Local().BoundarySize2(); 64 72 } 65 73 74 Helper::AssertVectorsEqual(rhs_c_undist.GetSpatialPos(begin_c), rhs_f.GetSpatialPos(begin_f)); 75 66 76 const GridIteratorSet bounds_f(begin_f, end_f); 67 const GridIteratorSet bounds_c(rhs_c_undist.Local().FinerBegin(), rhs_c_undist.Local().FinerEnd()); 77 const GridIteratorSet bounds_c(begin_c, end_c); 78 79 assert(bounds_c.Begin().GetEnd()-bounds_c.Begin().GetBegin() == ((bounds_f.Begin().GetEnd()-bounds_f.Begin().GetBegin())-1)/2+1); 68 80 69 81 const Stencil& op_res = OperatorRestrict(); … … 75 87 comm.CommToGhosts(sol_f); 76 88 comm.CommSubgrid(sol_c_dist, sol_c_undist, 0); 89 comm.CommSubgrid(rhs_c_dist, rhs_c_undist, 0); 77 90 78 91 MG::GetDiscretization()->SetInnerBoundary(sol_f, rhs_f, sol_c_undist); … … 83 96 res_grid->ImportFromResidual(sol_f, rhs_f); 84 97 85 for (iter_f=bounds_f.Begin(), iter_c=bounds_c.Begin(); iter_c!=bounds_c.End(); iter_f+=2, ++iter_c) 98 for (iter_f=bounds_f.Begin(), iter_c=bounds_c.Begin(); iter_c!=bounds_c.End(); iter_f+=2, ++iter_c) { 99 Helper::AssertVectorsEqual(sol_c_undist.GetSpatialPos(*iter_c), sol_f.GetSpatialPos(*iter_f)); 86 100 sol_c_undist(*iter_c) = op_sol.Apply(sol_f, *iter_f); 101 } 87 102 88 for (iter_f=bounds_f.Begin(), iter_c=bounds_c.Begin(); iter_c!=bounds_c.End(); iter_f+=2, ++iter_c) 89 rhs_c_undist(*iter_c) = op_res.Apply(*res_grid, *iter_f); 103 comm.CommToGhosts(sol_c_undist); 104 105 for (iter_f=bounds_f.Begin(), iter_c=bounds_c.Begin(); iter_c!=bounds_c.End(); iter_f+=2, ++iter_c) { 106 Helper::AssertVectorsEqual(rhs_c_undist.GetSpatialPos(*iter_c), (*res_grid).GetSpatialPos(*iter_f)); 107 rhs_c_undist(*iter_c) = op_res.Apply(*res_grid, *iter_f) + prefactor * op_pde.Apply(sol_c_undist, *iter_c); 108 } 109 110 /* 111 if (rhs_c_undist.Global().BoundaryType() == GlobalCoarsened) 112 rhs_c_undist.SetBoundary(sol_c_undist); 113 */ 90 114 91 115 comm.CommSubgrid(sol_c_undist, sol_c_dist, 1); 92 comm.CommToGhosts(sol_c_dist);93 94 116 comm.CommSubgrid(rhs_c_undist, rhs_c_dist, 1); 95 117 … … 98 120 sol_old->SetGrid(sol_c_dist); 99 121 100 for (iter_c=rhs_c_dist.Iterators().Local().Begin(); iter_c!=rhs_c_dist.Iterators().Local().End(); ++iter_c) 101 rhs_c_dist(*iter_c) += prefactor * op_pde.Apply(sol_c_dist, *iter_c); 102 103 comm.CommToGhosts(rhs_c_dist); 122 // comm.CommToGhosts(rhs_c_dist); 104 123 105 124 sol.ToCoarserLevel(); … … 125 144 TempGrid *sol_old = this->GetTempGrid(sol_c.Level()); 126 145 146 Index begin_c = sol_c.Local().FinerBegin(); 147 Index end_c = sol_c.Local().FinerEnd(); 148 127 149 Index begin_f = sol_f_undist.Local().Begin(); 128 150 Index end_f = sol_f_undist.Local().End(); 129 151 130 152 if (sol_c.Global().BoundaryType() == GlobalCoarsened) { 131 begin_f += rhs_f_undist.Local().BoundarySize1(); 132 end_f -= rhs_f_undist.Local().BoundarySize2(); 153 begin_c += sol_c.Local().BoundarySize1(); 154 end_c -= sol_c.Local().BoundarySize2(); 155 begin_f += sol_f_undist.Local().BoundarySize1(); 156 end_f -= sol_f_undist.Local().BoundarySize2(); 133 157 } 134 158 159 Helper::AssertVectorsEqual(sol_c.GetSpatialPos(begin_c), sol_f_undist.GetSpatialPos(begin_f)); 160 135 161 const GridIteratorSet bounds_f(begin_f, end_f); 136 const GridIteratorSet bounds_c( sol_c.Local().FinerBegin(), sol_c.Local().FinerEnd());162 const GridIteratorSet bounds_c(begin_c, end_c); 137 163 164 assert(bounds_c.Begin().GetEnd()-bounds_c.Begin().GetBegin() == ((bounds_f.Begin().GetEnd()-bounds_f.Begin().GetBegin())-1)/2+1); 165 166 167 comm.CommSubgrid(sol_f_dist, sol_f_undist, 0); 138 168 sol_f_undist.ClearHalo(); 139 169 140 170 for (iter_f=bounds_f.Begin(), iter_c=bounds_c.Begin(); iter_f!=bounds_f.End(); iter_f+=2, ++iter_c) { 171 Helper::AssertVectorsEqual(sol_c.GetSpatialPos(*iter_c), sol_f_undist.GetSpatialPos(*iter_f)); 141 172 val = sol_c.GetVal(*iter_c) - sol_old->GetVal(*iter_c); 142 173 sol_f_undist(*iter_f) += op.GetDiag() * val;
Note:
See TracChangeset
for help on using the changeset viewer.
