int main( int argc, char* argv[] ) { MPI_Comm CommWorld; int rank; int numProcessors; int procToWatch; /* Initialise MPI, get world info */ MPI_Init( &argc, &argv ); MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld ); MPI_Comm_size( CommWorld, &numProcessors ); MPI_Comm_rank( CommWorld, &rank ); BaseFoundation_Init( &argc, &argv ); BaseIO_Init( &argc, &argv ); BaseContainer_Init( &argc, &argv ); /* Tell the Journal_Firewall to Clean exit, rather than assert */ Stream_SetFileBranch( Journal_GetTypedStream( ErrorStream_Type ), stJournal->stdOut ); stJournal->firewallProducesAssert = False; if( argc >= 2 ) { procToWatch = atoi( argv[1] ); } else { procToWatch = 0; } if( rank == procToWatch ) { IndexSet* is; printf( "Watching rank: %i\n", rank ); printf( "* Test Construction *\n" ); is = IndexSet_New( 24 ); printf( "* Test Access(IsMember) over limit *\n" ); IndexSet_IsMember( is, 24 ); printf( "* Shouldn't get here\n" ); Stg_Class_Delete( is ); } BaseContainer_Finalise(); BaseIO_Finalise(); BaseFoundation_Finalise(); /* Close off MPI */ MPI_Finalize(); return 0; /* success */ }
VariableCondition_ValueIndex VariableCondition_GetValueIndex (void* variableCondition, Index localIndex, Variable_Index varIndex ) { VariableCondition* self = (VariableCondition*)variableCondition; VariableCondition_VariableIndex vcVar_I; Index i; /* if the set isn't initialised, this is a NULL BC : False */ if ( !self->_set ) { return False; } /* first check if the index they've given us is actually in the list this VC applies to */ /* quick check, since we have the set available */ if ( localIndex >= self->_set->size ) { Stream* warning = Journal_Register( ErrorStream_Type, self->type ); Journal_Printf( warning, "Error- In %s: Tried to check an index %d larger than the size of " "the set (%d).\n", __func__, localIndex, self->_set->size ); assert(0); return False; } if ( !IndexSet_IsMember( self->_set, localIndex ) ) { return (VariableCondition_ValueIndex)-1; } for (i = 0; i < self->indexCount; i++) if (self->indexTbl[i] == localIndex) break; if (i == self->indexCount) return (VariableCondition_ValueIndex)-1; /* now check if the Variable they've given us is actually in the list to apply at the given index */ for (vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++) if (self->vcTbl[i][vcVar_I].varIndex == varIndex) return self->vcTbl[i][vcVar_I].valIndex; return (VariableCondition_ValueIndex)-1; }