- Timestamp:
- May 11, 2012, 7:45:30 PM (14 years ago)
- Children:
- 2a5451
- Parents:
- 952298
- Location:
- src/units/particle
- Files:
-
- 4 edited
-
bspline.cpp (modified) (2 diffs)
-
bspline.hpp (modified) (6 diffs)
-
interface_particles.cpp (modified) (1 diff)
-
interface_particles.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/units/particle/bspline.cpp
r952298 r36d56c 46 46 using namespace VMG; 47 47 48 Particle::BSpline::BSpline(const vmg_float& width) :48 Particle::BSpline::BSpline(const int& near_field_cells, const vmg_float& h) : 49 49 spline_nom((BSPLINE_DEGREE+1)/2), 50 50 spline_denom((BSPLINE_DEGREE+1)/2), … … 54 54 field_denom((BSPLINE_DEGREE+1)/2), 55 55 intervals((BSPLINE_DEGREE+1)/2), 56 R(width) 56 R(near_field_cells*h), 57 near_field_cells(near_field_cells) 57 58 { 58 59 for (unsigned int i=0; i<intervals.size(); ++i) -
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 -
src/units/particle/interface_particles.cpp
r952298 r36d56c 96 96 97 97 for (iter=particles.begin(); iter!=particles.end(); ++iter) 98 spl.SetSpline(particle_grid, *iter , near_field_cells);98 spl.SetSpline(particle_grid, *iter); 99 99 100 100 // Communicate charges over halo -
src/units/particle/interface_particles.hpp
r952298 r36d56c 51 51 const int& coarsening_steps, const vmg_float& alpha) : 52 52 Interface(boundary, levelMin, levelMax, box_offset, box_size, coarsening_steps, alpha), 53 spl(near_field_cells *Extent(MaxLevel()).MeshWidth().Max())53 spl(near_field_cells, Extent(MaxLevel()).MeshWidth().Max()) 54 54 {} 55 55
Note:
See TracChangeset
for help on using the changeset viewer.
