Material* Materials_Register_GetByIndex( Materials_Register* self, Index materialIndex ) { if ( UNDEFINED_MATERIAL == materialIndex ) { return NULL; } return (Material*) NamedObject_Register_GetByIndex( self, materialIndex ); }
int main(int argc, char *argv[]) { int rank; int procCount; int procToWatch; Stream* stream; /* Initialise MPI, get world info */ MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &procCount); MPI_Comm_rank(MPI_COMM_WORLD, &rank); BaseFoundation_Init( &argc, &argv ); stream = Journal_Register( "info", "myStream" ); if( argc >= 2 ) { procToWatch = atoi( argv[1] ); } else { procToWatch = 0; } if ( rank == procToWatch ) { NamedObject_Register* reg = NamedObject_Register_New(); NamedObject_Register_Add( reg, TestObject_New( "a" ) ); NamedObject_Register_Add( reg, TestObject_New( "b" ) ); NamedObject_Register_Add( reg, TestObject_New( "c" ) ); NamedObject_Register_Add( reg, TestObject_New( "d" ) ); NamedObject_Register_Add( reg, TestObject_New( "e" ) ); Print( reg, stream ); Journal_Printf( stream, "Index of \"b\": %d\n", NamedObject_Register_GetIndex( reg, "b" ) ); Print( NamedObject_Register_GetByName( reg, "d" ), stream ); Print( NamedObject_Register_GetByIndex( reg, 2 ), stream ); } BaseFoundation_Finalise(); /* Close off MPI */ MPI_Finalize(); return 0; /* success */ }