ExclusionSignature Struct Reference

#include <structures.h>

List of all members.

Public Member Functions

 ExclusionSignature ()
 ExclusionSignature (const ExclusionSignature &sig)
 ~ExclusionSignature ()
ExclusionSignatureoperator= (const ExclusionSignature &sig)
int operator== (const ExclusionSignature &sig) const
void setOffsets (std::vector< int > &fullVec, std::vector< int > &modVec)
void buildTuples ()
int hash () const
void removeEmptyOffset ()
int findOffset (int offset, int *fullOrMod)
void pack (MOStream *msg)
void unpack (MIStream *msg)

Public Attributes

int fullExclCnt
int * fullOffset
int modExclCnt
int * modOffset
int allExclCnt
TupleSignatureallTuples


Detailed Description

Definition at line 505 of file structures.h.


Constructor & Destructor Documentation

ExclusionSignature::ExclusionSignature (  )  [inline]

Definition at line 515 of file structures.h.

References allExclCnt, allTuples, fullExclCnt, fullOffset, modExclCnt, and modOffset.

00515                         {
00516         fullExclCnt = modExclCnt = 0;
00517         fullOffset = modOffset = NULL;
00518 #ifdef NAMD_CUDA
00519         allExclCnt = 0;
00520         allTuples = NULL;
00521 #endif
00522     }    

ExclusionSignature::ExclusionSignature ( const ExclusionSignature sig  )  [inline]

Definition at line 523 of file structures.h.

References allExclCnt, allTuples, fullExclCnt, fullOffset, modExclCnt, and modOffset.

00523                                                      {
00524         fullOffset = modOffset = NULL;
00525         fullExclCnt = sig.fullExclCnt;
00526         if(fullExclCnt>0){
00527             fullOffset = new int[fullExclCnt];
00528             for(int i=0; i<fullExclCnt; i++)
00529                 fullOffset[i] = sig.fullOffset[i];
00530         }
00531         
00532         modExclCnt = sig.modExclCnt;
00533         if(modExclCnt>0){
00534             modOffset = new int[modExclCnt];
00535             for(int i=0; i<modExclCnt; i++)
00536                 modOffset[i] = sig.modOffset[i];
00537         }
00538 #ifdef NAMD_CUDA
00539         allTuples = NULL;
00540         allExclCnt = sig.allExclCnt;
00541         if(allExclCnt>0){
00542             allTuples = new TupleSignature[allExclCnt];
00543             for(int i=0; i<allExclCnt; i++)
00544                 allTuples[i] = sig.allTuples[i];
00545         }
00546 #endif
00547     }

ExclusionSignature::~ExclusionSignature (  )  [inline]

Definition at line 548 of file structures.h.

References allTuples, fullOffset, and modOffset.

00548                          {
00549         if(fullOffset) delete [] fullOffset;
00550         if(modOffset) delete [] modOffset;
00551 #ifdef NAMD_CUDA
00552         if(allTuples) delete [] allTuples;
00553 #endif
00554     }


Member Function Documentation

void ExclusionSignature::buildTuples (  )  [inline]

Definition at line 617 of file structures.h.

References allExclCnt, allTuples, EXCLUSION, fullExclCnt, fullOffset, j, modExclCnt, modOffset, and TupleSignature::offset.

Referenced by setOffsets().

00617                        {
00618         delete [] allTuples;
00619         allTuples = NULL;
00620         allExclCnt = 0;
00621         for(int i=0; i<fullExclCnt; i++)
00622             if ( fullOffset[i] > 0 ) ++allExclCnt;
00623         for(int i=0; i<modExclCnt; i++)
00624             if ( modOffset[i] > 0 ) ++allExclCnt;
00625         if(allExclCnt>0){
00626             allTuples = new TupleSignature[allExclCnt];
00627             int j = 0;
00628             for(int i=0; i<fullExclCnt; i++){
00629                 if ( fullOffset[i] <= 0 ) continue;
00630                 TupleSignature oneSig(1,EXCLUSION,0);
00631                 oneSig.offset[0] = fullOffset[i];
00632                 allTuples[j++] = oneSig;
00633             }
00634             for(int i=0; i<modExclCnt; i++){
00635                 if ( modOffset[i] <= 0 ) continue;
00636                 TupleSignature oneSig(1,EXCLUSION,1);
00637                 oneSig.offset[0] = modOffset[i];
00638                 allTuples[j++] = oneSig;
00639             }
00640         }
00641 #endif
00642     }

int ExclusionSignature::findOffset ( int  offset,
int *  fullOrMod 
)

int ExclusionSignature::hash ( void   )  const [inline]

Definition at line 644 of file structures.h.

References circShift(), fullExclCnt, fullOffset, modExclCnt, and modOffset.

00644                      {
00645       unsigned int numOffset = fullExclCnt + modExclCnt;
00646       unsigned int code = 0x12345678;
00647       unsigned int codesz = 8 * sizeof(int);
00648       unsigned int shift = codesz / numOffset;
00649     
00650       if (shift == 0) shift=1;
00651       unsigned int i;
00652       for(i=0; i < fullExclCnt; i++) {
00653         code = circShift(code,shift);
00654         code ^= fullOffset[i];
00655       }
00656       for(i=0; i < modExclCnt; i++) {
00657         code = circShift(code,shift);
00658         code ^= modOffset[i];
00659       }
00660       return code;
00661     }

ExclusionSignature& ExclusionSignature::operator= ( const ExclusionSignature sig  )  [inline]

Definition at line 556 of file structures.h.

References allExclCnt, allTuples, fullExclCnt, fullOffset, modExclCnt, and modOffset.

00556                                                                 {
00557         fullExclCnt = sig.fullExclCnt;
00558         if(fullOffset) delete [] fullOffset;
00559         if(fullExclCnt>0){
00560             fullOffset = new int[fullExclCnt];
00561             for(int i=0; i<fullExclCnt; i++)
00562                 fullOffset[i] = sig.fullOffset[i];
00563         }else
00564             fullOffset = NULL;
00565     
00566         modExclCnt = sig.modExclCnt;
00567         if(modOffset) delete [] modOffset;
00568         if(modExclCnt>0){
00569             modOffset = new int[modExclCnt];
00570             for(int i=0; i<modExclCnt; i++)
00571                 modOffset[i] = sig.modOffset[i];
00572         }else
00573             modOffset = NULL;
00574 #ifdef NAMD_CUDA
00575         allExclCnt = sig.allExclCnt;
00576         if(allTuples) delete [] allTuples;
00577         if(allExclCnt>0){
00578             allTuples = new TupleSignature[allExclCnt];
00579             for(int i=0; i<allExclCnt; i++)
00580                 allTuples[i] = sig.allTuples[i];
00581         }else
00582             allTuples = NULL;
00583 #endif
00584 
00585         return *this;
00586     }

int ExclusionSignature::operator== ( const ExclusionSignature sig  )  const [inline]

Definition at line 587 of file structures.h.

References fullExclCnt, fullOffset, modExclCnt, and modOffset.

00587                                                            {
00588             if(fullExclCnt!=sig.fullExclCnt) return 0;
00589             if(modExclCnt!=sig.modExclCnt) return 0;
00590             
00591             for(int i=0; i<fullExclCnt; i++){
00592                         if(fullOffset[i]!=sig.fullOffset[i]) return 0;
00593             }
00594             for(int i=0; i<modExclCnt; i++){
00595                         if(modOffset[i]!=sig.modOffset[i]) return 0;
00596             }
00597             return 1;
00598         }

void ExclusionSignature::pack ( MOStream msg  ) 

void ExclusionSignature::removeEmptyOffset (  ) 

void ExclusionSignature::setOffsets ( std::vector< int > &  fullVec,
std::vector< int > &  modVec 
) [inline]

Definition at line 600 of file structures.h.

References buildTuples(), fullExclCnt, fullOffset, modExclCnt, and modOffset.

00600                                                                     {
00601         fullExclCnt = fullVec.size();
00602         modExclCnt = modVec.size();
00603         if(fullExclCnt>0) {        
00604             fullOffset = new int[fullExclCnt];
00605             for(int i=0; i<fullExclCnt; i++)
00606                 fullOffset[i] = fullVec[i];
00607         }
00608 
00609         if(modExclCnt>0) {        
00610             modOffset = new int[modExclCnt];
00611             for(int i=0; i<modExclCnt; i++)
00612                 modOffset[i] = modVec[i];       
00613         }
00614 #ifdef NAMD_CUDA
00615         buildTuples();
00616     }

void ExclusionSignature::unpack ( MIStream msg  ) 


Member Data Documentation

int ExclusionSignature::allExclCnt

Definition at line 511 of file structures.h.

Referenced by buildTuples(), ExclusionSignature(), ExclElem::getTupleInfo(), and operator=().

TupleSignature* ExclusionSignature::allTuples

Definition at line 512 of file structures.h.

Referenced by buildTuples(), ExclusionSignature(), ExclElem::getTupleInfo(), operator=(), and ~ExclusionSignature().

int ExclusionSignature::fullExclCnt

Definition at line 506 of file structures.h.

Referenced by ComputeNonbondedCUDA::build_exclusions(), buildTuples(), ExclusionSignature(), hash(), operator=(), operator==(), setOffsets(), and ParallelIOMgr::updateMolInfo().

int* ExclusionSignature::fullOffset

Definition at line 507 of file structures.h.

Referenced by ComputeNonbondedCUDA::build_exclusions(), buildTuples(), ExclusionSignature(), hash(), operator=(), operator==(), setOffsets(), ParallelIOMgr::updateMolInfo(), and ~ExclusionSignature().

int ExclusionSignature::modExclCnt

Definition at line 508 of file structures.h.

Referenced by buildTuples(), ExclusionSignature(), hash(), operator=(), operator==(), setOffsets(), and ParallelIOMgr::updateMolInfo().

int* ExclusionSignature::modOffset

Definition at line 509 of file structures.h.

Referenced by buildTuples(), ExclusionSignature(), hash(), operator=(), operator==(), setOffsets(), ParallelIOMgr::updateMolInfo(), and ~ExclusionSignature().


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