MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
MAST::Utility::GetPotWrapper Class Reference

Detailed Description

Definition at line 33 of file getpot_wrapper.hpp.

#include <getpot_wrapper.hpp>

Public Member Functions

 GetPotWrapper (const int argc, char **argv, const std::string &input)
 Identifies if an input file name is provided in argc by the parameter name input. More...
 
 GetPotWrapper (const int argc, char **argv)
 creates a wrapper around the input arguments given to the executable in argc and argv More...
 
 GetPotWrapper (const std::string &file)
 creates a wrapper for the input arguments in the input file named file. More...
 
virtual ~GetPotWrapper ()
 
GetPot & get ()
 
const char * operator() (const std::string &nm, const std::string &doc, const char *v)
 
template<typename ValType >
ValType operator() (const std::string &nm, const std::string &doc, const ValType &v)
 
template<typename ValType >
ValType operator() (const std::string &nm, const std::string &doc, const ValType &v, const unsigned int i)
 
void set_print (bool f)
 

Protected Attributes

GetPot * _input
 
bool _print
 

Constructor & Destructor Documentation

◆ GetPotWrapper() [1/3]

MAST::Utility::GetPotWrapper::GetPotWrapper ( const int  argc,
char **  argv,
const std::string &  input 
)
inline

Identifies if an input file name is provided in argc by the parameter name input.

If found, the input parameters are extracted from the input file, otherwise they are obtained from argc.

Definition at line 43 of file getpot_wrapper.hpp.

45  :
46  _input (nullptr),
47  _print (false) {
48 
49  GetPot command_line(argc, argv);
50  std::string
51  input_name = command_line(input, "");
52 
53  if (input_name == "")
54  _input = new GetPot(argc, argv);
55  else
56  _input = new GetPot(input_name);
57 
58  _print = (*_input)("print_params", false);
59  }

◆ GetPotWrapper() [2/3]

MAST::Utility::GetPotWrapper::GetPotWrapper ( const int  argc,
char **  argv 
)
inline

creates a wrapper around the input arguments given to the executable in argc and argv

Definition at line 66 of file getpot_wrapper.hpp.

66  :
67  _input (new GetPot(argc, argv)),
68  _print (false) {}

◆ GetPotWrapper() [3/3]

MAST::Utility::GetPotWrapper::GetPotWrapper ( const std::string &  file)
inline

creates a wrapper for the input arguments in the input file named file.

Definition at line 74 of file getpot_wrapper.hpp.

74  :
75  _input (new GetPot(file)),
76  _print (false) {
77 
78  }

◆ ~GetPotWrapper()

virtual MAST::Utility::GetPotWrapper::~GetPotWrapper ( )
inlinevirtual

Definition at line 80 of file getpot_wrapper.hpp.

80  {
81  delete _input;
82  }

Member Function Documentation

◆ get()

GetPot& MAST::Utility::GetPotWrapper::get ( )
inline

Definition at line 85 of file getpot_wrapper.hpp.

85  {
86  return *_input;
87  }

◆ operator()() [1/3]

const char* MAST::Utility::GetPotWrapper::operator() ( const std::string &  nm,
const std::string &  doc,
const char *  v 
)
inline

Definition at line 94 of file getpot_wrapper.hpp.

94  {
95 
96  if (_print)
97  libMesh::out
98  << nm << " : " << doc
99  << " [Default: v = " << v << " ]" << std::endl;
100 
101  return (*_input)(nm, v);
102  }

◆ operator()() [2/3]

template<typename ValType >
ValType MAST::Utility::GetPotWrapper::operator() ( const std::string &  nm,
const std::string &  doc,
const ValType &  v 
)
inline

Definition at line 106 of file getpot_wrapper.hpp.

106  {
107 
108  if (_print)
109  libMesh::out
110  << nm << " : " << doc
111  << " [Default: v = " << v << " ]" << std::endl;
112 
113  return (*_input)(nm, v);
114  }

◆ operator()() [3/3]

template<typename ValType >
ValType MAST::Utility::GetPotWrapper::operator() ( const std::string &  nm,
const std::string &  doc,
const ValType &  v,
const unsigned int  i 
)
inline

Definition at line 117 of file getpot_wrapper.hpp.

117  {
118 
119 
120  if (_print)
121  libMesh::out
122  << "Vector: " << nm << " : " << doc
123  << " [ Default: v(i) = " << v << " ] " << std::endl;
124 
125  return (*_input)(nm, v, i);
126  }

◆ set_print()

void MAST::Utility::GetPotWrapper::set_print ( bool  f)
inline

Definition at line 89 of file getpot_wrapper.hpp.

89  {
90  _print = f;
91  }

Member Data Documentation

◆ _input

GetPot* MAST::Utility::GetPotWrapper::_input
protected

Definition at line 131 of file getpot_wrapper.hpp.

◆ _print

bool MAST::Utility::GetPotWrapper::_print
protected

Definition at line 132 of file getpot_wrapper.hpp.


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