MsmC1HermiteBlock Class Reference

Inheritance diagram for MsmC1HermiteBlock:

MsmBlockKernel< C1Vector, C1Matrix > List of all members.

Public Member Functions

 MsmC1HermiteBlock (int level)
 MsmC1HermiteBlock (CkMigrateMessage *m)
void setupSections ()
void sumReducedPotential (CkReductionMsg *msg)
void addCharge (GridMsg *)
void restriction ()
void sendUpCharge ()
void gridCutoff ()
void addPotential (GridMsg *)
void prolongation ()
void sendDownPotential ()
void sendPatch ()

Public Attributes

CProxySection_MsmC1HermiteGridCutoff msmGridCutoffBroadcast
CProxySection_MsmC1HermiteGridCutoff msmGridCutoffReduction

Detailed Description

Definition at line 3456 of file ComputeMsm.C.


Constructor & Destructor Documentation

MsmC1HermiteBlock::MsmC1HermiteBlock ( int  level  )  [inline]

Definition at line 3464 of file ComputeMsm.C.

References msm::Map::gc_c1hermite, msm::Map::gpro_c1hermite, msm::Map::gres_c1hermite, msm::Map::gridrange, MsmBlockKernel< C1Vector, C1Matrix >::map, and MsmBlockKernel< C1Vector, C1Matrix >::setupStencils().

03464                                  :
03465       MsmBlockKernel<C1Vector,C1Matrix>(
03466           msm::BlockIndex(level,
03467             msm::Ivec(thisIndex.x, thisIndex.y, thisIndex.z))
03468           )
03469     {
03470       int isfirstlevel = (level == 0);
03471       int istoplevel = (level == map->gridrange.len()-1);
03472       const msm::Grid<C1Matrix> *res =
03473         (istoplevel ? NULL : &(map->gres_c1hermite[level]));
03474       const msm::Grid<C1Matrix> *pro =
03475         (isfirstlevel ? NULL : &(map->gpro_c1hermite[level-1]));
03476 #ifndef MSM_GRID_CUTOFF_DECOMP
03477       const msm::Grid<C1Matrix> *gc = &(map->gc_c1hermite[level]);
03478       setupStencils(res, pro, gc);
03479 #else
03480       setupStencils(res, pro);
03481 #endif
03482     }
    MsmC1HermiteBlock(CkMigrateMessage *m) :

MsmC1HermiteBlock::MsmC1HermiteBlock ( CkMigrateMessage *  m  )  [inline]

Definition at line 3483 of file ComputeMsm.C.

03483                                            :
03484       MsmBlockKernel<C1Vector,C1Matrix>(m) { }


Member Function Documentation

void MsmC1HermiteBlock::addCharge ( GridMsg  ) 

Definition at line 3593 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmBlockKernel< C1Vector, C1Matrix >::cntRecvsCharge, MsmTimer::COMM, GridMsg::get(), gridCutoff(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, ComputeMsmMgr::numLevels(), msm::BlockDiagram::numRecvsCharge, MsmBlockKernel< C1Vector, C1Matrix >::qh, restriction(), MsmBlockKernel< C1Vector, C1Matrix >::sequence, and MsmBlockKernel< C1Vector, C1Matrix >::subgrid.

Referenced by sendUpCharge().

03594 {
03595 #ifdef MSM_TIMING
03596   double startTime, stopTime;
03597   startTime = CkWallTimer();
03598 #endif
03599   int pid;
03600   gm->get(subgrid, pid, sequence);
03601   delete gm;
03602   qh += subgrid;
03603 #ifdef MSM_TIMING
03604   stopTime = CkWallTimer();
03605   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03606 #endif
03607   if (++cntRecvsCharge == bd->numRecvsCharge) {
03608     int nlevels = mgrLocal->numLevels();
03609     if (blockIndex.level < nlevels-1) {
03610       restriction();
03611     }
03612     gridCutoff();
03613   }
03614 } // MsmC1HermiteBlock::addCharge()

void MsmC1HermiteBlock::addPotential ( GridMsg  ) 

Definition at line 3744 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmBlockKernel< C1Vector, C1Matrix >::cntRecvsPotential, MsmTimer::COMM, MsmBlockKernel< C1Vector, C1Matrix >::eh, GridMsg::get(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, msm::BlockDiagram::numRecvsPotential, prolongation(), sendPatch(), and MsmBlockKernel< C1Vector, C1Matrix >::subgrid.

Referenced by sendDownPotential(), and sumReducedPotential().

03745 {
03746 #ifdef MSM_TIMING
03747   double startTime, stopTime;
03748   startTime = CkWallTimer();
03749 #endif
03750   int pid;
03751   int pseq;
03752   gm->get(subgrid, pid, pseq);  // receive sender's level
03753   delete gm;
03754   eh += subgrid;
03755 #ifdef MSM_TIMING
03756   stopTime = CkWallTimer();
03757   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03758 #endif
03759   if (++cntRecvsPotential == bd->numRecvsPotential) {
03760     if (blockIndex.level > 0) {
03761       prolongation();
03762     }
03763     else {
03764       sendPatch();
03765     }
03766   }
03767 } // MsmC1HermiteBlock::addPotential()

void MsmC1HermiteBlock::gridCutoff (  ) 

Definition at line 3652 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmTimer::COMM, msm::Grid< T >::data(), msm::BlockDiagram::indexGridCutoff, msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, MSM_PRIORITY, MSM_TIMING, ComputeMsmMgr::msmGridCutoff, msmGridCutoffBroadcast, msm::BlockIndex::n, ComputeMsmMgr::nlevels, GridMsg::put(), MsmBlockKernel< C1Vector, C1Matrix >::qh, MsmBlockKernel< C1Vector, C1Matrix >::sequence, and SET_PRIORITY.

Referenced by addCharge().

03653 {
03654 #ifdef DEBUG_MSM_GRID
03655   printf("MsmC1HermiteBlock level=%d, id=%d %d %d:  grid cutoff\n",
03656       blockIndex.level, blockIndex.n.i, blockIndex.n.j, blockIndex.n.k);
03657 #endif
03658 #ifndef MSM_GRID_CUTOFF_DECOMP
03659   gridCutoffKernel();
03660   sendAcrossPotential();
03661 #else // MSM_GRID_CUTOFF_DECOMP
03662 
03663   // send charge block to MsmGridCutoff compute objects
03664 #ifdef MSM_TIMING
03665   double startTime, stopTime;
03666   startTime = CkWallTimer();
03667 #endif
03668   int priority = mgrLocal->nlevels + 2*(mgrLocal->nlevels - blockIndex.level)-1;
03669   int msgsz = qh.data().len() * sizeof(C1Vector);
03670   int len = bd->indexGridCutoff.len();
03671 
03672 #if 0
03673   // send charge message to each MsmGridCutoff compute element in list
03674   for (int n = 0;  n < len;  n++) {
03675 #ifdef MSM_TIMING
03676     startTime = CkWallTimer();
03677 #endif
03678     int index = bd->indexGridCutoff[n];
03679     GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03680     SET_PRIORITY(gm, sequence, MSM_PRIORITY + priority);
03681     gm->put(qh, blockIndex.level, sequence);  // send my level
03682 #ifdef MSM_TIMING
03683     stopTime = CkWallTimer();
03684     mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03685 #endif
03686     mgrLocal->msmGridCutoff[index].compute(gm);
03687   }
03688 #else
03689 
03690   // broadcast charge message to section
03691   GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03692   SET_PRIORITY(gm, sequence, MSM_PRIORITY + priority);
03693   gm->put(qh, blockIndex.level, sequence);  // send my level
03694   msmGridCutoffBroadcast.compute(gm);
03695 #ifdef MSM_TIMING
03696   stopTime = CkWallTimer();
03697   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03698 #endif
03699 
03700 #endif // 0
03701 
03702 #endif // MSM_GRID_CUTOFF_DECOMP
03703 
03704 } // MsmC1HermiteBlock::gridCutoff()

void MsmC1HermiteBlock::prolongation (  )  [inline]

Definition at line 3524 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::prolongationKernel(), and sendDownPotential().

Referenced by addPotential().

03524                         {
03525       prolongationKernel();
03526       sendDownPotential();
03527     }

void MsmC1HermiteBlock::restriction (  )  [inline]

Definition at line 3512 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::restrictionKernel(), and sendUpCharge().

Referenced by addCharge().

03512                        {
03513       restrictionKernel();
03514       sendUpCharge();
03515     }

void MsmC1HermiteBlock::sendDownPotential (  ) 

Definition at line 3770 of file ComputeMsm.C.

References addPotential(), ASSERT, MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmTimer::COMM, MsmBlockKernel< C1Vector, C1Matrix >::ehProlongated, msm::Grid< T >::extract(), MsmBlockKernel< C1Vector, C1Matrix >::init(), msm::Grid< T >::init(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, MSM_PRIORITY, ComputeMsmMgr::msmC1HermiteBlock, msm::BlockIndex::n, ComputeMsmMgr::nlevels, msm::IndexRange::nn(), GridMsg::put(), msm::BlockDiagram::sendDown, MsmBlockKernel< C1Vector, C1Matrix >::sequence, SET_PRIORITY, MsmBlockKernel< C1Vector, C1Matrix >::subgrid, and msm::Grid< T >::updateLower().

Referenced by prolongation().

03771 {
03772 #ifdef MSM_TIMING
03773   double startTime, stopTime;
03774   startTime = CkWallTimer();
03775 #endif
03776   int lnext = blockIndex.level - 1;
03777   int priority = mgrLocal->nlevels + 2*(mgrLocal->nlevels - blockIndex.level);
03778   // buffer portions of grid to send to Blocks on next level
03779   for (int n = 0;  n < bd->sendDown.len();  n++) {
03780     // initialize the proper subgrid indexing range
03781     subgrid.init( bd->sendDown[n].nrange );
03782     // extract the values from the larger grid into the subgrid
03783     ehProlongated.extract(subgrid);
03784     // translate the subgrid indexing range to match the MSM block
03785     subgrid.updateLower( bd->sendDown[n].nrange_wrap.lower() );
03786     // add the subgrid charges into the block
03787     msm::BlockIndex& bindex = bd->sendDown[n].nblock_wrap;
03788     ASSERT(bindex.level == lnext);
03789     // place subgrid into message
03790     int msgsz = subgrid.nn() * sizeof(C1Vector);
03791     GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03792     SET_PRIORITY(gm, sequence, MSM_PRIORITY + priority);
03793     gm->put(subgrid, blockIndex.level, sequence);  // send my level
03794     // lookup in ComputeMsmMgr proxy array by level
03795     mgrLocal->msmC1HermiteBlock[lnext](
03796         bindex.n.i, bindex.n.j, bindex.n.k).addPotential(gm);
03797   } // for
03798 #ifdef MSM_TIMING
03799   stopTime = CkWallTimer();
03800   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03801   mgrLocal->doneTiming();
03802 #endif
03803   init();  // reinitialize for next computation
03804 } // MsmC1HermiteBlock::sendDownPotential()

void MsmC1HermiteBlock::sendPatch (  ) 

Definition at line 3807 of file ComputeMsm.C.

References ASSERT, MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmTimer::COMM, MsmBlockKernel< C1Vector, C1Matrix >::eh, msm::Grid< T >::extract(), MsmBlockKernel< C1Vector, C1Matrix >::init(), msm::Grid< T >::init(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, MsmBlockKernel< C1Vector, C1Matrix >::mgrProxy, MSM_PRIORITY, ComputeMsmMgr::nlevels, msm::IndexRange::nn(), PatchMap::node(), PatchMap::Object(), GridMsg::put(), msm::BlockDiagram::sendPatch, MsmBlockKernel< C1Vector, C1Matrix >::sequence, SET_PRIORITY, MsmBlockKernel< C1Vector, C1Matrix >::subgrid, and msm::Grid< T >::updateLower().

Referenced by addPotential().

03808 {
03809 #ifdef MSM_TIMING
03810   double startTime, stopTime;
03811   startTime = CkWallTimer();
03812 #endif
03813   int lnext = blockIndex.level;
03814   int priority = mgrLocal->nlevels + 2*(mgrLocal->nlevels - blockIndex.level);
03815   ASSERT(lnext == 0);
03816   // buffer portions of grid to send to Blocks on next level
03817   for (int n = 0;  n < bd->sendPatch.len();  n++) {
03818     // initialize the proper subgrid indexing range
03819     subgrid.init( bd->sendPatch[n].nrange );
03820     // extract the values from the larger grid into the subgrid
03821     eh.extract(subgrid);
03822     // translate the subgrid indexing range to match the MSM block
03823     subgrid.updateLower( bd->sendPatch[n].nrange_unwrap.lower() );
03824     // add the subgrid charges into the block, need its patch ID
03825     int pid = bd->sendPatch[n].patchID;
03826     // place subgrid into message
03827     int msgsz = subgrid.nn() * sizeof(C1Vector);
03828     GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03829     SET_PRIORITY(gm, sequence, MSM_PRIORITY + priority);
03830     gm->put(subgrid, pid, sequence);  // send patch ID
03831     // lookup which PE has this patch
03832     PatchMap *pm = PatchMap::Object();
03833     int pe = pm->node(pid);
03834     mgrProxy[pe].addPotential(gm);
03835   }
03836 #ifdef MSM_TIMING
03837   stopTime = CkWallTimer();
03838   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03839   mgrLocal->doneTiming();
03840 #endif
03841   init();  // reinitialize for next computation
03842 } // MsmC1HermiteBlock::sendPatch()

void MsmC1HermiteBlock::sendUpCharge (  ) 

Definition at line 3617 of file ComputeMsm.C.

References addCharge(), ASSERT, MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmTimer::COMM, msm::Grid< T >::extract(), msm::Grid< T >::init(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, MSM_PRIORITY, ComputeMsmMgr::msmC1HermiteBlock, msm::BlockIndex::n, msm::IndexRange::nn(), GridMsg::put(), MsmBlockKernel< C1Vector, C1Matrix >::qhRestricted, msm::BlockDiagram::sendUp, MsmBlockKernel< C1Vector, C1Matrix >::sequence, SET_PRIORITY, MsmBlockKernel< C1Vector, C1Matrix >::subgrid, and msm::Grid< T >::updateLower().

Referenced by restriction().

03618 {
03619 #ifdef MSM_TIMING
03620   double startTime, stopTime;
03621   startTime = CkWallTimer();
03622 #endif
03623   int lnext = blockIndex.level + 1;
03624   // buffer portions of grid to send to Blocks on next level
03625   for (int n = 0;  n < bd->sendUp.len();  n++) {
03626     // initialize the proper subgrid indexing range
03627     subgrid.init( bd->sendUp[n].nrange );
03628     // extract the values from the larger grid into the subgrid
03629     qhRestricted.extract(subgrid);
03630     // translate the subgrid indexing range to match the MSM block
03631     subgrid.updateLower( bd->sendUp[n].nrange_wrap.lower() );
03632     // add the subgrid charges into the block
03633     msm::BlockIndex& bindex = bd->sendUp[n].nblock_wrap;
03634     ASSERT(bindex.level == lnext);
03635     // place subgrid into message
03636     // SET MESSAGE PRIORITY
03637     int msgsz = subgrid.nn() * sizeof(C1Vector);
03638     GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03639     SET_PRIORITY(gm, sequence, MSM_PRIORITY + lnext);
03640     gm->put(subgrid, blockIndex.level, sequence);  // send my level
03641     // lookup in ComputeMsmMgr proxy array by level
03642     mgrLocal->msmC1HermiteBlock[lnext](
03643         bindex.n.i, bindex.n.j, bindex.n.k).addCharge(gm);
03644   } // for
03645 #ifdef MSM_TIMING
03646   stopTime = CkWallTimer();
03647   mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03648 #endif
03649 } // MsmC1HermiteBlock::sendUpCharge()

void MsmC1HermiteBlock::setupSections (  ) 

Definition at line 3533 of file ComputeMsm.C.

References MsmBlockKernel< C1Vector, C1Matrix >::bd, MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, DEBUG_MSM_GRID, msm::BlockDiagram::indexGridCutoff, msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, ComputeMsmMgr::msmC1HermiteGridCutoff, msmGridCutoffBroadcast, msmGridCutoffReduction, MsmC1HermiteGridCutoffSetupMsg::put(), and msm::BlockDiagram::recvGridCutoff.

03534 {
03535 #ifdef DEBUG_MSM_GRID
03536   CkPrintf("LEVEL %d MSM C1 HERMITE BLOCK (%d,%d,%d):  "
03537       "creating broadcast section on PE %d\n",
03538       blockIndex.level, thisIndex.x, thisIndex.y, thisIndex.z, CkMyPe());
03539 #endif
03540   CkVec<CkArrayIndex1D> elems;
03541   for (int n = 0;  n < bd->indexGridCutoff.len();  n++) {
03542     elems.push_back(CkArrayIndex1D( bd->indexGridCutoff[n] ));
03543   }
03544   msmGridCutoffBroadcast = CProxySection_MsmC1HermiteGridCutoff::ckNew(
03545       mgrLocal->msmC1HermiteGridCutoff, elems.getVec(), elems.size()
03546       );
03547   CProxy_CkMulticastMgr mcastProxy = CkpvAccess(BOCclass_group).multicastMgr;
03548   CkMulticastMgr *mcastPtr = CProxy_CkMulticastMgr(mcastProxy).ckLocalBranch();
03549   msmGridCutoffBroadcast.ckSectionDelegate(mcastPtr);
03550   
03551 #ifdef DEBUG_MSM_GRID
03552   char s[1024];
03553   sprintf(s, "LEVEL %d MSM C1 HERMITE BLOCK (%d,%d,%d):  "
03554       "creating reduction section on PE %d\n",
03555       blockIndex.level, thisIndex.x, thisIndex.y, thisIndex.z, CkMyPe());
03556 #endif
03557   CkVec<CkArrayIndex1D> elems2;
03558 #ifdef DEBUG_MSM_GRID
03559   strcat(s, "receiving from MsmC1HermiteGridCutoff ID:");
03560 #endif
03561   for (int n = 0;  n < bd->recvGridCutoff.len();  n++) {
03562 #ifdef DEBUG_MSM_GRID
03563     char t[20];
03564     sprintf(t, "  %d", bd->recvGridCutoff[n]);
03565     strcat(s, t);
03566 #endif
03567     elems2.push_back(CkArrayIndex1D( bd->recvGridCutoff[n] ));
03568   }
03569 #ifdef DEBUG_MSM_GRID
03570   strcat(s, "\n");
03571   CkPrintf(s);
03572 #endif
03573   msmGridCutoffReduction = CProxySection_MsmC1HermiteGridCutoff::ckNew(
03574       mgrLocal->msmC1HermiteGridCutoff, elems2.getVec(), elems2.size()
03575       );
03576   msmGridCutoffReduction.ckSectionDelegate(mcastPtr);
03577   MsmC1HermiteGridCutoffSetupMsg *msg = new MsmC1HermiteGridCutoffSetupMsg;
03578   CProxyElement_MsmC1HermiteBlock thisElementProxy = thisProxy(thisIndex);
03579   msg->put(&thisElementProxy);
03580 
03581   msmGridCutoffReduction.setupSections(msg);  // broadcast to entire section
03582 
03583   /* XXX alternatively, setup default reduction client
03584    *
03585   mcastPtr->setReductionClient(msmGridCutoffReduction,
03586       new CkCallback(CkIndex_MsmC1HermiteBlock::myReductionEntry(NULL),
03587         thisElementProxy));
03588    *
03589    */
03590 } // MsmC1HermiteBlock::setupSections()

void MsmC1HermiteBlock::sumReducedPotential ( CkReductionMsg *  msg  )  [inline]

Definition at line 3488 of file ComputeMsm.C.

References addPotential(), MsmBlockKernel< C1Vector, C1Matrix >::blockIndex, MsmTimer::COMM, msm::Grid< T >::data(), MsmBlockKernel< C1Vector, C1Matrix >::eh, msm::Grid< T >::init(), msm::BlockIndex::level, MsmBlockKernel< C1Vector, C1Matrix >::mgrLocal, MSM_PRIORITY, ComputeMsmMgr::nlevels, GridMsg::put(), MsmBlockKernel< C1Vector, C1Matrix >::sequence, and SET_PRIORITY.

03488                                                   {
03489 #ifdef MSM_TIMING
03490       double startTime, stopTime;
03491       startTime = CkWallTimer();
03492 #endif
03493       msm::Grid<C1Vector> ehfull;
03494       ehfull.init( msm::IndexRange(eh) );
03495       memcpy(ehfull.data().buffer(), msg->getData(), msg->getSize());
03496       delete msg;
03497       int priority = mgrLocal->nlevels
03498         + 2*(mgrLocal->nlevels - blockIndex.level)-1;
03499       int msgsz = ehfull.data().len() * sizeof(C1Vector);
03500       GridMsg *gm = new(msgsz, sizeof(int)) GridMsg;
03501       SET_PRIORITY(gm, sequence, MSM_PRIORITY + priority);
03502       gm->put(ehfull, blockIndex.level, sequence);  // send my level
03503 #ifdef MSM_TIMING
03504       stopTime = CkWallTimer();
03505       mgrLocal->msmTiming[MsmTimer::COMM] += stopTime - startTime;
03506 #endif
03507       addPotential(gm);
03508     }


Member Data Documentation

CProxySection_MsmC1HermiteGridCutoff MsmC1HermiteBlock::msmGridCutoffBroadcast

Definition at line 3461 of file ComputeMsm.C.

Referenced by gridCutoff(), and setupSections().

CProxySection_MsmC1HermiteGridCutoff MsmC1HermiteBlock::msmGridCutoffReduction

Definition at line 3462 of file ComputeMsm.C.

Referenced by setupSections().


The documentation for this class was generated from the following file:
Generated on Sun Sep 24 01:17:19 2017 for NAMD by  doxygen 1.4.7