GRINS-0.6.0
Functions
grins.C File Reference
#include "grins_config.h"
#include <iostream>
#include "grins/simulation_builder.h"
#include "grins/simulation.h"
#include "libmesh/parallel.h"
Include dependency graph for grins.C:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 42 of file grins.C.

References GRINS_BUILD_VERSION, and GRINS::Simulation::run().

43 {
44 #ifdef GRINS_USE_GRVY_TIMERS
45  GRVY::GRVY_Timer_Class grvy_timer;
46  grvy_timer.Init("GRINS Timer");
47 #endif
48 
49  // Check command line count.
50  if( argc < 2 )
51  {
52  // TODO: Need more consistent error handling.
53  std::cerr << "Error: Must specify libMesh input file." << std::endl;
54  exit(1); // TODO: something more sophisticated for parallel runs?
55  }
56 
57  // libMesh input file should be first argument
58  std::string libMesh_input_filename = argv[1];
59 
60  // Initialize libMesh library.
61  libMesh::LibMeshInit libmesh_init(argc, argv);
62 
63  // Create our GetPot object.
64  GetPot libMesh_inputfile( libMesh_input_filename );
65 
66  GetPot command_line(argc,argv);
67 
68  // GetPot doesn't throw an error for a nonexistent file?
69  {
70  std::ifstream i(libMesh_input_filename.c_str());
71  if (!i)
72  {
73  std::cerr << "Error: Could not read from libMesh input file "
74  << libMesh_input_filename << std::endl;
75  exit(1);
76  }
77  }
78 
79 #ifdef GRINS_USE_GRVY_TIMERS
80  grvy_timer.BeginTimer("Initialize Solver");
81 #endif
82 
83  /* Echo GRINS version, libMesh version, and command */
84  libMesh::out << "=========================================================="
85  << std::endl;
86  libMesh::out << "GRINS Version: " << GRINS_BUILD_VERSION << std::endl
87  << "libMesh Version: " << LIBMESH_BUILD_VERSION << std::endl
88  << "Running with command:\n";
89 
90  for (int i=0; i != argc; ++i)
91  libMesh::out << argv[i] << ' ';
92 
93  libMesh::out << std::endl
94  << "=========================================================="
95  << std::endl;
96 
97  GRINS::SimulationBuilder sim_builder;
98 
99  GRINS::Simulation grins( libMesh_inputfile,
100  command_line,
101  sim_builder,
102  libmesh_init.comm() );
103 
104 #ifdef GRINS_USE_GRVY_TIMERS
105  grvy_timer.EndTimer("Initialize Solver");
106 
107  // Attach GRVY timer to solver
108  grins.attach_grvy_timer( &grvy_timer );
109 #endif
110 
111 grins.run();
112 
113 #ifdef GRINS_USE_GRVY_TIMERS
114  grvy_timer.Finalize();
115 
116  if( Parallel::Communicator_World.rank() == 0 ) grvy_timer.Summarize();
117 #endif
118 
119  return 0;
120 }
#define GRINS_BUILD_VERSION
Definition: grins_version.h:40

Generated on Mon Jun 22 2015 21:32:21 for GRINS-0.6.0 by  doxygen 1.8.9.1