Changeset 894a5f for src/comm/comm.cpp
- Timestamp:
- Feb 2, 2012, 1:58:12 PM (14 years ago)
- Children:
- 32ff22
- Parents:
- 01be70
- File:
-
- 1 edited
-
src/comm/comm.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/comm/comm.cpp
r01be70 r894a5f 49 49 50 50 for (grid_iter=rhs().Iterators().Local().Begin(); grid_iter!=rhs().Iterators().Local().End(); ++grid_iter) { 51 52 51 val = rhs().GetVal(*grid_iter) - prefactor * A.GetDiag() * sol().GetVal(*grid_iter); 53 54 52 for (stencil_iter=A.begin(); stencil_iter!=A.end(); ++stencil_iter) 55 val -= prefactor * stencil_iter->Val() * sol().GetVal(*grid_iter + stencil_iter->Disp()); 56 53 val -= prefactor * stencil_iter->Val() * sol().GetVal(grid_iter->X() + stencil_iter->Disp().X(), 54 grid_iter->Y() + stencil_iter->Disp().Y(), 55 grid_iter->Z() + stencil_iter->Disp().Z()); 57 56 norm += val*val; 58 59 57 } 60 58 … … 64 62 } 65 63 66 void Comm::InitComm()64 Grid& Comm::GetParticleGrid() 67 65 { 66 if (particle_grid != NULL) 67 return *particle_grid; 68 69 const Multigrid& multigrid = *MG::GetRhs(); 70 const Grid& grid = multigrid(multigrid.GlobalMaxLevel()); 71 LocalIndices local = grid.Local(); 72 73 const int& near_field_cells = MG::GetFactory().GetObjectStorageVal<int>("PARTICLE_NEAR_FIELD_CELLS"); 74 75 // We don't need a boundary on this grid 76 local.End() -= local.Begin(); 77 local.Begin() = 0; 78 local.BoundaryBegin1() = local.BoundaryEnd1() = 0; 79 local.BoundaryBegin2() = local.BoundaryEnd2() = 0; 80 81 // Set grid size of intermediate temporary grid 82 for (int i=0; i<3; ++i) { 83 84 if (local.HasHalo1()[i]) { 85 local.HaloBegin1()[i] = 0; 86 local.HaloEnd1()[i] = local.Begin()[i] = near_field_cells+1; 87 local.End()[i] = local.Begin()[i] + local.Size()[i]; 88 } 89 90 if (local.HasHalo2()[i]) { 91 local.HaloBegin2()[i] = local.End()[i]; 92 local.HaloEnd2()[i] = local.HaloBegin2()[i] + near_field_cells+1; 93 } 94 95 } 96 97 local.SizeTotal() = local.Size() + 98 local.HaloEnd1() - local.HaloBegin1() + 99 local.HaloEnd2() - local.HaloBegin2(); 100 101 particle_grid = new Grid(grid.Global(), local, grid.Extent()); 102 103 return *particle_grid; 68 104 } 69 105 … … 71 107 { 72 108 delete dd; 109 delete particle_grid; 73 110 } 74 111
Note:
See TracChangeset
for help on using the changeset viewer.
