Microflow 3D  v1.0
MF::Parser::CmdLineArgsParser Class Reference

The object of CmdLineArgsParser class parses parameters and its values transferred through the command line at program start-up. More...

#include <CmdLineArgsParser.h>

Public Member Functions

 CmdLineArgsParser ()=default
 
 ~CmdLineArgsParser ()=default
 
void parseCmdLineArgs (int argc, char **argv, const char *&pathToProgramConfigFile, const char *&pathToCaseFolder, const char *&scope, bool &verbose, bool &geometryOnly, int &CPU_ThreadsNr)
 

Static Public Member Functions

static std::shared_ptr< MF::Parser::CmdLineArgsParserNew ()
 

Detailed Description

The object of CmdLineArgsParser class parses parameters and its values transferred through the command line at program start-up.

Definition at line 21 of file CmdLineArgsParser.h.

Constructor & Destructor Documentation

◆ CmdLineArgsParser()

MF::Parser::CmdLineArgsParser::CmdLineArgsParser ( )
default

◆ ~CmdLineArgsParser()

MF::Parser::CmdLineArgsParser::~CmdLineArgsParser ( )
default

Member Function Documentation

◆ New()

static std::shared_ptr<MF::Parser::CmdLineArgsParser> MF::Parser::CmdLineArgsParser::New ( )
inlinestatic

Definition at line 27 of file CmdLineArgsParser.h.

References parseCmdLineArgs().

Referenced by main().

27  {
28  auto CmdLineArgsParser_Ptr = std::make_shared<MF::Parser::CmdLineArgsParser>();
29  return CmdLineArgsParser_Ptr;
30  };

◆ parseCmdLineArgs()

void MF::Parser::CmdLineArgsParser::parseCmdLineArgs ( int  argc,
char **  argv,
const char *&  pathToProgramConfigFile,
const char *&  pathToCaseFolder,
const char *&  scope,
bool &  verbose,
bool &  geometryOnly,
int &  CPU_ThreadsNr 
)

Definition at line 12 of file CmdLineArgsParser.cpp.

Referenced by New().

14 {
15 
16  for (int i = 1; i < argc; i++)
17  {
18  if (strcmp(argv[i], "-h") == 0)
19  usageInfo();
20  else if (strcmp(argv[i], "-f") == 0)
21  {
22  if (i == argc-1)
23  usageInfo();
24  pathToProgramConfigFile = argv[i+1];
25  i++;
26  }
27  else if (strcmp(argv[i], "-cf") == 0)
28  {
29  if (i == argc-1)
30  usageInfo();
31  pathToCaseFolder = argv[i+1];
32  i++;
33  }
34  else if (strcmp(argv[i], "-g") == 0)
35  {
36  geometryOnly = true;
37  }
38  else if (strcmp(argv[i], "-j") == 0)
39  {
40  if (i == argc-1)
41  usageInfo();
42  CPU_ThreadsNr = std::stoul(argv[i+1]);
43  i++;
44  }
45  else if (strcmp(argv[i], "-s") == 0)
46  {
47  if (i == argc-1)
48  usageInfo();
49  scope = argv[i+1];
50  i++;
51  }
52  else if (strcmp(argv[i], "-v") == 0)
53  {
54  verbose = true;
55  }
56  else
57  {
58  std::cout << "Unrecognised option \n\n" << argv[i] << std::endl;
59  usageInfo();
60  }
61  }
62 }

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