Ignore:
Timestamp:
Apr 10, 2012, 1:55:49 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
a40eea
Parents:
d24c2f
Message:

Merge recent changes of the vmg library into ScaFaCos.

Includes a fix for the communication problems on Jugene.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/samples/bspline.hpp

    rd24c2f rac6d04  
    3636  void SetSpline(Grid& grid, const Particle::Particle p, const int& near_field_cells)
    3737  {
     38    assert(p.Pos().X() >= grid.Extent().Begin().X() && p.Pos().X() < grid.Extent().End().X());
     39    assert(p.Pos().Y() >= grid.Extent().Begin().Y() && p.Pos().Y() < grid.Extent().End().Y());
     40    assert(p.Pos().Z() >= grid.Extent().Begin().Z() && p.Pos().Z() < grid.Extent().End().Z());
     41
    3842    Index i, index_global, index_local;
    3943    vmg_float temp_val, length;
     
    4448
    4549    index_global = static_cast<Index>((p.Pos() - grid.Extent().Begin()) / grid.Extent().MeshWidth());
    46     index_local = index_global - grid.Global().BeginLocal() + grid.Local().Begin();
     50    assert(index_global.X() >= grid.Global().LocalBegin().X() && index_global.X() < grid.Global().LocalEnd().X());
     51    assert(index_global.Y() >= grid.Global().LocalBegin().Y() && index_global.Y() < grid.Global().LocalEnd().Y());
     52    assert(index_global.Z() >= grid.Global().LocalBegin().Z() && index_global.Z() < grid.Global().LocalEnd().Z());
     53
     54    index_local = index_global - grid.Global().LocalBegin() + grid.Local().Begin();
     55    assert(index_local.X() >= grid.Local().Begin().X() && index_local.X() < grid.Local().End().X());
     56    assert(index_local.Y() >= grid.Local().Begin().Y() && index_local.Y() < grid.Local().End().Y());
     57    assert(index_local.Z() >= grid.Local().Begin().Z() && index_local.Z() < grid.Local().End().Z());
    4758
    4859    // Iterate over all grid points which lie in the support of the interpolating B-Spline
    49     for (i.X()=-1*near_field_cells-1; i.X()<=near_field_cells+1; ++i.X())
    50       for (i.Y()=-1*near_field_cells-1; i.Y()<=near_field_cells+1; ++i.Y())
    51         for (i.Z()=-1*near_field_cells-1; i.Z()<=near_field_cells+1; ++i.Z()) {
     60    for (i.X()=-1*near_field_cells; i.X()<=near_field_cells; ++i.X())
     61      for (i.Y()=-1*near_field_cells; i.Y()<=near_field_cells; ++i.Y())
     62        for (i.Z()=-1*near_field_cells; i.Z()<=near_field_cells; ++i.Z()) {
    5263
    5364          // Compute distance from grid point to particle
     
    5869          int_val += temp_val;
    5970
     71          assert(temp_val >= 0.0);
     72
    6073        }
    6174
    62     int_val = 1.0 / (Helper::pow(grid.MeshWidth(), 3) * int_val);
     75    // Reciprocal value of the numerically integrated spline
     76    int_val = 1.0 / (int_val * grid.Extent().MeshWidth().Product());
    6377
    6478    iter = vals.begin();
    65 
    66     for (i.X()=-1*near_field_cells-1; i.X()<=near_field_cells+1; ++i.X())
    67       for (i.Y()=-1*near_field_cells-1; i.Y()<=near_field_cells+1; ++i.Y())
    68         for (i.Z()=-1*near_field_cells-1; i.Z()<=near_field_cells+1; ++i.Z())
     79    for (i.X()=-1*near_field_cells; i.X()<=near_field_cells; ++i.X())
     80      for (i.Y()=-1*near_field_cells; i.Y()<=near_field_cells; ++i.Y())
     81        for (i.Z()=-1*near_field_cells; i.Z()<=near_field_cells; ++i.Z())
    6982          grid(index_local+i) += *iter++ * int_val;
    7083
     84    assert(iter == vals.end());
    7185  }
    7286
     
    7993  }
    8094
    81   vmg_float EvaluateDerivative(const Vector& v, const int& dv);
    82 
    83   const vmg_float& GetAntiDerivativeZero() const
     95  const vmg_float& GetAntiDerivativeAtZero() const
    8496  {
    8597    return antid;
Note: See TracChangeset for help on using the changeset viewer.