Ignore:
Timestamp:
Apr 9, 2013, 8:44:10 PM (13 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
b3075a
Parents:
1a1be0
Message:

Fixed position to index conversion errors.# Please enter the commit message for your changes. Lines starting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/units/particle/bspline.hpp

    r1a1be0 r866ac4  
    2828#ifndef BSPLINE_HPP_
    2929#define BSPLINE_HPP_
     30
     31#include <cmath>
    3032
    3133#include "base/helper.hpp"
     
    6769    int c = 0;
    6870
    69     const int index_global_x = grid.Global().GlobalBegin().X() + (p.Pos().X() - grid.Extent().Begin().X()) / grid.Extent().MeshWidth().X();
    70     const int index_global_y = grid.Global().GlobalBegin().Y() + (p.Pos().Y() - grid.Extent().Begin().Y()) / grid.Extent().MeshWidth().Y();
    71     const int index_global_z = grid.Global().GlobalBegin().Z() + (p.Pos().Z() - grid.Extent().Begin().Z()) / grid.Extent().MeshWidth().Z();
     71    const int index_global_x = grid.Global().GlobalBegin().X() + std::floor((p.Pos().X() - grid.Extent().Begin().X()) / grid.Extent().MeshWidth().X());
     72    const int index_global_y = grid.Global().GlobalBegin().Y() + std::floor((p.Pos().Y() - grid.Extent().Begin().Y()) / grid.Extent().MeshWidth().Y());
     73    const int index_global_z = grid.Global().GlobalBegin().Z() + std::floor((p.Pos().Z() - grid.Extent().Begin().Z()) / grid.Extent().MeshWidth().Z());
    7274
    7375    assert(index_global_x >= grid.Global().LocalBegin().X() && index_global_x < grid.Global().LocalEnd().X());
Note: See TracChangeset for help on using the changeset viewer.