Пример #1
0
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 */
}
void TimeIntegrator_Add( void* timeIntegrator, void* _timeIntegrand ) {
	TimeIntegrator*	self           = (TimeIntegrator*) timeIntegrator;
	TimeIntegrand*	timeIntegrand = (TimeIntegrand*)_timeIntegrand;

	NamedObject_Register_Add( self->integrandRegister, timeIntegrand );
}