| 73 |
|
#define G_FORCEFIELD_VARIANT 52 |
| 74 |
|
|
| 75 |
|
Globals::Globals(){ |
| 76 |
< |
|
| 76 |
> |
initalize(); |
| 77 |
> |
} |
| 78 |
> |
|
| 79 |
> |
Globals::~Globals(){ |
| 80 |
|
int i; |
| 81 |
|
|
| 82 |
+ |
for( i=0; i<hash_size; i++ ){ |
| 83 |
+ |
if( command_table[i] != NULL ) delete command_table[i]; |
| 84 |
+ |
} |
| 85 |
+ |
delete[] command_table; |
| 86 |
+ |
|
| 87 |
+ |
if( components != NULL ){ |
| 88 |
+ |
for( i=0; i<n_components; i++ ) delete components[i]; |
| 89 |
+ |
delete[] components; |
| 90 |
+ |
} |
| 91 |
+ |
} |
| 92 |
+ |
|
| 93 |
+ |
void Globals::initalize(){ |
| 94 |
+ |
int i; |
| 95 |
+ |
|
| 96 |
|
hash_size = 23; |
| 97 |
|
hash_shift = 4; |
| 98 |
|
|
| 100 |
|
|
| 101 |
|
command_table = new LinkedCommand*[hash_size]; |
| 102 |
|
for( i=0; i<hash_size; i++ ) command_table[i] = NULL; |
| 103 |
< |
|
| 103 |
> |
|
| 104 |
|
addHash( "forceField", G_FORCEFIELD ); |
| 105 |
|
addHash( "nComponents", G_NCOMPONENTS ); |
| 106 |
|
addHash( "targetTemp", G_TARGETTEMP ); |
| 107 |
|
addHash( "ensemble", G_ENSEMBLE ); |
| 108 |
< |
|
| 108 |
> |
|
| 109 |
|
addHash( "dt", G_DT ); |
| 110 |
|
addHash( "runTime", G_RUNTIME ); |
| 111 |
< |
|
| 111 |
> |
|
| 112 |
|
addHash( "initialConfig", G_INITIALCONFIG ); |
| 113 |
|
addHash( "finalConfig", G_FINALCONFIG ); |
| 114 |
|
addHash( "nMol", G_NMOL ); |
| 215 |
|
|
| 216 |
|
} |
| 217 |
|
|
| 201 |
– |
Globals::~Globals(){ |
| 202 |
– |
int i; |
| 203 |
– |
|
| 204 |
– |
for( i=0; i<hash_size; i++ ){ |
| 205 |
– |
if( command_table[i] != NULL ) delete command_table[i]; |
| 206 |
– |
} |
| 207 |
– |
delete[] command_table; |
| 208 |
– |
|
| 209 |
– |
if( components != NULL ){ |
| 210 |
– |
for( i=0; i<n_components; i++ ) delete components[i]; |
| 211 |
– |
delete[] components; |
| 212 |
– |
} |
| 213 |
– |
} |
| 214 |
– |
|
| 218 |
|
int Globals::newComponent( event* the_event ){ |
| 219 |
|
|
| 220 |
|
current_component = new Component; |
| 1823 |
|
the_element->setValues( text, token ); |
| 1824 |
|
|
| 1825 |
|
key = hash( text ); |
| 1826 |
+ |
|
| 1827 |
|
the_element->setNext( command_table[key] ); |
| 1828 |
|
command_table[key] = the_element; |
| 1829 |
|
} |