This is an example of how to use the Teuchos::TimeMonitor class.
#include "Teuchos_Version.hpp"
#ifdef HAVE_MPI
#include <mpi.h>
#endif
using namespace Teuchos;
double quadFunc( double x );
double factFunc( int x );
int main(int argc, char* argv[])
{
std::cout << Teuchos::Teuchos_Version() << std::endl << std::endl;
int i;
double x;
#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
#endif
for( i=-100; i<100; i++ ) {
x = quadFunc( (double) i );
(void)x;
}
for( i=0; i<100; i++ ) {
x = factFunc( i );
(void)x;
}
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
double quadFunc( double x )
{
return ( x*x - 1.0 );
}
double factFunc( int x )
{
if( x == 0 ) return 0.0;
if( x == 1 ) return 1.0;
return ( (double) x * factFunc(x-1) );
}