1 |
|
#include <stdlib.h> |
2 |
|
#include <stdio.h> |
3 |
|
|
4 |
< |
#include <parse_tree.h> |
5 |
< |
#include <simError.h> |
4 |
> |
#include "parse_tree.h" |
5 |
> |
#include "simError.h" |
6 |
|
|
7 |
|
#ifdef IS_MPI |
8 |
|
#define __is_lex__ |
9 |
< |
#include <mpiBASS.h> |
9 |
> |
#include "mpiBASS.h" |
10 |
|
#endif |
11 |
|
|
12 |
|
void walk_down( struct node_tag* the_node, struct namespc the_namespc ); |
98 |
|
break; |
99 |
|
|
100 |
|
case ATOM_HEAD: |
101 |
+ |
if( the_namespc.type != MOLECULE_HEAD && the_namespc.type != RIGIDBODY_HEAD ){ |
102 |
+ |
print_tree_error( the_node, |
103 |
+ |
"The atom block is not in a molecule or rigidBody namespace" ); |
104 |
+ |
} |
105 |
+ |
else{ |
106 |
+ |
init_atom( the_node->index ); |
107 |
+ |
current_namespc.index = the_node->index; |
108 |
+ |
current_namespc.type = the_node->type; |
109 |
+ |
walk_down( the_node->stmt_list, current_namespc ); |
110 |
+ |
} |
111 |
+ |
break; |
112 |
+ |
|
113 |
+ |
case RIGIDBODY_HEAD: |
114 |
|
if( the_namespc.type != MOLECULE_HEAD ){ |
115 |
|
print_tree_error( the_node, |
116 |
< |
"The atom block is not in a molecule namespace" ); |
116 |
> |
"The rigid body block is not in a molecule namespace" ); |
117 |
|
} |
118 |
|
else{ |
119 |
< |
init_atom( the_node->index ); |
119 |
> |
init_rigidbody( the_node->index ); |
120 |
|
current_namespc.index = the_node->index; |
121 |
|
current_namespc.type = the_node->type; |
122 |
|
walk_down( the_node->stmt_list, current_namespc ); |
162 |
|
walk_down( the_node->stmt_list, current_namespc ); |
163 |
|
} |
164 |
|
break; |
165 |
+ |
|
166 |
+ |
case ZCONSTRAINT_HEAD: |
167 |
+ |
if( the_namespc.type != GLOBAL_HEAD ){ |
168 |
+ |
print_tree_error( the_node, |
169 |
+ |
"The Zconstraint block is not in " |
170 |
+ |
"the global namespace" ); |
171 |
+ |
} |
172 |
+ |
else{ |
173 |
+ |
init_zconstraint( the_node->index ); |
174 |
+ |
current_namespc.index = the_node->index; |
175 |
+ |
current_namespc.type = the_node->type; |
176 |
+ |
walk_down( the_node->stmt_list, current_namespc ); |
177 |
+ |
} |
178 |
+ |
break; |
179 |
|
|
180 |
|
default: |
181 |
|
print_tree_error( the_node, "Not a valid code block" ); |
225 |
|
break; |
226 |
|
|
227 |
|
case POSITION_STMT: |
228 |
< |
if( the_namespc.type != ATOM_HEAD ){ |
228 |
> |
if( the_namespc.type != ATOM_HEAD && the_namespc.type != RIGIDBODY_HEAD){ |
229 |
|
print_tree_error( the_node, |
230 |
|
"position statement is not located in an " |
231 |
< |
"atom block" ); |
231 |
> |
"atom or rigidBody block" ); |
232 |
|
} |
233 |
|
|
234 |
|
init_position( the_node, the_namespc ); |
235 |
|
break; |
236 |
|
|
237 |
|
case ORIENTATION_STMT: |
238 |
< |
if( the_namespc.type != ATOM_HEAD ){ |
238 |
> |
if( the_namespc.type != ATOM_HEAD && the_namespc.type != RIGIDBODY_HEAD){ |
239 |
|
print_tree_error( the_node, |
240 |
|
"orientation statement is not located in an " |
241 |
< |
"atom block" ); |
241 |
> |
"atom or rigidBody block" ); |
242 |
|
} |
243 |
|
|
244 |
|
init_orientation( the_node, the_namespc ); |
245 |
|
break; |
246 |
|
|
220 |
– |
case START_INDEX_STMT: |
221 |
– |
if( the_namespc.type != COMPONENT_HEAD ){ |
222 |
– |
print_tree_error( the_node, |
223 |
– |
"start_index statement is not located in an " |
224 |
– |
"component block" ); |
225 |
– |
} |
226 |
– |
|
227 |
– |
//init_start_index( the_node, the_namespc ); |
228 |
– |
break; |
229 |
– |
|
247 |
|
default: |
248 |
|
print_tree_error( the_node, "unrecognized statement" ); |
249 |
|
break; |
290 |
|
err_msg ); |
291 |
|
break; |
292 |
|
|
293 |
+ |
case RIGIDBODY_HEAD: |
294 |
+ |
sprintf( painCave.errMsg, |
295 |
+ |
"Parse tree error: rigidBody head node error -> %s\n", |
296 |
+ |
err_msg ); |
297 |
+ |
break; |
298 |
+ |
|
299 |
|
case ATOM_HEAD: |
300 |
|
sprintf( painCave.errMsg, |
301 |
|
"Parse tree error: atom head node error [%d] -> %s\n", |
323 |
|
err_node->index, |
324 |
|
err_msg ); |
325 |
|
break; |
326 |
< |
|
326 |
> |
|
327 |
> |
case ZCONSTRAINT_HEAD: |
328 |
> |
sprintf( painCave.errMsg, |
329 |
> |
"Parse tree error: Zconstraint head node error [%d] -> %s\n", |
330 |
> |
err_node->index, |
331 |
> |
err_msg ); |
332 |
> |
break; |
333 |
> |
|
334 |
|
case MEMBER_STMT: |
335 |
|
sprintf( painCave.errMsg, |
336 |
|
"Parse tree error: member node error => ( %d, %d, %d, %d )\n" |
403 |
|
err_msg ); |
404 |
|
break; |
405 |
|
|
376 |
– |
case START_INDEX_STMT: |
377 |
– |
sprintf( painCave.errMsg, |
378 |
– |
"Parse tree error: start_index error -> %s\n", |
379 |
– |
err_msg ); |
380 |
– |
break; |
381 |
– |
|
382 |
– |
|
406 |
|
default: |
407 |
|
sprintf( painCave.errMsg, |
408 |
|
"Parse tree error: unknown node type -> %s\n", |
425 |
|
|
426 |
|
void kill_tree( struct node_tag* the_node ){ |
427 |
|
|
405 |
– |
// These two are needed to get rid of the integer list |
428 |
|
|
407 |
– |
struct integer_list_tag* current_il; |
408 |
– |
struct integer_list_tag* temp_il; |
409 |
– |
|
410 |
– |
|
429 |
|
if( the_node != NULL ){ |
430 |
|
|
431 |
|
if( the_node->stmt_list != NULL ){ |
449 |
|
free( the_node->the_data.asmt.identifier ); |
450 |
|
break; |
451 |
|
|
434 |
– |
case START_INDEX_STMT: |
435 |
– |
|
436 |
– |
current_il = the_node->the_data.il_head; |
437 |
– |
while( current_il != NULL ){ |
438 |
– |
temp_il = current_il->next; |
439 |
– |
free( current_il ); |
440 |
– |
current_il = temp_il; |
441 |
– |
} |
442 |
– |
the_node->the_data.il_head = NULL; |
443 |
– |
break; |
444 |
– |
|
452 |
|
default: |
453 |
|
// nothing to do here, everyone else can be freed normally. |
454 |
|
break; |