Saddle-Point
Loading...
Searching...
No Matches
main.cc File Reference

Program entry point: parse the parameter file and run a SaddlePointProblem<2>. More...

#include "../include/step-6.h"
#include <iostream>
Include dependency graph for main.cc:

Functions

int main (int argc, char **argv)
 Program entry point.
 

Detailed Description

Program entry point: parse the parameter file and run a SaddlePointProblem<2>.

The main() function is intentionally short. Its job is to

  1. pick the parameter file name from the command line (defaulting to "project.prm" when no argument is given),
  2. build a ParameterHandler and let SaddlePointProblem<2>::Parameters declare its entries on it,
  3. parse the parameter file and read the values back into the Parameters object,
  4. construct a SaddlePointProblem<2> problem and call its run() method, and
  5. catch every exception so the program can print a diagnostic message before aborting.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Program entry point.

Usage:

./step-6 [param-file]

If no parameter file is given on the command line, the default name "project.prm" is used. The chosen file must contain the entries declared by SaddlePointProblem::Parameters::declare_parameters().

The body of main is wrapped in a try/catch block: any std::exception thrown deeper in the program will be reported on std::cerr, and the program will return 1 instead of aborting silently. A second catch-all handler reports unknown exception types.

Parameters
[in]argcNumber of command-line arguments.
[in]argvCommand-line argument vector. argv[1], if present, is the path to the parameter file.
Returns
0 on successful execution, 1 on any uncaught exception.