Changeset 8180d8 for src/grid


Ignore:
Timestamp:
Apr 5, 2013, 12:39:30 PM (13 years ago)
Author:
Julian Iseringhausen <julian.iseringhausen@…>
Children:
4a709e
Parents:
f57182
Message:

Merge stashed open boundary stuff.

Location:
src/grid
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/grid/global_grid_partitioning.hpp

    rf57182 r8180d8  
    4444  const Index& Procs() const {return procs;}
    4545  const Index& Size() const {return size;}
    46   const int& PointsMin() const {return points_min;}
    4746
    4847  const Index& GlobalBegin(const Index& pos) const;
     
    5251  std::map<Index, Index> begin, end;
    5352  Index pos, procs, size;
    54   int points_min;
    55 
    5653};
    5754
  • src/grid/grid.cpp

    rf57182 r8180d8  
    6262    iterators = rhs.Iterators();
    6363    father = rhs.Father();
    64 
    65     index_translations = rhs.Indexing();
    6664    level = rhs.Level();
    6765
     
    128126    avg += GetVal(*iter);
    129127
    130   avg = MG::GetComm()->GlobalSum(avg);
    131   avg /= Global().GlobalSize().Product();
     128  avg = MG::GetComm()->GlobalSum(avg) / Global().GlobalSizeNew().Product();
    132129
    133130  MG::GetComm()->PrintOnce(Info, "Global constraint enforcement: %e", avg);
     
    146143    val += GetVal(*iter);
    147144
    148   val = MG::GetComm()->GlobalSum(val) / Global().GlobalSize().Product();
     145  val = MG::GetComm()->GlobalSum(val) / Global().GlobalSizeNew().Product();
    149146
    150147  if (std::abs(val) > std::numeric_limits<vmg_float>::epsilon()) {
     
    248245  eq &= Helper::IsEq(Global().LocalBegin(), rhs.Global().LocalBegin(), "Global().LocalBegin");
    249246  eq &= Helper::IsEq(Global().LocalEnd(), rhs.Global().LocalEnd(), "Global().LocalEnd");
    250   eq &= Helper::IsEq(Global().GlobalSize(), rhs.Global().GlobalSize(), "Global().GlobalSize");
    251247  eq &= Helper::IsEq(Global().LocalSize(), rhs.Global().LocalSize(), "Global().LocalSize");
     248  eq &= Helper::IsEq(Global().GlobalSizeFinest(), rhs.Global().GlobalSizeFinest(), "Global().GlobalSizeFinest");
     249
    252250
    253251  eq &= Helper::IsEq(Local().HaloBegin1(), rhs.Local().HaloBegin1(), "Local().HaloBegin1");
  • src/grid/grid.hpp

    rf57182 r8180d8  
    3030
    3131#include "base/object.hpp"
    32 #include "grid/grid_index_translations.hpp"
    3332#include "grid/grid_iterator.hpp"
    3433#include "grid/grid_iterator_suite.hpp"
     
    4847
    4948  Grid(int level_ = 0, Multigrid* father_ = NULL) :
    50     index_translations(this),
    5149    level(level_),
    5250    father(father_)
     
    6058       int level_ = 0,
    6159       Multigrid* father_ = NULL) :
    62     index_translations(this),
    6360    level(level_),
    6461    global(global_),
     
    7269
    7370  Grid(const Grid& rhs) :
    74     index_translations(rhs.Indexing()),
    7571    level(rhs.Level()),
    7672    global(rhs.Global()),
     
    124120  void ApplyStencil(const Stencil& stencil); ///< Apply stencil to grid
    125121
    126   int GlobalLinearIndex(int x, int y, int z) const;  ///< Compute a unique 1-dimensional global index
     122  int GlobalLinearIndex(const int& x, const int& y, const int& z) const;  ///< Compute a unique 1-dimensional global index
    127123  int GlobalLinearIndex(const Index& index) const;
    128124
     
    131127
    132128  Multigrid* Father() const {return father;}
    133 
    134   virtual vmg_float DebugKnownSolution(Vector x) const {return 0.0;}
    135   vmg_float DebugKnownSolution(Index i) const {return DebugKnownSolution(extent.Begin() + i * extent.MeshWidth());}
    136 
    137   const GridIndexTranslations& Indexing() const {return index_translations;}
    138129
    139130  const int& Level() const {return level;}
     
    146137private:
    147138  void InitGrid();
    148 
    149   GridIndexTranslations index_translations;
    150139
    151140protected:
     
    193182}
    194183
    195 inline int Grid::GlobalLinearIndex(int x, int y, int z) const
     184inline int Grid::GlobalLinearIndex(const int& x, const int& y, const int& z) const
    196185{
    197   return z + global.GlobalSize().Z() * (y + global.GlobalSize().Y() * x);
     186  return z - global.GlobalBegin().X()
     187    + global.GlobalSizeNew().Z() * (y - global.GlobalBegin().Y()
     188    + global.GlobalSizeNew().Y() * (x - global.GlobalBegin().X()));
    198189}
    199190
  • src/grid/grid_index_translations.cpp

    rf57182 r8180d8  
    3131#endif
    3232
    33 #include <cassert>
    34 
    3533#include "base/helper.hpp"
     34#include "grid/grid_double_iterator.hpp"
    3635#include "grid/grid_index_translations.hpp"
    3736#include "grid/grid.hpp"
     
    4039using namespace VMG;
    4140
    42 Index GridIndexTranslations::GlobalToLocal(const Index& index_global) const
     41bool GridIndexTranslations::IsGridPointOf(const Grid& grid, const Index& index_finest)
    4342{
    44   const Index index_local = index_global - Father()->Global().LocalBegin() + Father()->Local().Begin();
    45   return index_local;
     43  assert(grid.Father() != NULL);
     44  return index_finest[0] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0 &&
     45         index_finest[1] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0 &&
     46         index_finest[2] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0;
    4647}
    4748
    48 Index GridIndexTranslations::GlobalToFiner(const Index& index_global)
     49Index GridIndexTranslations::LocalToGlobal(const Grid& grid, const Index& index_local)
    4950{
    50   const Index index_finer = 2 * index_global;
    51   return index_finer;
     51  return index_local - grid.Local().Begin() + grid.Global().LocalBegin();
    5252}
    5353
    54 Index GridIndexTranslations::GlobalToCoarser(const Index& index_global)
     54Index GridIndexTranslations::LocalToGlobalFinest(const Grid& grid, const Index& index_local)
    5555{
    56   assert(index_global % 2 == 0);
    57   const Index index_coarser = index_global / 2;
    58   return index_coarser;
     56  return GlobalToGlobalFinest(grid, LocalToGlobal(grid, index_local));
    5957}
    6058
    61 Index GridIndexTranslations::GlobalToFiner(const Index& index_global, const int& num_levels)
     59Index GridIndexTranslations::GlobalToLocal(const Grid& grid, const Index& index_global)
    6260{
    63   const Index index_finer = Helper::intpow(2, num_levels) * index_global;
    64   return index_finer;
     61  return index_global - grid.Global().LocalBegin() + grid.Local().Begin();
    6562}
    6663
    67 Index GridIndexTranslations::GlobalToCoarser(const Index& index_global, const int& num_levels)
     64Index GridIndexTranslations::GlobalToGlobalFinest(const Grid& grid, const Index& index_global)
    6865{
    69   int quotient = Helper::intpow(2, num_levels);
    70   assert(index_global % quotient == 0);
    71   const Index index_coarser = index_global / quotient;
    72   return index_coarser;
     66  assert(grid.Father() != NULL);
     67  return Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) * index_global;
    7368}
    7469
    75 Index GridIndexTranslations::LocalToGlobal(const Index& index_local) const
     70Index GridIndexTranslations::GlobalFinestToLocal(const Grid& grid, const Index& index_finest)
    7671{
    77   const Index index_global = index_local - Father()->Local().Begin() + Father()->Global().LocalBegin();
    78   return index_global;
     72  return GlobalToLocal(grid, GlobalFinestToGlobal(grid, index_finest));
    7973}
    8074
    81 Index GridIndexTranslations::LocalToFiner(const Index& index_local) const
     75Index GridIndexTranslations::GlobalFinestToGlobal(const Grid& grid, const Index& index_finest)
    8276{
    83   assert(Father() != NULL);
    84   assert(Father()->Father() != NULL);
    85 
    86   const Multigrid& multigrid = *(Father()->Father());
    87 
    88   assert(Father()->Level() < multigrid.MaxLevel());
    89 
    90   const Index index_global_fine = GlobalToFiner(LocalToGlobal(index_local));
    91   const Index index_local_fine = multigrid(Father()->Level()+1).Indexing().GlobalToLocal(index_global_fine);
    92 
    93   return index_local_fine;
     77  assert(grid.Father() != NULL);
     78  assert(IsGridPointOf(grid, index_finest));
     79  return index_finest / Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level());
    9480}
    9581
    96 Index GridIndexTranslations::LocalToCoarser(const Index& index_local) const
     82void GridIndexTranslations::GlobalCoarseToFine(Index& begin, Index& end)
    9783{
    98   assert(Father() != NULL);
    99   assert(Father()->Father() != NULL);
    100 
    101   const Multigrid& multigrid = *(Father()->Father());
    102 
    103   assert(Father()->Level() > multigrid.MinLevel());
    104 
    105   const Index index_global_coarse = GlobalToCoarser(LocalToGlobal(index_local));
    106   const Index index_local_coarse = multigrid(Father()->Level()-1).Indexing().GlobalToLocal(index_global_coarse);
    107 
    108   return index_local_coarse;
     84  for (int j=0; j<3; ++j) {
     85    begin[j] = 2 * begin[j];
     86    end[j] = 2 * (end[j]-1) + 1;
     87  }
    10988}
    11089
    111 Index GridIndexTranslations::FinestGlobalToLocal(const Index& index_finest) const
     90void GridIndexTranslations::GlobalFineToCoarse(Index& begin, Index& end)
    11291{
    113   const Index index_local = GlobalToLocal(FinestGlobalToGlobal(index_finest));
    114   return index_local;
     92  for (int j=0; j<3; ++j) {
     93    begin[j] = Helper::RoundUpToNextMultiple(begin[j], 2) / 2;
     94    end[j] = Helper::RoundDownToNextMultiple(end[j]-1, 2) / 2 + 1;
     95  }
    11596}
    11697
    117 Index GridIndexTranslations::FinestGlobalToGlobal(const Index& index_finest) const
     98void GridIndexTranslations::GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1,
     99                      const Grid& grid_2, GridIteratorSet& bounds_2)
    118100{
    119   const int quotient = Helper::intpow(2, Father()->Father()->MaxLevel() - Father()->Level());
    120   assert(index_finest % quotient == 0);
    121   const Index index_global = index_finest / quotient;
    122   return index_global;
    123 }
     101  assert(grid_1.Father() != NULL);
     102  assert(grid_2.Father() != NULL);
    124103
    125 void GridIndexTranslations::FineToCoarse(Index& begin, Index& end)
    126 {
    127   Index last_point = end - 1;
     104  if (grid_1.Level() == grid_2.Level()) {
     105    const Index begin_global = grid_1.Global()
     106                                     .LocalBegin()
     107                                     .Clamp(grid_2.Global().LocalBegin(), grid_2.Global().LocalEnd());
    128108
    129   for (int j=0; j<3; ++j) {
     109    const Index end_global = grid_1.Global()
     110                                   .LocalEnd()
     111                                   .Clamp(grid_2.Global().LocalBegin(), grid_2.Global().LocalEnd());
    130112
    131     if (begin[j] % 2 == 0)
    132       begin[j] /= 2;
    133     else
    134       begin[j] = (begin[j]+1) / 2;
     113    bounds_1 = GridIteratorSet(GlobalToLocal(grid_1, begin_global), GlobalToLocal(grid_2, end_global));
     114    bounds_2 = GridIteratorSet(GlobalToLocal(grid_2, begin_global), GlobalToLocal(grid_2, end_global));
    135115
    136     if (last_point[j] % 2 == 0)
    137       last_point[j] /= 2;
    138     else
    139       last_point[j] = (last_point[j]-1) / 2;
     116  } else {
     117
     118    const Grid& grid_c = (grid_1.Level() < grid_2.Level() ? grid_1 : grid_2);
     119    const int global_mult = Helper::intpow(2, grid_c.Father()->MaxLevel() - grid_c.Level());
     120
     121    Index begin_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalBegin())
     122                           .Clamp(GlobalToGlobalFinest(grid_2, grid_2.Global().LocalBegin()),
     123                                  GlobalToGlobalFinest(grid_2, grid_2.Global().LocalEnd()-1));
     124
     125    Index end_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalEnd()-1)
     126                         .Clamp(GlobalToGlobalFinest(grid_2, grid_2.Global().LocalBegin()),
     127                                GlobalToGlobalFinest(grid_2, grid_2.Global().LocalEnd()-1));
     128
     129    for (int j=0; j<3; ++j) {
     130      begin_finest[j] = Helper::RoundUpToNextMultiple(begin_finest[j], global_mult);
     131      end_finest[j] = Helper::RoundDownToNextMultiple(end_finest[j], global_mult);
     132    }
     133
     134    bounds_1 = GridIteratorSet(GlobalFinestToLocal(grid_1, begin_finest), GlobalFinestToLocal(grid_1, end_finest)+1);
     135    bounds_2 = GridIteratorSet(GlobalFinestToLocal(grid_2, begin_finest), GlobalFinestToLocal(grid_2, end_finest)+1);
    140136
    141137  }
    142 
    143 
    144   end = last_point + 1;
    145138}
    146 
    147 void GridIndexTranslations::CoarseToFine(Index& begin, Index& end, const Index& size_global)
    148 {
    149   for (int i=0; i<3; ++i) {
    150 
    151     if (size_global[i] % 2 == 0) {
    152 
    153       begin[i] = 2*begin[i];
    154       end[i] = 2*end[i];
    155 
    156     }else {
    157 
    158       if (begin[i] > 0)
    159         begin[i] = 2*begin[i] - 1;
    160       end[i] = std::max(2*end[i] - 1, begin[i]);
    161 
    162     }
    163   }
    164 }
  • src/grid/grid_index_translations.hpp

    rf57182 r8180d8  
    3838class Comm;
    3939class Grid;
     40class GridIteratorSet;
    4041
    4142class GridIndexTranslations
    4243{
    4344public:
    44   GridIndexTranslations(const Grid* father_) :
    45     father(father_)
    46   {}
     45  GridIndexTranslations() {}
    4746
    48   Index GlobalToLocal(const Index& index_global) const;
    49   static Index GlobalToFiner(const Index& index_global);
    50   static Index GlobalToCoarser(const Index& index_global);
     47  static bool IsGridPointOf(const Grid& grid, const Index& index_finest);
    5148
    52   static Index GlobalToFiner(const Index& index_global, const int& num_levels);
    53   static Index GlobalToCoarser(const Index& index_global, const int& num_levels);
     49  static Index LocalToGlobal(const Grid& grid, const Index& index_local);
     50  static Index LocalToGlobalFinest(const Grid& grid, const Index& index_local);
    5451
    55   Index LocalToGlobal(const Index& index_local) const;
    56   Index LocalToFiner(const Index& index_local) const;
    57   Index LocalToCoarser(const Index& index_local) const;
     52  static Index GlobalToLocal(const Grid& grid, const Index& index_global);
     53  static Index GlobalToGlobalFinest(const Grid& grid, const Index& index_global);
    5854
    59   Index FinestGlobalToLocal(const Index& index_finest) const;
    60   Index FinestGlobalToGlobal(const Index& index_finest) const;
     55  static Index GlobalFinestToLocal(const Grid& grid, const Index& index_finest);
     56  static Index GlobalFinestToGlobal(const Grid& grid, const Index& index_finest);
    6157
    62   static void FineToCoarse(Index& begin, Index& end);
    63   static void CoarseToFine(Index& begin, Index& end, const Index& size_global);
     58  static void GlobalCoarseToFine(Index& begin, Index& end);
     59  static void GlobalFineToCoarse(Index& begin, Index& end);
     60
     61  static void GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1,
     62                               const Grid& grid_2, GridIteratorSet& bounds_2);
     63
     64  static void GetInnerBoundary(const Grid& grid_coarse, Index& b1_c, Index& b2_c,
     65                               const Grid& grid_fine,   Index& b1_f, Index& b2_f);
     66
     67
     68
     69
    6470
    6571  static Index EndOffset(const Boundary& boundary)
    6672  {
    67     Index offset;
    68 
    69     for (int i=0; i<3; ++i)
    70       offset[i] = (boundary[i] == Open || boundary[i] == Dirichlet ? 1 : 0);
    71 
    72     return offset;
     73    return Index(boundary[0] == Periodic ? 0 : 1,
     74                 boundary[1] == Periodic ? 0 : 1,
     75                 boundary[2] == Periodic ? 0 : 1);
    7376  }
    74 
    75 protected:
    76   const Grid* Father() const {return father;}
    77 
    78 private:
    79   const Grid* father;
    8077};
    8178
  • src/grid/grid_properties.hpp

    rf57182 r8180d8  
    4141  GlobalIndices() :
    4242    local_begin(0), local_end(0), local_size(0),
    43     global_finer_begin(0), global_finer_end(0), global_finer_size(0),
    44     local_finer_begin(0), local_finer_end(0), local_finer_size(0),
    45     global_size(0),
     43    global_begin(0), global_end(0), global_size(0),
     44    global_begin_finest(0), global_end_finest(0), global_size_finest(0),
    4645    boundary(EmptyGrid)
    4746  {}
     
    4948  GlobalIndices(const GlobalIndices& other) :
    5049    local_begin(other.local_begin), local_end(other.local_end), local_size(other.local_size),
    51     global_finer_begin(other.global_finer_begin), global_finer_end(other.global_finer_end), global_finer_size(other.global_finer_size),
    52     local_finer_begin(other.local_finer_begin), local_finer_end(other.local_finer_end), local_finer_size(other.local_finer_size),
    53     global_size(other.global_size),
     50    global_begin(other.global_begin), global_end(other.global_end), global_size(other.global_size),
     51    global_begin_finest(other.global_begin_finest), global_end_finest(other.global_end_finest), global_size_finest(other.global_size_finest),
    5452    boundary(other.boundary)
    5553  {}
     
    6361  const Index& LocalSize() const {return local_size;}
    6462
    65   Index& GlobalFinerBegin() {return global_finer_begin;}
    66   Index& GlobalFinerEnd() {return global_finer_end;}
    67   Index& GlobalFinerSize() {return global_finer_size;}
     63  Index& GlobalBegin() {return global_begin;}
     64  Index& GlobalEnd() {return global_end;}
     65  Index& GlobalSizeNew() {return global_size;}
    6866
    69   const Index& GlobalFinerBegin() const {return global_finer_begin;}
    70   const Index& GlobalFinerEnd() const {return global_finer_end;}
    71   const Index& GlobalFinerSize() const {return global_finer_size;}
     67  const Index& GlobalBegin() const {return global_begin;}
     68  const Index& GlobalEnd() const {return global_end;}
     69  const Index& GlobalSizeNew() const {return global_size;}
    7270
    73   Index& LocalFinerBegin() {return local_finer_begin;}
    74   Index& LocalFinerEnd() {return local_finer_end;}
    75   Index& LocalFinerSize() {return local_finer_size;}
     71  Index& GlobalBeginFinest() {return global_begin_finest;}
     72  Index& GlobalEndFinest() {return global_end_finest;}
     73  Index& GlobalSizeFinest() {return global_size_finest;}
    7674
    77   const Index& LocalFinerBegin() const {return local_finer_begin;}
    78   const Index& LocalFinerEnd() const {return local_finer_end;}
    79   const Index& LocalFinerSize() const {return local_finer_size;}
    80 
    81   Index& GlobalSize() {return global_size;}
    82   const Index& GlobalSize() const {return global_size;}
     75  const Index& GlobalBeginFinest() const {return global_begin_finest;}
     76  const Index& GlobalEndFinest() const {return global_end_finest;}
     77  const Index& GlobalSizeFinest() const {return global_size_finest;}
    8378
    8479  BT& BoundaryType() {return boundary;}
     
    8782private:
    8883  Index local_begin, local_end, local_size;
    89   Index global_finer_begin, global_finer_end, global_finer_size;
    90   Index local_finer_begin, local_finer_end, local_finer_size;
    91   Index global_size;
     84  Index global_begin, global_end, global_size;
     85  Index global_begin_finest, global_end_finest, global_size_finest;
    9286  BT boundary;
    9387};
     
    10195    halo_begin_2(0), halo_end_2(0), halo_size_2(0),
    10296    boundary_begin_1(0), boundary_end_1(0), boundary_size_1(0),
    103     boundary_begin_2(0), boundary_end_2(0), boundary_size_2(0),
    104     finer_begin(0), finer_end(0), finer_size(0)
     97    boundary_begin_2(0), boundary_end_2(0), boundary_size_2(0)
    10598  {}
    10699
     
    110103    halo_begin_2(other.halo_begin_2), halo_end_2(other.halo_end_2), halo_size_2(other.halo_size_2),
    111104    boundary_begin_1(other.boundary_begin_1), boundary_end_1(other.boundary_end_1), boundary_size_1(other.boundary_size_1),
    112     boundary_begin_2(other.boundary_begin_2), boundary_end_2(other.boundary_end_2), boundary_size_2(other.boundary_size_2),
    113     finer_begin(other.finer_begin), finer_end(other.finer_end), finer_size(other.finer_size)
     105    boundary_begin_2(other.boundary_begin_2), boundary_end_2(other.boundary_end_2), boundary_size_2(other.boundary_size_2)
    114106  {}
    115107
     
    156148  const Index& BoundarySize2() const {return boundary_size_2;}   ///< Size of boundary
    157149
    158   Index& FinerBegin() {return finer_begin;}
    159   Index& FinerEnd() {return finer_end;}
    160   Index& FinerSize() {return finer_size;}
    161 
    162   const Index& FinerBegin() const {return finer_begin;}
    163   const Index& FinerEnd() const {return finer_end;}
    164   const Index& FinerSize() const {return finer_size;}
    165 
    166   bool HasFinerGrid() const {return static_cast<bool>(finer_size.Product());}
    167 
    168150private:
    169151  Index begin, end, size, size_total;
     
    172154  Index boundary_begin_1, boundary_end_1, boundary_size_1;
    173155  Index boundary_begin_2, boundary_end_2, boundary_size_2;
    174   Index finer_begin, finer_end, finer_size;
    175156};
    176157
  • src/grid/is_grid.hpp

    rf57182 r8180d8  
    3131#include "base/object.hpp"
    3232#include "grid/grid.hpp"
    33 #include "grid/grid_index_translations.hpp"
    3433#include "grid/grid_iterator.hpp"
    3534#include "grid/grid_iterator_suite.hpp"
     
    172171inline int IsGrid<T>::GlobalLinearIndex(int x, int y, int z) const
    173172{
    174   return z + global.GlobalSize().Z() * (y + global.GlobalSize().Y() * x);
     173  return z + global.GlobalSizeNew().Z() * (y + global.GlobalSizeNew().Y() * x);
    175174}
    176175
     
    178177inline int IsGrid<T>::GlobalLinearIndex(const Index& index) const
    179178{
    180   return index.Z() + global.GlobalSize().Z() * (index.Y() + global.GlobalSize().Y() * index.X());
     179  return index.Z() + global.GlobalSizeNew().Z() * (index.Y() + global.GlobalSizeNew().Y() * index.X());
    181180}
    182181
  • src/grid/multigrid.cpp

    rf57182 r8180d8  
    100100          }
    101101
    102           if (global_separated[i].LocalEnd()[j] == global_separated[i].GlobalSize()[j]) {
     102          if (global_separated[i].LocalEnd()[j] == global_separated[i].GlobalEnd()[j]) {
    103103            local_l.BoundaryBegin2()[j] = local_l.SizeTotal()[j] - 1;
    104104            local_l.BoundaryEnd2()[j] = local_l.SizeTotal()[j];
     
    139139      local_l.BoundarySize1() = local_l.BoundaryEnd1() - local_l.BoundaryBegin1();
    140140      local_l.BoundarySize2() = local_l.BoundaryEnd2() - local_l.BoundaryBegin2();
    141 
    142       local_l.FinerSize() = global_separated[i].LocalFinerSize();
    143       local_l.FinerBegin() = global_separated[i].LocalFinerBegin() - global_separated[i].LocalBegin() + local_l.HaloSize1();
    144       local_l.FinerEnd() = local_l.FinerBegin() + local_l.FinerSize();
    145 
    146141
    147142    }else {
     
    163158      local_l.BoundaryEnd2() = 0;
    164159      local_l.BoundarySize2() = 0;
    165       local_l.FinerBegin() = 0;
    166       local_l.FinerEnd() = 0;
    167       local_l.FinerSize() = 0;
    168160
    169161    }
  • src/grid/tempgrid.cpp

    rf57182 r8180d8  
    6565  global.LocalEnd() = size;
    6666  global.LocalSize() = size;
    67   global.GlobalFinerBegin() = 0;
    68   global.GlobalFinerEnd() = 0;
    69   global.GlobalFinerSize() = 0;
    70   global.LocalFinerBegin() = 0;
    71   global.LocalFinerEnd() = 0;
    72   global.LocalFinerSize() = 0;
    73   global.GlobalSize() = size;
     67  global.GlobalBegin() = 0;
     68  global.GlobalEnd() = size;
     69  global.GlobalSizeNew() = size;
     70  global.GlobalBeginFinest() = 0;
     71  global.GlobalEndFinest() = size;
     72  global.GlobalSizeFinest() = size;
    7473  global.BoundaryType() = BTUndefined;
    7574
     
    9089  local.BoundaryEnd2() = 0;
    9190  local.BoundarySize2() = 0;
    92   local.FinerBegin() = 0;
    93   local.FinerEnd() = 0;
    94   local.FinerSize() = 0;
    9591
    9692  extent.Begin() = spatial_begin;
     
    116112  level = grid.Level() + 1;
    117113
     114  global.GlobalBegin() = grid_finer.Global().GlobalBegin();
     115  global.GlobalEnd() = grid_finer.Global().GlobalEnd();
     116  global.GlobalSizeNew() = grid_finer.Global().GlobalSizeNew();
     117
     118  global.GlobalBeginFinest() = grid_finer.Global().GlobalBeginFinest();
     119  global.GlobalEndFinest() = grid_finer.Global().GlobalEndFinest();
     120  global.GlobalSizeFinest() = grid_finer.Global().GlobalSizeFinest();
     121
    118122  global.BoundaryType() = grid_finer.Global().BoundaryType();
    119123
    120   global.GlobalFinerBegin() = 0;
    121   global.GlobalFinerEnd() = 0;
    122   global.GlobalFinerSize() = 0;
    123 
    124   global.LocalFinerBegin() = 0;
    125   global.LocalFinerEnd() = 0;
    126   global.LocalFinerSize() = 0;
    127 
    128   global.LocalBegin() = 2 * (grid.Global().LocalFinerBegin() - grid.Global().GlobalFinerBegin());
    129   global.LocalEnd() = 2 * (grid.Global().LocalFinerEnd() - grid.Global().GlobalFinerBegin() - off) + off;
     124  global.LocalBegin() = (2*grid.Global().LocalBegin()).Clamp(global.GlobalBegin(), global.GlobalEnd());
     125  global.LocalEnd() = (2*(grid.Global().LocalEnd()-off)+off).Clamp(global.GlobalBegin(), global.GlobalEnd());
    130126  global.LocalSize() = global.LocalEnd() - global.LocalBegin();
    131127
    132   global.GlobalSize() = 2 * (grid.Global().GlobalFinerSize() - off) + off;
    133 
    134   for (int j=0; j<3; ++j) {
    135 
    136     if (boundary[j] == Dirichlet ||
    137         boundary[j] == Open) {
    138 
    139       if (grid.Global().BoundaryType() == LocallyRefined) {
    140 
    141         global.GlobalSize()[j] += 2;
    142         global.LocalBegin()[j] += 1;
    143         global.LocalEnd()[j] +=1;
    144 
    145       } else if (grid.Global().BoundaryType() == GlobalMax) {
    146 
    147         global.GlobalSize()[j] += 2;
    148         global.LocalBegin()[j] += 1;
    149         global.LocalEnd()[j] +=1;
    150 
    151       }
    152 
    153     } else {
    154 
    155     }
    156 
    157   }
    158 
    159   global.LocalSize() = global.LocalEnd() - global.LocalBegin();
    160128  if (global.LocalSize().Product() == 0) {
    161129    global.LocalBegin() = 0;
     
    164132    global.BoundaryType() = EmptyGrid;
    165133  }
    166 
    167   local.FinerBegin() = 0;
    168   local.FinerEnd() = 0;
    169   local.FinerSize() = 0;
    170134
    171135  local.Begin() = 0;
     
    234198
    235199  const Grid& grid_coarser = (*grid.Father())(grid.Level()-1);
    236   const Index off = GridIndexTranslations::EndOffset(boundary);
    237200
    238201  level = grid.Level() - 1;
    239202
    240   global.GlobalFinerBegin() = grid_coarser.Global().GlobalFinerBegin();
    241   global.GlobalFinerEnd() = grid_coarser.Global().GlobalFinerEnd();
    242   global.GlobalFinerSize() = grid_coarser.Global().GlobalFinerSize();
    243 
    244   global.GlobalSize() = (grid.Global().GlobalSize() - off)/2 + off;
     203  global.GlobalBegin() = grid.Global().GlobalBegin();
     204  global.GlobalEnd() = grid.Global().GlobalEnd();
     205  global.GlobalSizeNew() = grid.Global().GlobalSizeNew();
     206
     207  global.GlobalBeginFinest() = grid.Global().GlobalBeginFinest();
     208  global.GlobalEndFinest() = grid.Global().GlobalEndFinest();
     209  global.GlobalSizeFinest() = grid.Global().GlobalSizeFinest();
     210
    245211  global.BoundaryType() = grid_coarser.Global().BoundaryType();
    246212
    247213  global.LocalBegin() = grid.Global().LocalBegin();
    248214  global.LocalEnd() = grid.Global().LocalEnd();
    249   GridIndexTranslations::FineToCoarse(global.LocalBegin(), global.LocalEnd());
    250 
    251   global.LocalBegin() += grid_coarser.Global().GlobalFinerBegin();
    252   global.LocalEnd() += grid_coarser.Global().GlobalFinerBegin();
    253 
     215  GridIndexTranslations::GlobalFineToCoarse(global.LocalBegin(), global.LocalEnd());
    254216  global.LocalSize() = global.LocalEnd() - global.LocalBegin();
    255217
     
    260222    global.BoundaryType() = EmptyGrid;
    261223  }
    262 
    263   global.LocalFinerBegin() = global.LocalBegin();
    264   global.LocalFinerEnd() = global.LocalEnd();
    265   global.LocalFinerSize() = global.LocalSize();
    266224
    267225  local.SizeTotal() = global.LocalSize();
     
    319277  local.BoundarySize2() = local.BoundaryEnd2() - local.BoundaryBegin2();
    320278
    321   local.FinerBegin() = local.Begin();
    322   local.FinerEnd() = local.End();
    323   local.FinerSize() = local.Size();
    324 
    325279  Extent().Size() = grid.Extent().Size();
    326280  Extent().Begin() = grid.Extent().Begin();
Note: See TracChangeset for help on using the changeset viewer.