NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble::CommandLineConfiguration Class Reference

#include <nimble_cli.h>

Classes

struct  impl
 

Public Member Functions

 CommandLineConfiguration (int argc, char **argv)
 
 CommandLineConfiguration (const CommandLineConfiguration &)=delete
 
 CommandLineConfiguration (CommandLineConfiguration &&) noexcept
 
virtual ~CommandLineConfiguration ()
 
CommandLineConfigurationoperator= (const CommandLineConfiguration &)=delete
 
CommandLineConfigurationoperator= (CommandLineConfiguration &&) noexcept
 
virtual void ConfigureCommandLineArguments ()
 
int ParseAndGetErrorCode ()
 
bool UseTpetra () const noexcept
 
bool UseVT () const noexcept
 
bool UseUQ () const noexcept
 
const std::string & InputFilename () const noexcept
 
int & ArgC () noexcept
 
char **& ArgV () noexcept
 

Constructor & Destructor Documentation

◆ CommandLineConfiguration() [1/3]

nimble::CommandLineConfiguration::CommandLineConfiguration ( int argc,
char ** argv )
65 : impl_{std::make_unique< impl >()}
66{
67 impl_->argc_ = argc;
68 impl_->argv_ = argv;
69}

◆ CommandLineConfiguration() [2/3]

nimble::CommandLineConfiguration::CommandLineConfiguration ( const CommandLineConfiguration & )
delete

◆ CommandLineConfiguration() [3/3]

nimble::CommandLineConfiguration::CommandLineConfiguration ( CommandLineConfiguration && )
defaultnoexcept

◆ ~CommandLineConfiguration()

nimble::CommandLineConfiguration::~CommandLineConfiguration ( )
virtualdefault

Member Function Documentation

◆ ArgC()

int & nimble::CommandLineConfiguration::ArgC ( )
noexcept
149{
150 return impl_->argc_;
151}

◆ ArgV()

char **& nimble::CommandLineConfiguration::ArgV ( )
noexcept
155{
156 return impl_->argv_;
157}

◆ ConfigureCommandLineArguments()

void nimble::CommandLineConfiguration::ConfigureCommandLineArguments ( )
virtual
79 {
80 impl_->cli_app_.allow_extras();
81
82
83 auto* tpetra_opt = impl_->cli_app_.add_flag("--use_tpetra", impl_->use_tpetra_, "Use TPetra solvers")
84 ->check([](const std::string&) -> std::string {
85#ifdef NIMBLE_HAVE_TRILINOS
86 return {}; // Empty string on success
87#else
88 return "NimbleSM was not built with Trilinos support";
89#endif
90 });
91
92 impl_->cli_app_.add_flag("--use_vt", impl_->use_vt_, "Use DARMA/vt for asynchronous distributed contact tasking")
93 ->check([](const std::string&) -> std::string {
94#ifdef NIMBLE_HAVE_VT
95 return {}; // Empty string on success
96#else
97 return "NimbleSM was not built with DARMA/vt support";
98#endif
99 });
100
101 impl_->cli_app_.add_flag("--use_uq", impl_->use_vt_, "Use UQ capability")->check([](const std::string&) -> std::string {
102#ifdef NIMBLE_HAVE_UQ
103 return {}; // Empty string on success
104#else
105 return "NimbleSM was not built with UQ support";
106#endif
107 });
108
109 impl_->cli_app_.add_option( "INPUT_FILE", impl_->input_filename_)->required()->check(CLI::ExistingFile);
110}

◆ InputFilename()

const std::string & nimble::CommandLineConfiguration::InputFilename ( ) const
noexcept
143{
144 return impl_->input_filename_;
145}

◆ operator=() [1/2]

CommandLineConfiguration & nimble::CommandLineConfiguration::operator= ( CommandLineConfiguration && )
defaultnoexcept

◆ operator=() [2/2]

CommandLineConfiguration & nimble::CommandLineConfiguration::operator= ( const CommandLineConfiguration & )
delete

◆ ParseAndGetErrorCode()

int nimble::CommandLineConfiguration::ParseAndGetErrorCode ( )
113 {
114 try {
115 impl_->cli_app_.parse(impl_->argc_, impl_->argv_);
116 } catch (const CLI::ParseError& e) {
117 return impl_->cli_app_.exit(e);
118 }
119
120 return 0;
121}

◆ UseTpetra()

bool nimble::CommandLineConfiguration::UseTpetra ( ) const
noexcept
125{
126 return impl_->use_tpetra_;
127}

◆ UseUQ()

bool nimble::CommandLineConfiguration::UseUQ ( ) const
noexcept
137{
138 return impl_->use_uq_;
139}

◆ UseVT()

bool nimble::CommandLineConfiguration::UseVT ( ) const
noexcept
131{
132 return impl_->use_vt_;
133}

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