FEDEM Solver  R8.0
Source code of the dynamics solver
FFaOptionFileCreator.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
13 #ifndef FFA_OPTION_FILE_CREATOR_H
14 #define FFA_OPTION_FILE_CREATOR_H
15 
16 #include <vector>
17 #include <string>
18 
19 class FaVec3;
20 
21 
27 {
28 public:
30  FFaOptionFileCreator(const std::string& fname = "") : myFilename(fname) {}
31 
33  void add(const std::string& optionName, bool val);
35  void add(const std::string& optionName, int val);
37  void add(const std::string& optionName, double val);
39  void add(const std::string& optionName, const std::pair<double,double>& val);
41  void add(const std::string& optionName, const FaVec3& val);
43  void add(const std::string& optionName, const std::vector<double>& val);
45  void add(const std::string& optionName, const std::string& val,
46  bool addQuotes = true);
47 
49  void addComment(const std::string& comment, bool lineInFront = false);
50 
52  std::vector<std::string> getOptVector() const;
53 
55  bool writeOptFile() const;
56 
57 private:
59  typedef std::pair<std::string,std::string> Option;
60 
61  std::vector<Option> myOptions;
62  std::string myFilename;
63 };
64 
65 #endif
static char * fname[_MAX_DBFIL]
Definition: binaryDB.c:35
Class for writing command-line option files for the solver modules.
Definition: FFaOptionFileCreator.H:27
bool writeOptFile() const
Writes the command-line options to file.
Definition: FFaOptionFileCreator.C:116
std::string myFilename
Name of the file to be written.
Definition: FFaOptionFileCreator.H:62
void addComment(const std::string &comment, bool lineInFront=false)
Adds a comment line.
Definition: FFaOptionFileCreator.C:21
std::pair< std::string, std::string > Option
Convenience type definition.
Definition: FFaOptionFileCreator.H:59
FFaOptionFileCreator(const std::string &fname="")
Default constructor.
Definition: FFaOptionFileCreator.H:30
void add(const std::string &optionName, bool val)
Adds a bool-valued command-line option.
Definition: FFaOptionFileCreator.C:36
std::vector< std::string > getOptVector() const
Returns all options with values as a vector of strings.
Definition: FFaOptionFileCreator.C:100
std::vector< Option > myOptions
List of command-line options with value.
Definition: FFaOptionFileCreator.H:61
Class for point vectors in 3D space.
Definition: FFaVec3.H:40