Changeset 894a5f for src/comm/comm.cpp


Ignore:
Timestamp:
Feb 2, 2012, 1:58:12 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
32ff22
Parents:
01be70
Message:

Parallel performance update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1314 5161e1c8-67bf-11de-9fd5-51895aff932f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/comm/comm.cpp

    r01be70 r894a5f  
    4949
    5050  for (grid_iter=rhs().Iterators().Local().Begin(); grid_iter!=rhs().Iterators().Local().End(); ++grid_iter) {
    51 
    5251    val = rhs().GetVal(*grid_iter) - prefactor * A.GetDiag() * sol().GetVal(*grid_iter);
    53 
    5452    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());
    5756    norm += val*val;
    58 
    5957  }
    6058
     
    6462}
    6563
    66 void Comm::InitComm()
     64Grid& Comm::GetParticleGrid()
    6765{
     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;
    68104}
    69105
     
    71107{
    72108  delete dd;
     109  delete particle_grid;
    73110}
    74111
Note: See TracChangeset for help on using the changeset viewer.