Exemplo n.º 1
0
int main ( const int argc, char *argv[] )
{
  // command line

  CommandLineOptions cloption;   // (sets defaults)
  
  cloption.Get( argc, argv );
  
  // id numbers and strings
  
  int run_id = GetId();
  char* host_name = GetHostName();
  
  char run_id_string[200];
  sprintf( run_id_string, "%s: #%d, %s {%s}",
	   PROGRAM_NAME, run_id, DateTime(), host_name );
  
  MakeOutFiles();
  
  // Initialize equation of state
  // Note: eqs.k is never used:  just for completeness.
  // -this code uses p and rho0 as input data so eps can be calculated
  //  from gamma.
  
  double eqs_k, eqs_gamma;
  ParameterSet eqs_param;
  eqs_param.Append( eqs_k, "eqs.k" );
  eqs_param.Append( eqs_gamma, "eqs.gamma" );
  
  ifstream eqs_param_s( "param.dat" );
  eqs_param.Get( eqs_param_s );
  eqs_param_s.close();
  
  eqs.Make( eqs_k, eqs_gamma );
  
  // time control

  ptime.Make();
  
  // Initialize the basic classes
  
  plog << "main: INFO: New Run..\n";
  
  // Dump run info
  // (usually pasted into the system LOG file after a run)
  
  plog.SetLineStyle( '#' );
  plog.PutLine();
  plog << run_id_string << '\n';
 
  Grid grid( cloption, run_id_string, run_id );

  // Initialize
  // NOTE: initial data is read by the Grid class
  
  plog.SetLineStyle( '=' );
  plog.PutLine();
  grid.MakeInitial( cloption );
  
  // Dump the parameters for reference
  
  plog.SetLineStyle( '=' );

  plog.PutLine();
  grid.PutParam( plog.s );
  
  plog.PutLine();
  cloption.Put( plog.s );

  plog.PutLine();
  ptime.PutParam( plog.s );
  
  plog.PutLine();
  plog.s << eqs;
  
  // Evolve
  
  plog << "main: INFO: Evolve..\n";
  Evolve( ptime, eqs, cloption, grid );
  
  // dump the last slice to a standard final configuration file
  
  grid.PutSlice( ptime );
}