MsmBlockKernel< Vtype, Mtype > Class Template Reference

Inheritance diagram for MsmBlockKernel< Vtype, Mtype >:

MsmBlock List of all members.

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  ) 

Definition at line 2793 of file ComputeMsm.C.

References MsmBlockKernel< Vtype, Mtype >::bd, MsmBlockKernel< Vtype, Mtype >::blockIndex, msm::Map::blockLevel, MsmBlockKernel< Vtype, Mtype >::eh, MsmBlockKernel< Vtype, Mtype >::ehProlongated, MsmBlockKernel< Vtype, Mtype >::init(), msm::Grid< T >::init(), msm::BlockIndex::level, MsmBlockKernel< Vtype, Mtype >::map, ComputeMsmMgr::mapData(), MsmBlockKernel< Vtype, Mtype >::mgrLocal, MsmBlockKernel< Vtype, Mtype >::mgrProxy, msm::BlockIndex::n, msm::BlockDiagram::nrange, msm::BlockDiagram::nrangeCutoff, msm::BlockDiagram::nrangeProlongated, msm::BlockDiagram::nrangeRestricted, MsmBlockKernel< Vtype, Mtype >::qh, and MsmBlockKernel< Vtype, Mtype >::qhRestricted.

02793                                                                        {
02794   blockIndex = bindex;
02795   mgrProxy = CProxy_ComputeMsmMgr(CkpvAccess(BOCclass_group).computeMsmMgr);
02796   mgrLocal = CProxy_ComputeMsmMgr::ckLocalBranch(
02797       CkpvAccess(BOCclass_group).computeMsmMgr);
02798   map = &(mgrLocal->mapData());
02799   bd = &(map->blockLevel[blockIndex.level](blockIndex.n));
02800   qh.init( bd->nrange );
02801   eh.init( bd->nrange );
02802 #ifndef MSM_GRID_CUTOFF_DECOMP
02803   ehCutoff.init( bd->nrangeCutoff );
02804 #endif
02805   qhRestricted.init( bd->nrangeRestricted );
02806   ehProlongated.init( bd->nrangeProlongated );
02807 #ifdef DEBUG_MSM_GRID
02808   printf("MsmBlockKernel level=%d, n=%d %d %d:  constructor\n",
02809       blockIndex.level, blockIndex.n.i, blockIndex.n.j, blockIndex.n.k);
02810 #endif
02811 #ifdef MSM_TIMING
02812   mgrLocal->addTiming();
02813 #endif
02814   init();
02815 } // MsmBlockKernel<Vtype,Mtype>::MsmBlockKernel()

template<class Vtype, class Mtype>
MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel ( CkMigrateMessage *  m  )  [inline]

Definition at line 2758 of file ComputeMsm.C.

02758 { }


Member Function Documentation

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

Definition at line 2819 of file ComputeMsm.C.

References MsmBlockKernel< Vtype, Mtype >::cntRecvsCharge, MsmBlockKernel< Vtype, Mtype >::cntRecvsPotential, MsmBlockKernel< Vtype, Mtype >::eh, MsmBlockKernel< Vtype, Mtype >::ehProlongated, MsmBlockKernel< Vtype, Mtype >::qh, MsmBlockKernel< Vtype, Mtype >::qhRestricted, and msm::Grid< T >::reset().

Referenced by MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlock::sendDownPotential(), and MsmBlock::sendPatch().

02819                                        {
02820   qh.reset(0);
02821   eh.reset(0);
02822 #ifndef MSM_GRID_CUTOFF_DECOMP
02823   ehCutoff.reset(0);
02824 #endif
02825   qhRestricted.reset(0);
02826   ehProlongated.reset(0);
02827   cntRecvsCharge = 0;
02828   cntRecvsPotential = 0;
02829 } // MsmBlockKernel<Vtype,Mtype>::init()

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

Definition at line 2991 of file ComputeMsm.C.

References ComputeMsmMgr::approx, MsmBlockKernel< Vtype, Mtype >::blockIndex, MsmBlockKernel< Vtype, Mtype >::eh, MsmBlockKernel< Vtype, Mtype >::ehProlongated, msm::IndexRange::ia(), msm::IndexRange::ib(), ComputeMsmMgr::IndexOffset, j, msm::IndexRange::ja(), msm::IndexRange::jb(), msm::IndexRange::ka(), msm::IndexRange::kb(), msm::BlockIndex::level, MsmBlockKernel< Vtype, Mtype >::mgrLocal, msm::BlockIndex::n, ComputeMsmMgr::Nstencil, MsmTimer::PROLONGATE, MsmBlockKernel< Vtype, Mtype >::proStencil, and msm::Grid< T >::reset().

Referenced by MsmBlock::prolongation().

02992 {
02993 #ifdef DEBUG_MSM_GRID
02994   printf("MsmBlockKernel level=%d, id=%d %d %d:  prolongation\n",
02995       blockIndex.level, blockIndex.n.i, blockIndex.n.j, blockIndex.n.k);
02996 #endif
02997 
02998 #ifdef MSM_TIMING
02999   double startTime, stopTime;
03000   startTime = CkWallTimer();
03001 #endif
03002 #ifndef MSM_COMM_ONLY
03003   // stencil data for approximating potential on prolongated grid
03004   const int approx = mgrLocal->approx;
03005   const int nstencil = ComputeMsmMgr::Nstencil[approx];
03006   const int *offset = ComputeMsmMgr::IndexOffset[approx];
03007   const msm::Grid<Mtype>& pro = *proStencil;
03008 
03009   // index range for prolongated h grid potentials
03010   int ia1 = ehProlongated.ia();
03011   int ib1 = ehProlongated.ib();
03012   int ja1 = ehProlongated.ja();
03013   int jb1 = ehProlongated.jb();
03014   int ka1 = ehProlongated.ka();
03015   int kb1 = ehProlongated.kb();
03016 
03017   // index range for 2h grid potentials
03018   int ia2 = eh.ia();
03019   int ib2 = eh.ib();
03020   int ja2 = eh.ja();
03021   int jb2 = eh.jb();
03022   int ka2 = eh.ka();
03023   int kb2 = eh.kb();
03024 
03025   // loop over 2h grid
03026   for (int k2 = ka2;  k2 <= kb2;  k2++) {
03027     int k1 = 2 * k2;
03028     for (int j2 = ja2;  j2 <= jb2;  j2++) {
03029       int j1 = 2 * j2;
03030       for (int i2 = ia2;  i2 <= ib2;  i2++) {
03031         int i1 = 2 * i2;
03032 
03033         // loop over stencils on prolongated h grid
03034         for (int k = 0;  k < nstencil;  k++) {
03035           int kn = k1 + offset[k];
03036           if      (kn < ka1) continue;
03037           else if (kn > kb1) break;
03038 
03039           for (int j = 0;  j < nstencil;  j++) {
03040             int jn = j1 + offset[j];
03041             if      (jn < ja1) continue;
03042             else if (jn > jb1) break;
03043 
03044             for (int i = 0;  i < nstencil;  i++) {
03045               int in = i1 + offset[i];
03046               if      (in < ia1) continue;
03047               else if (in > ib1) break;
03048 
03049               ehProlongated(in,jn,kn) += pro(i,j,k) * eh(i2,j2,k2);
03050             }
03051           }
03052         } // end loop over stencils on prolongated h grid
03053 
03054       }
03055     }
03056   } // end loop over 2h grid
03057 #else
03058   ehProlongated.reset(0);
03059 #endif // !MSM_COMM_ONLY
03060 #ifdef MSM_TIMING
03061   stopTime = CkWallTimer();
03062   mgrLocal->msmTiming[MsmTimer::PROLONGATE] += stopTime - startTime;
03063 #endif
03064 } // MsmBlockKernel<Vtype,Mtype>::prolongationKernel()

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

Definition at line 2833 of file ComputeMsm.C.

References ComputeMsmMgr::approx, MsmBlockKernel< Vtype, Mtype >::blockIndex, msm::IndexRange::ia(), msm::IndexRange::ib(), ComputeMsmMgr::IndexOffset, j, msm::IndexRange::ja(), msm::IndexRange::jb(), msm::IndexRange::ka(), msm::IndexRange::kb(), msm::BlockIndex::level, MsmBlockKernel< Vtype, Mtype >::mgrLocal, msm::BlockIndex::n, ComputeMsmMgr::Nstencil, MsmBlockKernel< Vtype, Mtype >::qh, MsmBlockKernel< Vtype, Mtype >::qhRestricted, msm::Grid< T >::reset(), MsmBlockKernel< Vtype, Mtype >::resStencil, and MsmTimer::RESTRICT.

Referenced by MsmBlock::restriction().

02834 {
02835 #ifdef DEBUG_MSM_GRID
02836   printf("MsmBlockKernel level=%d, id=%d %d %d:  restriction\n",
02837       blockIndex.level, blockIndex.n.i, blockIndex.n.j, blockIndex.n.k);
02838 #endif
02839 
02840 #ifdef MSM_TIMING
02841   double startTime, stopTime;
02842   startTime = CkWallTimer();
02843 #endif
02844 
02845 #ifndef MSM_COMM_ONLY
02846   // stencil data for approximating charge on restricted grid
02847   const int approx = mgrLocal->approx;
02848   const int nstencil = ComputeMsmMgr::Nstencil[approx];
02849   const int *offset = ComputeMsmMgr::IndexOffset[approx];
02850   const msm::Grid<Mtype>& res = *resStencil;
02851 
02852   // index range for h grid charges
02853   int ia1 = qh.ia();
02854   int ib1 = qh.ib();
02855   int ja1 = qh.ja();
02856   int jb1 = qh.jb();
02857   int ka1 = qh.ka();
02858   int kb1 = qh.kb();
02859 
02860   // index range for restricted (2h) grid charges
02861   int ia2 = qhRestricted.ia();
02862   int ib2 = qhRestricted.ib();
02863   int ja2 = qhRestricted.ja();
02864   int jb2 = qhRestricted.jb();
02865   int ka2 = qhRestricted.ka();
02866   int kb2 = qhRestricted.kb();
02867 
02868   // reset grid
02869   qhRestricted.reset(0);
02870 
02871   // loop over restricted (2h) grid
02872   for (int k2 = ka2;  k2 <= kb2;  k2++) {
02873     int k1 = 2 * k2;
02874     for (int j2 = ja2;  j2 <= jb2;  j2++) {
02875       int j1 = 2 * j2;
02876       for (int i2 = ia2;  i2 <= ib2;  i2++) {
02877         int i1 = 2 * i2;
02878 
02879         // loop over stencils on h grid
02880         Vtype& q2hsum = qhRestricted(i2,j2,k2);
02881 
02882         for (int k = 0;  k < nstencil;  k++) {
02883           int kn = k1 + offset[k];
02884           if      (kn < ka1) continue;
02885           else if (kn > kb1) break;
02886 
02887           for (int j = 0;  j < nstencil;  j++) {
02888             int jn = j1 + offset[j];
02889             if      (jn < ja1) continue;
02890             else if (jn > jb1) break;
02891 
02892             for (int i = 0;  i < nstencil;  i++) {
02893               int in = i1 + offset[i];
02894               if      (in < ia1) continue;
02895               else if (in > ib1) break;
02896 
02897               q2hsum += res(i,j,k) * qh(in,jn,kn);
02898             }
02899           }
02900         } // end loop over stencils on h grid
02901 
02902       }
02903     }
02904   } // end loop over restricted (2h) grid
02905 #else
02906   qhRestricted.reset(0);
02907 #endif // !MSM_COMM_ONLY
02908 
02909 #ifdef MSM_TIMING
02910   stopTime = CkWallTimer();
02911   mgrLocal->msmTiming[MsmTimer::RESTRICT] += stopTime - startTime;
02912 #endif
02913 } // MsmBlockKernel<Vtype,Mtype>::restrictionKernel()

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.

Referenced by MsmBlock::MsmBlock().

02778     {
02779       resStencil = res;
02780       proStencil = pro;
02781     }


Member Data Documentation

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

Definition at line 2738 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::addPotential(), MsmBlock::gridCutoff(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlock::sendDownPotential(), MsmBlock::sendPatch(), MsmBlock::sendUpCharge(), and MsmBlock::setupSections().

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

Definition at line 2751 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::addPotential(), MsmBlock::gridCutoff(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlockKernel< Vtype, Mtype >::prolongationKernel(), MsmBlockKernel< Vtype, Mtype >::restrictionKernel(), MsmBlock::sendDownPotential(), MsmBlock::sendPatch(), MsmBlock::sendUpCharge(), MsmBlock::setupSections(), and MsmBlock::sumReducedPotential().

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

Definition at line 2749 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), and MsmBlockKernel< Vtype, Mtype >::init().

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

Definition at line 2750 of file ComputeMsm.C.

Referenced by MsmBlock::addPotential(), and MsmBlockKernel< Vtype, Mtype >::init().

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

Definition at line 2740 of file ComputeMsm.C.

Referenced by MsmBlock::addPotential(), MsmBlockKernel< Vtype, Mtype >::init(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlockKernel< Vtype, Mtype >::prolongationKernel(), MsmBlock::sendPatch(), and MsmBlock::sumReducedPotential().

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

Definition at line 2748 of file ComputeMsm.C.

Referenced by MsmBlockKernel< Vtype, Mtype >::init(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlockKernel< Vtype, Mtype >::prolongationKernel(), and MsmBlock::sendDownPotential().

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

Definition at line 2737 of file ComputeMsm.C.

Referenced by MsmBlock::MsmBlock(), and MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel().

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

Definition at line 2736 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::addPotential(), MsmBlock::gridCutoff(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlockKernel< Vtype, Mtype >::prolongationKernel(), MsmBlockKernel< Vtype, Mtype >::restrictionKernel(), MsmBlock::sendDownPotential(), MsmBlock::sendPatch(), MsmBlock::sendUpCharge(), MsmBlock::setupSections(), and MsmBlock::sumReducedPotential().

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

Definition at line 2735 of file ComputeMsm.C.

Referenced by MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), and MsmBlock::sendPatch().

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

Definition at line 2746 of file ComputeMsm.C.

Referenced by MsmBlockKernel< Vtype, Mtype >::prolongationKernel(), and MsmBlockKernel< C1Vector, C1Matrix >::setupStencils().

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

Definition at line 2739 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::gridCutoff(), MsmBlockKernel< Vtype, Mtype >::init(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), and MsmBlockKernel< Vtype, Mtype >::restrictionKernel().

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

Definition at line 2747 of file ComputeMsm.C.

Referenced by MsmBlockKernel< Vtype, Mtype >::init(), MsmBlockKernel< Vtype, Mtype >::MsmBlockKernel(), MsmBlockKernel< Vtype, Mtype >::restrictionKernel(), and MsmBlock::sendUpCharge().

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

Definition at line 2745 of file ComputeMsm.C.

Referenced by MsmBlockKernel< Vtype, Mtype >::restrictionKernel(), and MsmBlockKernel< C1Vector, C1Matrix >::setupStencils().

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

Definition at line 2755 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::gridCutoff(), MsmBlock::sendDownPotential(), MsmBlock::sendPatch(), MsmBlock::sendUpCharge(), and MsmBlock::sumReducedPotential().

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

Definition at line 2753 of file ComputeMsm.C.

Referenced by MsmBlock::addCharge(), MsmBlock::addPotential(), MsmBlock::sendDownPotential(), MsmBlock::sendPatch(), and MsmBlock::sendUpCharge().


The documentation for this class was generated from the following file:
Generated on Thu Nov 23 01:17:19 2017 for NAMD by  doxygen 1.4.7