Changeset 8180d8 for src/units/particle/bspline.hpp
- Timestamp:
- Apr 5, 2013, 12:39:30 PM (13 years ago)
- Children:
- 4a709e
- Parents:
- f57182
- File:
-
- 1 edited
-
src/units/particle/bspline.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/units/particle/bspline.hpp
rf57182 r8180d8 51 51 for (unsigned int i=0; i<intervals.size(); ++i) 52 52 if (val < intervals[i]) 53 return spline_nom[i](val) / spline_denom[i](val);53 return spline_nom[i](val) / spline_denom[i](val); 54 54 return 0.0; 55 55 } … … 67 67 int c = 0; 68 68 69 const int index_global_x = (p.Pos().X() - grid.Extent().Begin().X()) / grid.Extent().MeshWidth().X();70 const int index_global_y = (p.Pos().Y() - grid.Extent().Begin().Y()) / grid.Extent().MeshWidth().Y();71 const int index_global_z = (p.Pos().Z() - grid.Extent().Begin().Z()) / grid.Extent().MeshWidth().Z();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(); 72 72 73 73 assert(index_global_x >= grid.Global().LocalBegin().X() && index_global_x < grid.Global().LocalEnd().X()); … … 83 83 assert(index_local_z >= grid.Local().Begin().Z() && index_local_z < grid.Local().End().Z()); 84 84 85 const vmg_float pos_beg_x = p.Pos().X() - grid.Extent().Begin().X() - grid.Extent().MeshWidth().X() * (index_global_x - near_field_cells);86 const vmg_float pos_beg_y = p.Pos().Y() - grid.Extent().Begin().Y() - grid.Extent().MeshWidth().Y() * (index_global_y - near_field_cells);87 const vmg_float pos_beg_z = p.Pos().Z() - grid.Extent().Begin().Z() - grid.Extent().MeshWidth().Z() * (index_global_z - near_field_cells);85 const vmg_float pos_beg_x = p.Pos().X() - grid.Extent().Begin().X() - grid.Extent().MeshWidth().X() * (index_global_x - grid.Global().GlobalBegin().X() - near_field_cells); 86 const vmg_float pos_beg_y = p.Pos().Y() - grid.Extent().Begin().Y() - grid.Extent().MeshWidth().Y() * (index_global_y - grid.Global().GlobalBegin().Y() - near_field_cells); 87 const vmg_float pos_beg_z = p.Pos().Z() - grid.Extent().Begin().Z() - grid.Extent().MeshWidth().Z() * (index_global_z - grid.Global().GlobalBegin().Z() - near_field_cells); 88 88 89 89 const vmg_float& h_x = grid.Extent().MeshWidth().X(); … … 96 96 vmg_float dir_y = pos_beg_y; 97 97 for (int j=-1*near_field_cells; j<=near_field_cells; ++j) { 98 vmg_float dir_z = pos_beg_z;99 for (int k=-1*near_field_cells; k<=near_field_cells; ++k) {98 vmg_float dir_z = pos_beg_z; 99 for (int k=-1*near_field_cells; k<=near_field_cells; ++k) { 100 100 101 // Compute distance from grid point to particle102 temp_val = EvaluateSpline(std::sqrt(dir_x*dir_x+dir_y*dir_y+dir_z*dir_z));103 vals[c++] = temp_val * p.Charge();104 int_val += temp_val;101 // Compute distance from grid point to particle 102 temp_val = EvaluateSpline(std::sqrt(dir_x*dir_x+dir_y*dir_y+dir_z*dir_z)); 103 vals[c++] = temp_val * p.Charge(); 104 int_val += temp_val; 105 105 106 dir_z -= h_z;107 }108 dir_y -= h_y;106 dir_z -= h_z; 107 } 108 dir_y -= h_y; 109 109 } 110 110 dir_x -= h_x; … … 117 117 for (int i=-1*near_field_cells; i<=near_field_cells; ++i) 118 118 for (int j=-1*near_field_cells; j<=near_field_cells; ++j) 119 for (int k=-1*near_field_cells; k<=near_field_cells; ++k)120 grid(index_local_x + i,121 index_local_y + j,122 index_local_z + k) += vals[c++] * int_val;119 for (int k=-1*near_field_cells; k<=near_field_cells; ++k) 120 grid(index_local_x + i, 121 index_local_y + j, 122 index_local_z + k) += vals[c++] * int_val; 123 123 124 124 delete [] vals; … … 129 129 for (unsigned int i=0; i<intervals.size(); ++i) 130 130 if (val < intervals[i]) 131 return potential_nom[i](val) / potential_denom[i](val);131 return potential_nom[i](val) / potential_denom[i](val); 132 132 return potential_nom.back()(val) / potential_denom.back()(val); 133 133 } … … 137 137 for (unsigned int i=0; i<intervals.size(); ++i) 138 138 if (val < intervals[i]) 139 return field_nom[i](val) / field_denom[i](val);139 return field_nom[i](val) / field_denom[i](val); 140 140 return 0.0; 141 141 }
Note:
See TracChangeset
for help on using the changeset viewer.
