NAMD
Public Member Functions | Public Attributes | List of all members
MsmBlockKernel< Vtype, Mtype > Class Template Reference

Public Member Functions

 MsmBlockKernel (const msm::BlockIndex &)
 
 MsmBlockKernel (CkMigrateMessage *m)
 
void init ()
 
void setupStencils (const msm::Grid< Mtype > *res, const msm::Grid< Mtype > *pro)
 
void restrictionKernel ()
 
void prolongationKernel ()
 

Public Attributes

CProxy_ComputeMsmMgr mgrProxy
 
ComputeMsmMgrmgrLocal
 
msm::Mapmap
 
msm::BlockDiagrambd
 
msm::Grid< Vtype > qh
 
msm::Grid< Vtype > eh
 
const msm::Grid< Mtype > * resStencil
 
const msm::Grid< Mtype > * proStencil
 
msm::Grid< Vtype > qhRestricted
 
msm::Grid< Vtype > ehProlongated
 
int cntRecvsCharge
 
int cntRecvsPotential
 
msm::BlockIndex blockIndex
 
msm::Grid< Vtype > subgrid
 
int sequence
 

Detailed Description

template<class Vtype, class Mtype>
class MsmBlockKernel< Vtype, Mtype >

Definition at line 2733 of file ComputeMsm.C.

Constructor & Destructor Documentation

template<class Vtype , class Mtype >
MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel ( const msm::BlockIndex bindex)

Definition at line 2793 of file ComputeMsm.C.

References msm::Map::blockLevel, and ComputeMsmMgr::map.

2793  {
2794  blockIndex = bindex;
2795  mgrProxy = CProxy_ComputeMsmMgr(CkpvAccess(BOCclass_group).computeMsmMgr);
2796  mgrLocal = CProxy_ComputeMsmMgr::ckLocalBranch(
2797  CkpvAccess(BOCclass_group).computeMsmMgr);
2798  map = &(mgrLocal->mapData());
2800  qh.init( bd->nrange );
2801  eh.init( bd->nrange );
2802 #ifndef MSM_GRID_CUTOFF_DECOMP
2803  ehCutoff.init( bd->nrangeCutoff );
2804 #endif
2807 #ifdef DEBUG_MSM_GRID
2808  printf("MsmBlockKernel level=%d, n=%d %d %d: constructor\n",
2810 #endif
2811 #ifdef MSM_TIMING
2812  mgrLocal->addTiming();
2813 #endif
2814  init();
2815 } // MsmBlockKernel<Vtype,Mtype>::MsmBlockKernel()
msm::Map & mapData()
Definition: ComputeMsm.C:447
int k
Definition: MsmMap.h:411
msm::Map * map
Definition: ComputeMsm.C:2737
int i
Definition: MsmMap.h:411
CProxy_ComputeMsmMgr mgrProxy
Definition: ComputeMsm.C:2735
ComputeMsmMgr * mgrLocal
Definition: ComputeMsm.C:2736
msm::BlockIndex blockIndex
Definition: ComputeMsm.C:2751
Array< Grid< BlockDiagram > > blockLevel
Definition: MsmMap.h:956
int j
Definition: MsmMap.h:411
void init(const IndexRange &n)
Definition: MsmMap.h:603
IndexRange nrangeRestricted
Definition: MsmMap.h:913
IndexRange nrange
Definition: MsmMap.h:911
IndexRange nrangeCutoff
Definition: MsmMap.h:912
msm::Grid< Vtype > eh
Definition: ComputeMsm.C:2740
msm::BlockDiagram * bd
Definition: ComputeMsm.C:2738
msm::Grid< Vtype > qh
Definition: ComputeMsm.C:2739
msm::Grid< Vtype > ehProlongated
Definition: ComputeMsm.C:2748
msm::Grid< Vtype > qhRestricted
Definition: ComputeMsm.C:2747
IndexRange nrangeProlongated
Definition: MsmMap.h:914
template<class Vtype, class Mtype>
MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel ( CkMigrateMessage *  m)
inline

Definition at line 2758 of file ComputeMsm.C.

2758 { }

Member Function Documentation

template<class Vtype , class Mtype >
void MsmBlockKernel< Vtype, Mtype >::init ( )

Definition at line 2819 of file ComputeMsm.C.

2819  {
2820  qh.reset(0);
2821  eh.reset(0);
2822 #ifndef MSM_GRID_CUTOFF_DECOMP
2823  ehCutoff.reset(0);
2824 #endif
2825  qhRestricted.reset(0);
2826  ehProlongated.reset(0);
2827  cntRecvsCharge = 0;
2828  cntRecvsPotential = 0;
2829 } // MsmBlockKernel<Vtype,Mtype>::init()
void reset(const T &t)
Definition: MsmMap.h:670
msm::Grid< Vtype > eh
Definition: ComputeMsm.C:2740
msm::Grid< Vtype > qh
Definition: ComputeMsm.C:2739
msm::Grid< Vtype > ehProlongated
Definition: ComputeMsm.C:2748
msm::Grid< Vtype > qhRestricted
Definition: ComputeMsm.C:2747
template<class Vtype , class Mtype >
void MsmBlockKernel< Vtype, Mtype >::prolongationKernel ( )

Definition at line 2991 of file ComputeMsm.C.

References ComputeMsmMgr::approx, msm::IndexRange::ia(), ComputeMsmMgr::IndexOffset, ComputeMsmMgr::Nstencil, and MsmTimer::PROLONGATE.

2992 {
2993 #ifdef DEBUG_MSM_GRID
2994  printf("MsmBlockKernel level=%d, id=%d %d %d: prolongation\n",
2996 #endif
2997 
2998 #ifdef MSM_TIMING
2999  double startTime, stopTime;
3000  startTime = CkWallTimer();
3001 #endif
3002 #ifndef MSM_COMM_ONLY
3003  // stencil data for approximating potential on prolongated grid
3004  const int approx = mgrLocal->approx;
3005  const int nstencil = ComputeMsmMgr::Nstencil[approx];
3006  const int *offset = ComputeMsmMgr::IndexOffset[approx];
3007  const msm::Grid<Mtype>& pro = *proStencil;
3008 
3009  // index range for prolongated h grid potentials
3010  int ia1 = ehProlongated.ia();
3011  int ib1 = ehProlongated.ib();
3012  int ja1 = ehProlongated.ja();
3013  int jb1 = ehProlongated.jb();
3014  int ka1 = ehProlongated.ka();
3015  int kb1 = ehProlongated.kb();
3016 
3017  // index range for 2h grid potentials
3018  int ia2 = eh.ia();
3019  int ib2 = eh.ib();
3020  int ja2 = eh.ja();
3021  int jb2 = eh.jb();
3022  int ka2 = eh.ka();
3023  int kb2 = eh.kb();
3024 
3025  // loop over 2h grid
3026  for (int k2 = ka2; k2 <= kb2; k2++) {
3027  int k1 = 2 * k2;
3028  for (int j2 = ja2; j2 <= jb2; j2++) {
3029  int j1 = 2 * j2;
3030  for (int i2 = ia2; i2 <= ib2; i2++) {
3031  int i1 = 2 * i2;
3032 
3033  // loop over stencils on prolongated h grid
3034  for (int k = 0; k < nstencil; k++) {
3035  int kn = k1 + offset[k];
3036  if (kn < ka1) continue;
3037  else if (kn > kb1) break;
3038 
3039  for (int j = 0; j < nstencil; j++) {
3040  int jn = j1 + offset[j];
3041  if (jn < ja1) continue;
3042  else if (jn > jb1) break;
3043 
3044  for (int i = 0; i < nstencil; i++) {
3045  int in = i1 + offset[i];
3046  if (in < ia1) continue;
3047  else if (in > ib1) break;
3048 
3049  ehProlongated(in,jn,kn) += pro(i,j,k) * eh(i2,j2,k2);
3050  }
3051  }
3052  } // end loop over stencils on prolongated h grid
3053 
3054  }
3055  }
3056  } // end loop over 2h grid
3057 #else
3058  ehProlongated.reset(0);
3059 #endif // !MSM_COMM_ONLY
3060 #ifdef MSM_TIMING
3061  stopTime = CkWallTimer();
3062  mgrLocal->msmTiming[MsmTimer::PROLONGATE] += stopTime - startTime;
3063 #endif
3064 } // MsmBlockKernel<Vtype,Mtype>::prolongationKernel()
void reset(const T &t)
Definition: MsmMap.h:670
int k
Definition: MsmMap.h:411
int ka() const
Definition: MsmMap.h:438
int i
Definition: MsmMap.h:411
static const int IndexOffset[NUM_APPROX][MAX_NSTENCIL_SKIP_ZERO]
Definition: ComputeMsm.C:656
int ia() const
Definition: MsmMap.h:434
ComputeMsmMgr * mgrLocal
Definition: ComputeMsm.C:2736
msm::BlockIndex blockIndex
Definition: ComputeMsm.C:2751
int j
Definition: MsmMap.h:411
static const int Nstencil[NUM_APPROX]
Definition: ComputeMsm.C:652
int kb() const
Definition: MsmMap.h:439
int jb() const
Definition: MsmMap.h:437
msm::Grid< Vtype > eh
Definition: ComputeMsm.C:2740
const msm::Grid< Mtype > * proStencil
Definition: ComputeMsm.C:2746
msm::Grid< Vtype > ehProlongated
Definition: ComputeMsm.C:2748
int ib() const
Definition: MsmMap.h:435
int ja() const
Definition: MsmMap.h:436
template<class Vtype , class Mtype >
void MsmBlockKernel< Vtype, Mtype >::restrictionKernel ( )

Definition at line 2833 of file ComputeMsm.C.

References ComputeMsmMgr::approx, msm::IndexRange::ia(), ComputeMsmMgr::IndexOffset, ComputeMsmMgr::Nstencil, and MsmTimer::RESTRICT.

2834 {
2835 #ifdef DEBUG_MSM_GRID
2836  printf("MsmBlockKernel level=%d, id=%d %d %d: restriction\n",
2838 #endif
2839 
2840 #ifdef MSM_TIMING
2841  double startTime, stopTime;
2842  startTime = CkWallTimer();
2843 #endif
2844 
2845 #ifndef MSM_COMM_ONLY
2846  // stencil data for approximating charge on restricted grid
2847  const int approx = mgrLocal->approx;
2848  const int nstencil = ComputeMsmMgr::Nstencil[approx];
2849  const int *offset = ComputeMsmMgr::IndexOffset[approx];
2850  const msm::Grid<Mtype>& res = *resStencil;
2851 
2852  // index range for h grid charges
2853  int ia1 = qh.ia();
2854  int ib1 = qh.ib();
2855  int ja1 = qh.ja();
2856  int jb1 = qh.jb();
2857  int ka1 = qh.ka();
2858  int kb1 = qh.kb();
2859 
2860  // index range for restricted (2h) grid charges
2861  int ia2 = qhRestricted.ia();
2862  int ib2 = qhRestricted.ib();
2863  int ja2 = qhRestricted.ja();
2864  int jb2 = qhRestricted.jb();
2865  int ka2 = qhRestricted.ka();
2866  int kb2 = qhRestricted.kb();
2867 
2868  // reset grid
2869  qhRestricted.reset(0);
2870 
2871  // loop over restricted (2h) grid
2872  for (int k2 = ka2; k2 <= kb2; k2++) {
2873  int k1 = 2 * k2;
2874  for (int j2 = ja2; j2 <= jb2; j2++) {
2875  int j1 = 2 * j2;
2876  for (int i2 = ia2; i2 <= ib2; i2++) {
2877  int i1 = 2 * i2;
2878 
2879  // loop over stencils on h grid
2880  Vtype& q2hsum = qhRestricted(i2,j2,k2);
2881 
2882  for (int k = 0; k < nstencil; k++) {
2883  int kn = k1 + offset[k];
2884  if (kn < ka1) continue;
2885  else if (kn > kb1) break;
2886 
2887  for (int j = 0; j < nstencil; j++) {
2888  int jn = j1 + offset[j];
2889  if (jn < ja1) continue;
2890  else if (jn > jb1) break;
2891 
2892  for (int i = 0; i < nstencil; i++) {
2893  int in = i1 + offset[i];
2894  if (in < ia1) continue;
2895  else if (in > ib1) break;
2896 
2897  q2hsum += res(i,j,k) * qh(in,jn,kn);
2898  }
2899  }
2900  } // end loop over stencils on h grid
2901 
2902  }
2903  }
2904  } // end loop over restricted (2h) grid
2905 #else
2906  qhRestricted.reset(0);
2907 #endif // !MSM_COMM_ONLY
2908 
2909 #ifdef MSM_TIMING
2910  stopTime = CkWallTimer();
2911  mgrLocal->msmTiming[MsmTimer::RESTRICT] += stopTime - startTime;
2912 #endif
2913 } // MsmBlockKernel<Vtype,Mtype>::restrictionKernel()
void reset(const T &t)
Definition: MsmMap.h:670
int k
Definition: MsmMap.h:411
int ka() const
Definition: MsmMap.h:438
int i
Definition: MsmMap.h:411
static const int IndexOffset[NUM_APPROX][MAX_NSTENCIL_SKIP_ZERO]
Definition: ComputeMsm.C:656
int ia() const
Definition: MsmMap.h:434
ComputeMsmMgr * mgrLocal
Definition: ComputeMsm.C:2736
msm::BlockIndex blockIndex
Definition: ComputeMsm.C:2751
int j
Definition: MsmMap.h:411
static const int Nstencil[NUM_APPROX]
Definition: ComputeMsm.C:652
int kb() const
Definition: MsmMap.h:439
int jb() const
Definition: MsmMap.h:437
msm::Grid< Vtype > qh
Definition: ComputeMsm.C:2739
int ib() const
Definition: MsmMap.h:435
int ja() const
Definition: MsmMap.h:436
msm::Grid< Vtype > qhRestricted
Definition: ComputeMsm.C:2747
const msm::Grid< Mtype > * resStencil
Definition: ComputeMsm.C:2745
template<class Vtype, class Mtype>
void MsmBlockKernel< Vtype, Mtype >::setupStencils ( const msm::Grid< Mtype > *  res,
const msm::Grid< Mtype > *  pro 
)
inline

Definition at line 2774 of file ComputeMsm.C.

2778  {
2779  resStencil = res;
2780  proStencil = pro;
2781  }
const msm::Grid< Mtype > * proStencil
Definition: ComputeMsm.C:2746
const msm::Grid< Mtype > * resStencil
Definition: ComputeMsm.C:2745

Member Data Documentation

template<class Vtype, class Mtype>
msm::BlockDiagram* MsmBlockKernel< Vtype, Mtype >::bd

Definition at line 2738 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::BlockIndex MsmBlockKernel< Vtype, Mtype >::blockIndex

Definition at line 2751 of file ComputeMsm.C.

template<class Vtype, class Mtype>
int MsmBlockKernel< Vtype, Mtype >::cntRecvsCharge

Definition at line 2749 of file ComputeMsm.C.

template<class Vtype, class Mtype>
int MsmBlockKernel< Vtype, Mtype >::cntRecvsPotential

Definition at line 2750 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Grid<Vtype> MsmBlockKernel< Vtype, Mtype >::eh

Definition at line 2740 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Grid<Vtype> MsmBlockKernel< Vtype, Mtype >::ehProlongated

Definition at line 2748 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Map* MsmBlockKernel< Vtype, Mtype >::map

Definition at line 2737 of file ComputeMsm.C.

template<class Vtype, class Mtype>
ComputeMsmMgr* MsmBlockKernel< Vtype, Mtype >::mgrLocal

Definition at line 2736 of file ComputeMsm.C.

template<class Vtype, class Mtype>
CProxy_ComputeMsmMgr MsmBlockKernel< Vtype, Mtype >::mgrProxy

Definition at line 2735 of file ComputeMsm.C.

template<class Vtype, class Mtype>
const msm::Grid<Mtype>* MsmBlockKernel< Vtype, Mtype >::proStencil

Definition at line 2746 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Grid<Vtype> MsmBlockKernel< Vtype, Mtype >::qh

Definition at line 2739 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Grid<Vtype> MsmBlockKernel< Vtype, Mtype >::qhRestricted

Definition at line 2747 of file ComputeMsm.C.

template<class Vtype, class Mtype>
const msm::Grid<Mtype>* MsmBlockKernel< Vtype, Mtype >::resStencil

Definition at line 2745 of file ComputeMsm.C.

template<class Vtype, class Mtype>
int MsmBlockKernel< Vtype, Mtype >::sequence

Definition at line 2755 of file ComputeMsm.C.

template<class Vtype, class Mtype>
msm::Grid<Vtype> MsmBlockKernel< Vtype, Mtype >::subgrid

Definition at line 2753 of file ComputeMsm.C.


The documentation for this class was generated from the following file: