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 515 of file structures.h.


Constructor & Destructor Documentation

ExclusionSignature::ExclusionSignature (  )  [inline]

Definition at line 525 of file structures.h.

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

00525                         {
00526         fullExclCnt = modExclCnt = 0;
00527         fullOffset = modOffset = NULL;
00528 #ifdef NAMD_CUDA
00529         allExclCnt = 0;
00530         allTuples = NULL;
00531 #endif
00532     }    

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

Definition at line 533 of file structures.h.

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

00533                                                      {
00534         fullOffset = modOffset = NULL;
00535         fullExclCnt = sig.fullExclCnt;
00536         if(fullExclCnt>0){
00537             fullOffset = new int[fullExclCnt];
00538             for(int i=0; i<fullExclCnt; i++)
00539                 fullOffset[i] = sig.fullOffset[i];
00540         }
00541         
00542         modExclCnt = sig.modExclCnt;
00543         if(modExclCnt>0){
00544             modOffset = new int[modExclCnt];
00545             for(int i=0; i<modExclCnt; i++)
00546                 modOffset[i] = sig.modOffset[i];
00547         }
00548 #ifdef NAMD_CUDA
00549         allTuples = NULL;
00550         allExclCnt = sig.allExclCnt;
00551         if(allExclCnt>0){
00552             allTuples = new TupleSignature[allExclCnt];
00553             for(int i=0; i<allExclCnt; i++)
00554                 allTuples[i] = sig.allTuples[i];
00555         }
00556 #endif
00557     }

ExclusionSignature::~ExclusionSignature (  )  [inline]

Definition at line 558 of file structures.h.

References allTuples, fullOffset, and modOffset.

00558                          {
00559         if(fullOffset) delete [] fullOffset;
00560         if(modOffset) delete [] modOffset;
00561 #ifdef NAMD_CUDA
00562         if(allTuples) delete [] allTuples;
00563 #endif
00564     }


Member Function Documentation

void ExclusionSignature::buildTuples (  )  [inline]

Definition at line 627 of file structures.h.

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

Referenced by setOffsets().

00627                        {
00628         delete [] allTuples;
00629         allTuples = NULL;
00630         allExclCnt = 0;
00631         for(int i=0; i<fullExclCnt; i++)
00632             if ( fullOffset[i] > 0 ) ++allExclCnt;
00633         for(int i=0; i<modExclCnt; i++)
00634             if ( modOffset[i] > 0 ) ++allExclCnt;
00635         if(allExclCnt>0){
00636             allTuples = new TupleSignature[allExclCnt];
00637             int j = 0;
00638             for(int i=0; i<fullExclCnt; i++){
00639                 if ( fullOffset[i] <= 0 ) continue;
00640                 TupleSignature oneSig(1,EXCLUSION,0);
00641                 oneSig.offset[0] = fullOffset[i];
00642                 allTuples[j++] = oneSig;
00643             }
00644             for(int i=0; i<modExclCnt; i++){
00645                 if ( modOffset[i] <= 0 ) continue;
00646                 TupleSignature oneSig(1,EXCLUSION,1);
00647                 oneSig.offset[0] = modOffset[i];
00648                 allTuples[j++] = oneSig;
00649             }
00650         }
00651 #endif
00652     }

int ExclusionSignature::findOffset ( int  offset,
int *  fullOrMod 
)
int ExclusionSignature::hash ( void   )  const [inline]

Definition at line 654 of file structures.h.

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

00654                      {
00655       unsigned int numOffset = fullExclCnt + modExclCnt;
00656       unsigned int code = 0x12345678;
00657       unsigned int codesz = 8 * sizeof(int);
00658       unsigned int shift = codesz / numOffset;
00659     
00660       if (shift == 0) shift=1;
00661       unsigned int i;
00662       for(i=0; i < fullExclCnt; i++) {
00663         code = circShift(code,shift);
00664         code ^= fullOffset[i];
00665       }
00666       for(i=0; i < modExclCnt; i++) {
00667         code = circShift(code,shift);
00668         code ^= modOffset[i];
00669       }
00670       return code;
00671     }

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

Definition at line 566 of file structures.h.

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

00566                                                                 {
00567         fullExclCnt = sig.fullExclCnt;
00568         if(fullOffset) delete [] fullOffset;
00569         if(fullExclCnt>0){
00570             fullOffset = new int[fullExclCnt];
00571             for(int i=0; i<fullExclCnt; i++)
00572                 fullOffset[i] = sig.fullOffset[i];
00573         }else
00574             fullOffset = NULL;
00575     
00576         modExclCnt = sig.modExclCnt;
00577         if(modOffset) delete [] modOffset;
00578         if(modExclCnt>0){
00579             modOffset = new int[modExclCnt];
00580             for(int i=0; i<modExclCnt; i++)
00581                 modOffset[i] = sig.modOffset[i];
00582         }else
00583             modOffset = NULL;
00584 #ifdef NAMD_CUDA
00585         allExclCnt = sig.allExclCnt;
00586         if(allTuples) delete [] allTuples;
00587         if(allExclCnt>0){
00588             allTuples = new TupleSignature[allExclCnt];
00589             for(int i=0; i<allExclCnt; i++)
00590                 allTuples[i] = sig.allTuples[i];
00591         }else
00592             allTuples = NULL;
00593 #endif
00594 
00595         return *this;
00596     }

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

Definition at line 597 of file structures.h.

References fullExclCnt, fullOffset, modExclCnt, and modOffset.

00597                                                            {
00598             if(fullExclCnt!=sig.fullExclCnt) return 0;
00599             if(modExclCnt!=sig.modExclCnt) return 0;
00600             
00601             for(int i=0; i<fullExclCnt; i++){
00602                         if(fullOffset[i]!=sig.fullOffset[i]) return 0;
00603             }
00604             for(int i=0; i<modExclCnt; i++){
00605                         if(modOffset[i]!=sig.modOffset[i]) return 0;
00606             }
00607             return 1;
00608         }

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

Definition at line 610 of file structures.h.

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

00610                                                                     {
00611         fullExclCnt = fullVec.size();
00612         modExclCnt = modVec.size();
00613         if(fullExclCnt>0) {        
00614             fullOffset = new int[fullExclCnt];
00615             for(int i=0; i<fullExclCnt; i++)
00616                 fullOffset[i] = fullVec[i];
00617         }
00618 
00619         if(modExclCnt>0) {        
00620             modOffset = new int[modExclCnt];
00621             for(int i=0; i<modExclCnt; i++)
00622                 modOffset[i] = modVec[i];       
00623         }
00624 #ifdef NAMD_CUDA
00625         buildTuples();
00626     }

void ExclusionSignature::unpack ( MIStream msg  ) 

Member Data Documentation

Definition at line 521 of file structures.h.

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


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

Generated on 6 Dec 2019 for NAMD by  doxygen 1.6.1