COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
coolfluid-command.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #include <iostream>
8 
9 #include <boost/program_options.hpp>
10 #include "common/CF.hpp"
11 #include "common/Exception.hpp"
12 #include "common/Log.hpp"
13 #include "common/OptionList.hpp"
14 #include "common/Core.hpp"
15 #include "common/Environment.hpp"
16 
19 
20 using namespace boost::program_options;
21 
22 using namespace cf3;
23 using namespace cf3::common;
24 using namespace cf3::Tools::Shell;
25 
27 
28 int main(int argc, char * argv[])
29 {
30  PE::Comm::instance().init(argc, argv);
31  Core::instance().initiate(argc, argv);
32 
33  try
34  {
35 
36  // --------------------------------------------------------
37 
38  Core::instance().environment().options().set("exception_outputs",false);
39  Core::instance().environment().options().set("exception_backtrace",false);
40  Core::instance().environment().options().set("exception_aborts",false);
41  Core::instance().environment().options().set("assertion_throws",true);
42 
43  // Initialize empty commands
44  options_description desc;
45 
46  // Add basic commands to program
47  desc.add(BasicCommands::description());
48  desc.add(StdHelp("help,h","Show help",desc));
49 
50  // Parse commands that are passed directly on the command line
51  Interpreter shell(desc);
52  shell.interpret(argc,argv);
53 
54  // --------------------------------------------------------
55 
56  }
57  catch(Exception & e)
58  {
59  CFerror << e.what() << CFendl;
60  }
61  catch ( std::exception& ex )
62  {
63  CFerror << "Unhandled exception: " << ex.what() << CFendl;
64  }
65  catch ( ... )
66  {
67  CFerror << "Detected unknown exception" << CFendl;
68  }
69 
70  Core::instance().terminate();
71  PE::Comm::instance().finalize();
72 
73  return 0;
74 }
int main(int argc, char *argv[])
Base class for all Exceptions in CF.
Definition: Exception.hpp:52
Command Line and script interpreter.
Definition: Interpreter.hpp:43
#define CFendl
Definition: Log.hpp:109
Real e()
Definition of the Unit charge [C].
Definition: Consts.hpp:30
const char * what() const
Definition: Exception.cpp:90
Classes for command line interpreting COOLFluiD.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
LoadBalance::LoadBalance(const std::string &name) std::string desc
Definition: LoadBalance.cpp:35
coolfluid3 header, included almost everywhere
#define CFerror
Definition: Log.hpp:105
Most basic kernel library.
Definition: Action.cpp:19
void interpret(std::istream &input_stream)
Start interpreting an input_stream.
Send comments to:
COOLFluiD Web Admin