//-----------------------------------------------------------------------------
//  poisson.cpp
//-----------------------------------------------------------------------------
//
//  Copyright (C) 1998 Technische Universitaet Muenchen, Germany
//  written by Bernhard Brueck
//
//  This file is part of Nast++
//
//-----------------------------------------------------------------------------
//  einfache Tests fuer den Poissonloeser
//-----------------------------------------------------------------------------


#ifndef _MSC_VER
#    include "Nast++.h"
#else
#    include "..\src\Nast++.h"
#endif

#include <stdlib.h>
#include <fstream.h>


//-----------------------------------------------------------------------------
//  main
//-----------------------------------------------------------------------------
int main(int argc, char **argv)
{
    if( argc != 2 )
    {
	CNastDebug::dumpContextLogfile() << "Usage: " << argv[0] << " filename \n";
	exit(1);
    }

    ifstream inputfile(argv[1]);
    if( ! inputfile.good() )
    {
	CNastDebug::dumpContextLogfile() << "Fehler !\n";
	CNastDebug::dumpContextLogfile() << "Konnte File " << argv[1] << " nicht oeffnen \n";
	exit(1);
    }

    CNastBenchmark bench;
    CNastParameterContextTaggedFile context( inputfile );
    CNastSimulator2d simulator( &context );

    bench.start();
    simulator.main();
    bench.stop();
    
    CNastDebug::dumpContextLogfile() << "------------------------------------------------------------\n";
    CNastDebug::dumpContextLogfile() << "Benutzerzeit: " << bench.timeUser()   << " Sec\n";
    CNastDebug::dumpContextLogfile() << "Systemzeit  : " << bench.timeSystem() << " Sec\n";
    CNastDebug::dumpContextLogfile() << "Echtzeit    : " << bench.timeReal()   << " Sec\n";
    CNastDebug::dumpContextLogfile() << "------------------------------------------------------------\n";
    return 0;
}

