--- trunk/mdtools/BASS_parse/interface.c 2002/09/24 22:10:55 117 +++ trunk/mdtools/BASS_parse/interface.c 2002/11/05 22:04:42 163 @@ -4,6 +4,10 @@ #include "interface.h" #include "../headers/BASS_interface.h" +#include "../headers/simError.h" +#ifdef IS_MPI +#include "../headers/mpiBASS.h" +#endif void interface_error( event* the_event ); @@ -17,7 +21,10 @@ void init_component( int comp_index ){ the_event->evt.blk_index = comp_index; if( !event_handler( the_event ) ) interface_error( the_event ); - +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif + free( the_event ); } @@ -31,6 +38,9 @@ void init_molecule( int mol_index ){ the_event->evt.blk_index = mol_index; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -45,6 +55,9 @@ void init_atom( int atom_index ){ the_event->evt.blk_index = atom_index; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -59,6 +72,9 @@ void init_bond( int bond_index ){ the_event->evt.blk_index = bond_index; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -73,6 +89,9 @@ void init_bend( int bend_index ){ the_event->evt.blk_index = bend_index; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -87,6 +106,9 @@ void init_torsion( int torsion_index ){ the_event->evt.blk_index = torsion_index; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -110,6 +132,9 @@ void init_members( struct node_tag* the_node, the_event->evt.mbr.d = the_node->the_data.mbr.d; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -125,6 +150,9 @@ void init_constraint( struct node_tag* the_node, the_event->evt.cnstr = the_node->the_data.cnstr.constraint_val; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -159,6 +187,9 @@ void init_assignment( struct node_tag* the_node, } if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -176,6 +207,9 @@ void init_position( struct node_tag* the_node, the_event->evt.pos.z = the_node->the_data.pos.z; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } @@ -193,52 +227,14 @@ void init_orientation( struct node_tag* the_node, the_event->evt.ornt.z = the_node->the_data.ort.z; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } - -void init_start_index( struct node_tag* the_node, - struct namespc the_namespc ){ - event* the_event; - int* si_array; - int n_elements = 0; - int index = 0; - struct integer_list_tag* head; - struct integer_list_tag* current; - - the_event = (event* )malloc( sizeof( event ) ); - - the_event->event_type = ORIENTATION; - the_event->err_msg = NULL; - head = the_node->the_data.il_head; - n_elements++; - - current = head->next; - while( current != NULL ){ - n_elements++; - current = current->next; - } - - the_event->evt.si.n_elements = n_elements; - si_array = ( int* ) calloc( n_elements, sizeof( int ) ); - - si_array[index] = head->the_int; - - current = head->next; - while( current != NULL ){ - index++; - si_array[index] = current->the_int; - current = current->next; - } - the_event->evt.si.array = si_array; - - if( !event_handler( the_event ) ) interface_error( the_event ); - - free( the_event ); -} - void end_of_block( void ){ event* the_event; @@ -248,15 +244,19 @@ void end_of_block( void ){ the_event->err_msg = NULL; if( !event_handler( the_event ) ) interface_error( the_event ); +#ifdef IS_MPI + throwMPIEvent(the_event); +#endif free( the_event ); } void interface_error( event* the_event ){ - fprintf( stderr, + sprintf( painCave.errMsg, "**Interface event error**\n" "%s\n", the_event->err_msg ); - exit(1); + simError(); + mpiInterfaceExit(); }