- Timestamp:
- Jul 4, 2012, 6:10:39 PM (13 years ago)
- Children:
- 0260d3
- Parents:
- 290aa3
- Location:
- src/units/particle
- Files:
-
- 5 edited
-
comm_mpi_particle.cpp (modified) (1 diff)
-
interface_fcs.cpp (modified) (1 diff)
-
interface_particles.cpp (modified) (1 diff)
-
interpolation.cpp (modified) (4 diffs)
-
particle.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/units/particle/comm_mpi_particle.cpp
r290aa3 ref94e7 218 218 for (vmg_int j=0; j<size_receive[i]; ++j) { 219 219 p[recv_buffer_index[i][j]] = recv_buffer_float[i][4*j]; 220 std::memcpy(&f[ recv_buffer_index[i][j]], &recv_buffer_float[i][4*j+1], 3*sizeof(vmg_float));220 std::memcpy(&f[3*recv_buffer_index[i][j]], &recv_buffer_float[i][4*j+1], 3*sizeof(vmg_float)); 221 221 } 222 222 #endif -
src/units/particle/interface_fcs.cpp
r290aa3 ref94e7 221 221 const Grid& grid = multigrid(multigrid.MaxLevel()); 222 222 223 int error_code ;223 int error_code = 0; 224 224 225 225 if (!grid.Global().LocalSize().IsComponentwiseGreater(near_field_cells)) 226 226 error_code = 1; 227 else 228 error_code = 0; 229 230 error_code = MG::GetComm()->GlobalMax(error_code); 231 232 return error_code; 227 228 return MG::GetComm()->GlobalMax(error_code); 233 229 } 234 230 -
src/units/particle/interface_particles.cpp
r290aa3 ref94e7 179 179 for (p1=lc(i,j,k).begin(); p1!=lc(i,j,k).end(); ++p1) { 180 180 181 // Interpolate long-range part of potential and electric field 181 182 ip.Evaluate(**p1); 183 184 // Subtract self-induced potential 182 185 (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero(); 183 (*p1)->Field() *= 0.5;184 186 185 187 #ifdef DEBUG_OUTPUT -
src/units/particle/interpolation.cpp
r290aa3 ref94e7 30 30 #include "units/particle/particle.hpp" 31 31 32 #include "mg.hpp" 33 #include "comm/comm.hpp" 34 32 35 using namespace VMG; 33 36 … … 54 57 Index i; 55 58 56 const Index begin = index - deg/2 - 1;59 const Index begin = index - deg/2; 57 60 58 61 h = grid.Extent().MeshWidth(); … … 105 108 void Particle::Interpolation::Evaluate(Particle& p) 106 109 { 107 Vector offset; 110 const Vector& pos = p.Pos(); 111 vmg_float& pot = p.Pot(); 112 Vector& field = p.Field(); 108 113 109 const Vector& pos = p.Pos(); 110 vmg_float& pot = p.Pot(); 111 Vector& field = p.Field(); 114 pot = 0.0; 115 field = 0.0; 112 116 113 pot = 0.0; 114 field = 0.0; 115 117 Vector offset = pos - pos_begin; 116 118 buffer[0] = 1.0; 117 offset = pos - pos_begin;118 for (int i=1; i<deg_1; ++i) {119 buffer[i] = buffer[i-1] * offset;120 offset -= h;121 }122 123 offset = pos - pos_begin;124 119 for (int i=0; i<deg; ++i) { 120 buffer[i+1] = buffer[i] * offset; 125 121 for (int j=0; j<i; ++j) 126 122 buffer_diff[i][j] = buffer_diff[i-1][j] * offset; … … 145 141 field[2] -= _access_coeff(i, j, k+1) * buffer[i][0] * buffer[j][1] * buffer_diff[k][0][2]; 146 142 } 147 148 143 } 149 144 -
src/units/particle/particle.hpp
r290aa3 ref94e7 40 40 { 41 41 public: 42 Particle() : 43 x_(0.0), 44 f_(0.0), 45 q_(0.0), 46 p_(0.0), 47 rank_(-1), 48 index_(-1) 49 {} 50 42 51 Particle(const vmg_float* x, const vmg_float& q) : 43 52 x_(x),
Note:
See TracChangeset
for help on using the changeset viewer.
