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 117 by mmeineke, Tue Sep 24 22:10:55 2002 UTC vs.
Revision 163 by mmeineke, Tue Nov 5 22:04:42 2002 UTC

# Line 4 | Line 4
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 17 | 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 31 | 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 45 | 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 59 | 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 73 | 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 87 | 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 110 | 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 125 | 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 159 | 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 176 | 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 193 | 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   }
199
200 void init_start_index( struct node_tag* the_node,
201                       struct namespc the_namespc ){
202  event* the_event;
203  int* si_array;
204  int n_elements = 0;
205  int index = 0;
236  
207  struct integer_list_tag* head;
208  struct integer_list_tag* current;
209  
210  the_event = (event* )malloc( sizeof( event ) );
211  
212  the_event->event_type = ORIENTATION;
213  the_event->err_msg = NULL;
237  
215  head = the_node->the_data.il_head;
216  n_elements++;
217
218  current = head->next;
219  while( current != NULL ){
220    n_elements++;
221    current = current->next;
222  }
223
224  the_event->evt.si.n_elements = n_elements;
225  si_array = ( int* ) calloc( n_elements, sizeof( int ) );
226  
227  si_array[index] = head->the_int;
228  
229  current = head->next;
230  while( current != NULL ){
231    index++;
232    si_array[index] = current->the_int;
233    current = current->next;
234  }
235  the_event->evt.si.array = si_array;
236  
237  if( !event_handler( the_event ) ) interface_error( the_event );
238  
239  free( the_event );
240 }
241
238   void end_of_block( void ){
239    event* the_event;
240    
# Line 248 | 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