| 13 |
|
if( next != NULL ) delete next; |
| 14 |
|
} |
| 15 |
|
|
| 16 |
+ |
void LinkedMolStamp::add( LinkedMolStamp* newbie ){ |
| 17 |
+ |
|
| 18 |
+ |
if( next != NULL ) next->add( newbie ); |
| 19 |
+ |
else{ |
| 20 |
+ |
next = newbie; |
| 21 |
+ |
next->setPrev( this ); |
| 22 |
+ |
} |
| 23 |
+ |
} |
| 24 |
+ |
|
| 25 |
|
MoleculeStamp* LinkedMolStamp::match( char* id ){ |
| 26 |
|
|
| 27 |
|
if( mol_stamp != NULL ){ |
| 28 |
< |
|
| 29 |
< |
if(!strcmp( mol_stamp->getID(), id )) return mol_stamp; |
| 30 |
< |
|
| 31 |
< |
if( next != NULL ) return next->match( id ); |
| 28 |
> |
if(!strcmp( mol_stamp->getID(), id )){ |
| 29 |
> |
|
| 30 |
> |
// make sure we aren't hiding somebody else with the same name |
| 31 |
> |
if(next != NULL ){ |
| 32 |
> |
if( next->match( id ) != NULL){ |
| 33 |
> |
sprintf( painCave.errMsg, |
| 34 |
> |
"Molecule Stamp Error. Two separate of declarations of %s present.\n", |
| 35 |
> |
id ); |
| 36 |
> |
painCave.isFatal = 1; |
| 37 |
> |
simError(); |
| 38 |
> |
#ifdef IS_MPI |
| 39 |
> |
if( painCave.isEventLoop ){ |
| 40 |
> |
if( worldRank == 0 ) mpiInterfaceExit(); |
| 41 |
> |
} |
| 42 |
> |
#endif //is_mpi |
| 43 |
> |
} |
| 44 |
> |
else return mol_stamp; |
| 45 |
> |
} |
| 46 |
> |
else return mol_stamp; |
| 47 |
> |
} |
| 48 |
|
} |
| 49 |
|
|
| 50 |
+ |
if( next != NULL ) return next->match( id ); |
| 51 |
+ |
|
| 52 |
|
return NULL; |
| 53 |
|
} |
| 54 |
|
|
| 58 |
|
|
| 59 |
|
my_mols = new LinkedMolStamp*[hash_size]; |
| 60 |
|
for( i=0; i<hash_size; i++ ){ |
| 61 |
< |
my_mols[i] = NULL; |
| 61 |
> |
my_mols[i] = new LinkedMolStamp(); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
} |
| 123 |
|
|
| 124 |
|
linked_mol = new LinkedMolStamp; |
| 125 |
|
linked_mol->setStamp( the_stamp ); |
| 99 |
– |
linked_mol->setNext( my_mols[key] ); |
| 126 |
|
|
| 127 |
< |
my_mols[key] = linked_mol; |
| 127 |
> |
my_mols[key]->add( linked_mol ); |
| 128 |
> |
|
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
|