Changeset 36d56c for src


Ignore:
Timestamp:
May 11, 2012, 7:45:30 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
2a5451
Parents:
952298
Message:

Improve serial performance.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1815 5161e1c8-67bf-11de-9fd5-51895aff932f

Location:
src/units/particle
Files:
4 edited

Legend:

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

    r952298 r36d56c  
    4646using namespace VMG;
    4747
    48 Particle::BSpline::BSpline(const vmg_float& width) :
     48Particle::BSpline::BSpline(const int& near_field_cells, const vmg_float& h) :
    4949  spline_nom((BSPLINE_DEGREE+1)/2),
    5050  spline_denom((BSPLINE_DEGREE+1)/2),
     
    5454  field_denom((BSPLINE_DEGREE+1)/2),
    5555  intervals((BSPLINE_DEGREE+1)/2),
    56   R(width)
     56  R(near_field_cells*h),
     57  near_field_cells(near_field_cells)
    5758{
    5859  for (unsigned int i=0; i<intervals.size(); ++i)
  • src/units/particle/bspline.hpp

    r952298 r36d56c  
    4545{
    4646public:
    47   BSpline(const vmg_float& width);
     47  BSpline(const int& near_field_cells, const vmg_float& h);
    4848
    4949  vmg_float EvaluateSpline(const vmg_float& val) const
     
    5555  }
    5656
    57   void SetSpline(Grid& grid, const Particle& p, const int& near_field_cells) const
     57  void SetSpline(Grid& grid, const Particle& p) const
    5858  {
    5959    assert(p.Pos().X() >= grid.Extent().Begin().X() && p.Pos().X() < grid.Extent().End().X());
     
    6161    assert(p.Pos().Z() >= grid.Extent().Begin().Z() && p.Pos().Z() < grid.Extent().End().Z());
    6262
    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
    6465    vmg_float temp_val;
    6566    vmg_float int_val = 0.0;
     
    8687    const vmg_float pos_beg_z = p.Pos().Z() - grid.Extent().Begin().Z() - grid.Extent().MeshWidth().Z() * (index_global_z - near_field_cells);
    8788
    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();
    9192
    9293    // 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;
    9695    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;
    9897      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;
    10099        for (int k=-1*near_field_cells; k<=near_field_cells; ++k) {
    101100
     
    123122               index_local_z + k) += vals[c++] * int_val;
    124123
     124    delete [] vals;
    125125  }
    126126
     
    153153  std::vector<vmg_float> intervals;
    154154
    155   vmg_float R;
     155  const vmg_float R;
     156  const int near_field_cells;
    156157};
    157158
  • src/units/particle/interface_particles.cpp

    r952298 r36d56c  
    9696
    9797  for (iter=particles.begin(); iter!=particles.end(); ++iter)
    98     spl.SetSpline(particle_grid, *iter, near_field_cells);
     98    spl.SetSpline(particle_grid, *iter);
    9999
    100100  // Communicate charges over halo
  • src/units/particle/interface_particles.hpp

    r952298 r36d56c  
    5151                     const int& coarsening_steps, const vmg_float& alpha) :
    5252    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())
    5454  {}
    5555
Note: See TracChangeset for help on using the changeset viewer.