ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/BASS_parse/interface.c
(Generate patch)

Comparing trunk/mdtools/BASS_parse/interface.c (file contents):
Revision 11 by mmeineke, Tue Jul 9 18:40:59 2002 UTC vs.
Revision 163 by mmeineke, Tue Nov 5 22:04:42 2002 UTC

# Line 1 | Line 1
1   #include <stdio.h>
2   #include <stdlib.h>
3 + #include <string.h>
4  
5   #include "interface.h"
6   #include "../headers/BASS_interface.h"
7 + #include "../headers/simError.h"
8 + #ifdef IS_MPI
9 + #include "../headers/mpiBASS.h"
10 + #endif
11  
12   void interface_error( event* the_event );
13  
# Line 16 | Line 21 | void init_component( int comp_index ){
21    the_event->evt.blk_index = comp_index;
22  
23    if( !event_handler( the_event ) ) interface_error( the_event );
24 <  
24 > #ifdef IS_MPI
25 >  throwMPIEvent(the_event);
26 > #endif
27 >
28    free( the_event );  
29   }
30  
# Line 30 | Line 38 | void init_molecule( int mol_index ){
38    the_event->evt.blk_index = mol_index;
39  
40    if( !event_handler( the_event ) ) interface_error( the_event );
41 + #ifdef IS_MPI
42 +  throwMPIEvent(the_event);
43 + #endif
44    
45    free( the_event );  
46   }
# Line 44 | Line 55 | void init_atom( int atom_index ){
55    the_event->evt.blk_index = atom_index;
56  
57    if( !event_handler( the_event ) ) interface_error( the_event );
58 + #ifdef IS_MPI
59 +  throwMPIEvent(the_event);
60 + #endif
61    
62    free( the_event );
63   }
# Line 58 | Line 72 | void init_bond( int bond_index ){
72    the_event->evt.blk_index = bond_index;
73  
74    if( !event_handler( the_event ) ) interface_error( the_event );
75 + #ifdef IS_MPI
76 +  throwMPIEvent(the_event);
77 + #endif
78    
79    free( the_event );
80   }
# Line 72 | Line 89 | void init_bend( int bend_index ){
89    the_event->evt.blk_index = bend_index;
90  
91    if( !event_handler( the_event ) ) interface_error( the_event );
92 + #ifdef IS_MPI
93 +  throwMPIEvent(the_event);
94 + #endif
95    
96    free( the_event );
97   }
# Line 86 | Line 106 | void init_torsion( int torsion_index ){
106    the_event->evt.blk_index = torsion_index;
107  
108    if( !event_handler( the_event ) ) interface_error( the_event );
109 + #ifdef IS_MPI
110 +  throwMPIEvent(the_event);
111 + #endif
112    
113    free( the_event );
114   }
# Line 109 | Line 132 | void init_members( struct node_tag* the_node,
132    the_event->evt.mbr.d = the_node->the_data.mbr.d;
133  
134    if( !event_handler( the_event ) ) interface_error( the_event );
135 + #ifdef IS_MPI
136 +  throwMPIEvent(the_event);
137 + #endif
138    
139    free( the_event );
140   }
# Line 124 | Line 150 | void init_constraint( struct node_tag* the_node,
150    the_event->evt.cnstr = the_node->the_data.cnstr.constraint_val;
151  
152    if( !event_handler( the_event ) ) interface_error( the_event );
153 + #ifdef IS_MPI
154 +  throwMPIEvent(the_event);
155 + #endif
156    
157    free( the_event );
158   }
# Line 158 | Line 187 | void init_assignment( struct node_tag* the_node,
187    }
188  
189    if( !event_handler( the_event ) ) interface_error( the_event );
190 + #ifdef IS_MPI
191 +  throwMPIEvent(the_event);
192 + #endif
193    
194    free( the_event );
195   }
# Line 175 | Line 207 | void init_position( struct node_tag* the_node,
207    the_event->evt.pos.z = the_node->the_data.pos.z;
208  
209    if( !event_handler( the_event ) ) interface_error( the_event );
210 + #ifdef IS_MPI
211 +  throwMPIEvent(the_event);
212 + #endif
213    
214    free( the_event );
215   }
# Line 192 | Line 227 | void init_orientation( struct node_tag* the_node,
227    the_event->evt.ornt.z = the_node->the_data.ort.z;
228  
229    if( !event_handler( the_event ) ) interface_error( the_event );
230 + #ifdef IS_MPI
231 +  throwMPIEvent(the_event);
232 + #endif
233    
234    free( the_event );
235   }
236  
199 void init_start_index( struct node_tag* the_node,
200                       struct namespc the_namespc ){
201  event* the_event;
202  int* si_array;
203  int n_elements = 0;
204  int index = 0;
237  
206  struct integer_list_tag* head;
207  struct integer_list_tag* current;
208  
209  the_event = (event* )malloc( sizeof( event ) );
210  
211  the_event->event_type = ORIENTATION;
212  the_event->err_msg = NULL;
213
214  head = the_node->the_data.il_head;
215  n_elements++;
216
217  current = head->next;
218  while( current != NULL ){
219    n_elements++;
220    current = current->next;
221  }
222
223  the_event->evt.si.n_elements = n_elements;
224  si_array = ( int* ) calloc( n_elements, sizeof( int ) );
225  
226  si_array[index] = head->the_int;
227  
228  current = head->next;
229  while( current != NULL ){
230    index++;
231    si_array[index] = current->the_int;
232    current = current->next;
233  }
234  the_event->evt.si.array = si_array;
235  
236  if( !event_handler( the_event ) ) interface_error( the_event );
237  
238  free( the_event );
239 }
240
238   void end_of_block( void ){
239    event* the_event;
240    
# Line 247 | Line 244 | void end_of_block( void ){
244    the_event->err_msg = NULL;
245  
246    if( !event_handler( the_event ) ) interface_error( the_event );
247 + #ifdef IS_MPI
248 +  throwMPIEvent(the_event);
249 + #endif
250    
251    free( the_event );
252   }
253  
254   void interface_error( event* the_event ){
255  
256 <  fprintf( stderr,
256 >  sprintf( painCave.errMsg,
257             "**Interface event error**\n"
258             "%s\n",
259             the_event->err_msg );
260 <  exit(1);
260 >  simError();
261 >  mpiInterfaceExit();
262   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines