Changeset 36d56c for src/units/particle/bspline.hpp
- Timestamp:
- May 11, 2012, 7:45:30 PM (14 years ago)
- Children:
- 2a5451
- Parents:
- 952298
- File:
-
- 1 edited
-
src/units/particle/bspline.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/units/particle/bspline.hpp
r952298 r36d56c 45 45 { 46 46 public: 47 BSpline(const vmg_float& width);47 BSpline(const int& near_field_cells, const vmg_float& h); 48 48 49 49 vmg_float EvaluateSpline(const vmg_float& val) const … … 55 55 } 56 56 57 void SetSpline(Grid& grid, const Particle& p , const int& near_field_cells) const57 void SetSpline(Grid& grid, const Particle& p) const 58 58 { 59 59 assert(p.Pos().X() >= grid.Extent().Begin().X() && p.Pos().X() < grid.Extent().End().X()); … … 61 61 assert(p.Pos().Z() >= grid.Extent().Begin().Z() && p.Pos().Z() < grid.Extent().End().Z()); 62 62 63 std::vector<vmg_float> vals(Helper::intpow(2*near_field_cells+1,3)); 63 vmg_float* vals = new vmg_float[Helper::intpow(2*near_field_cells+1,3)]; 64 64 65 vmg_float temp_val; 65 66 vmg_float int_val = 0.0; … … 86 87 const vmg_float pos_beg_z = p.Pos().Z() - grid.Extent().Begin().Z() - grid.Extent().MeshWidth().Z() * (index_global_z - near_field_cells); 87 88 88 const vmg_float h_x = grid.Extent().MeshWidth().X();89 const vmg_float h_y = grid.Extent().MeshWidth().Y();90 const vmg_float h_z = grid.Extent().MeshWidth().Z();89 const vmg_float& h_x = grid.Extent().MeshWidth().X(); 90 const vmg_float& h_y = grid.Extent().MeshWidth().Y(); 91 const vmg_float& h_z = grid.Extent().MeshWidth().Z(); 91 92 92 93 // Iterate over all grid points which lie in the support of the interpolating B-Spline 93 94 vmg_float dir_x, dir_y, dir_z; 95 dir_x = pos_beg_x; 94 vmg_float dir_x = pos_beg_x; 96 95 for (int i=-1*near_field_cells; i<=near_field_cells; ++i) { 97 dir_y = pos_beg_y;96 vmg_float dir_y = pos_beg_y; 98 97 for (int j=-1*near_field_cells; j<=near_field_cells; ++j) { 99 dir_z = pos_beg_z;98 vmg_float dir_z = pos_beg_z; 100 99 for (int k=-1*near_field_cells; k<=near_field_cells; ++k) { 101 100 … … 123 122 index_local_z + k) += vals[c++] * int_val; 124 123 124 delete [] vals; 125 125 } 126 126 … … 153 153 std::vector<vmg_float> intervals; 154 154 155 vmg_float R; 155 const vmg_float R; 156 const int near_field_cells; 156 157 }; 157 158
Note:
See TracChangeset
for help on using the changeset viewer.
