MFEM  v3.3.2
Finite element discretization library
Classes | Public Types | Public Member Functions | List of all members
mfem::OptionsParser Class Reference

#include <optparser.hpp>

Public Types

enum  OptionType {
  INT, DOUBLE, STRING, ENABLE,
  DISABLE, ARRAY, VECTOR
}
 

Public Member Functions

 OptionsParser (int _argc, char *_argv[])
 
void AddOption (bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
 
void AddOption (int *var, const char *short_name, const char *long_name, const char *description, bool required=false)
 
void AddOption (double *var, const char *short_name, const char *long_name, const char *description, bool required=false)
 
void AddOption (const char **var, const char *short_name, const char *long_name, const char *description, bool required=false)
 
void AddOption (Array< int > *var, const char *short_name, const char *long_name, const char *description, bool required=false)
 
void AddOption (Vector *var, const char *short_name, const char *long_name, const char *description, bool required=false)
 
void Parse ()
 
bool Good () const
 
bool Help () const
 
void PrintOptions (std::ostream &out) const
 
void PrintError (std::ostream &out) const
 
void PrintHelp (std::ostream &out) const
 
void PrintUsage (std::ostream &out) const
 

Detailed Description

Class for parsing command-line options.

The class is initialized with argc and argv, and new options are added with the AddOption method. Currently options of type bool, int, double, char*, mfem::Array<int>, and mfem::Vector are supported.

See the MFEM examples for sample use.

Definition at line 31 of file optparser.hpp.

Member Enumeration Documentation

Enumerator
INT 
DOUBLE 
STRING 
ENABLE 
DISABLE 
ARRAY 
VECTOR 

Definition at line 34 of file optparser.hpp.

Constructor & Destructor Documentation

mfem::OptionsParser::OptionsParser ( int  _argc,
char *  _argv[] 
)
inline

Definition at line 69 of file optparser.hpp.

Member Function Documentation

void mfem::OptionsParser::AddOption ( bool *  var,
const char *  enable_short_name,
const char *  enable_long_name,
const char *  disable_short_name,
const char *  disable_long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 74 of file optparser.hpp.

void mfem::OptionsParser::AddOption ( int *  var,
const char *  short_name,
const char *  long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 84 of file optparser.hpp.

void mfem::OptionsParser::AddOption ( double *  var,
const char *  short_name,
const char *  long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 90 of file optparser.hpp.

void mfem::OptionsParser::AddOption ( const char **  var,
const char *  short_name,
const char *  long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 96 of file optparser.hpp.

void mfem::OptionsParser::AddOption ( Array< int > *  var,
const char *  short_name,
const char *  long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 103 of file optparser.hpp.

void mfem::OptionsParser::AddOption ( Vector var,
const char *  short_name,
const char *  long_name,
const char *  description,
bool  required = false 
)
inline

Definition at line 110 of file optparser.hpp.

bool mfem::OptionsParser::Good ( ) const
inline

Definition at line 120 of file optparser.hpp.

bool mfem::OptionsParser::Help ( ) const
inline

Definition at line 121 of file optparser.hpp.

void mfem::OptionsParser::Parse ( )

Definition at line 150 of file optparser.cpp.

void mfem::OptionsParser::PrintError ( std::ostream &  out) const

Definition at line 335 of file optparser.cpp.

void mfem::OptionsParser::PrintHelp ( std::ostream &  out) const

Definition at line 378 of file optparser.cpp.

void mfem::OptionsParser::PrintOptions ( std::ostream &  out) const

Definition at line 304 of file optparser.cpp.

void mfem::OptionsParser::PrintUsage ( std::ostream &  out) const

Definition at line 434 of file optparser.cpp.


The documentation for this class was generated from the following files: