NLMech  0.1.0
solverDeck.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef INP_SOLVERDECK_H
10 #define INP_SOLVERDECK_H
11 
12 #include <iostream> // error handling
13 #include <vector>
14 #include "util/utilIO.h"
15 
16 namespace inp {
17 
24 struct SolverDeck {
25 
27  std::string d_solverType;
28 
31 
33  double d_tol;
34 
37 
41  SolverDeck() : d_maxIters(0), d_tol(0.){};
42 
52  std::string printStr(int nt = 0, int lvl = 0) const {
53  auto tabS = util::io::getTabS(nt);
54  std::ostringstream oss;
55  oss << tabS << "------- SolverDeck --------" << std::endl << std::endl;
56  oss << tabS << "Solver type = " << d_solverType << std::endl;
57  oss << tabS << "Max iterations = " << d_maxIters << std::endl;
58  oss << tabS << "Tolerance = " << d_tol << std::endl;
59  oss << tabS << "Perturbation = " << d_perturbation << std::endl;
60  oss << tabS << std::endl;
61 
62  return oss.str();
63  };
64 
72  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
73 };
74 
77 } // namespace inp
78 
79 #endif // INP_SOLVERDECK_H
Collection of methods and database related to input.
Definition: main.cpp:21
std::string getTabS(int nt)
Generate a string contaning nt tabs.
Definition: utilIO.h:26
Structure to read and store solver related input data.
Definition: solverDeck.h:24
SolverDeck()
Constructor.
Definition: solverDeck.h:41
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: solverDeck.h:72
int d_maxIters
Maximum iterations.
Definition: solverDeck.h:30
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: solverDeck.h:52
double d_tol
Tolerance.
Definition: solverDeck.h:33
std::string d_solverType
Solver type.
Definition: solverDeck.h:27
double d_perturbation
Perturbation for the finite difference approximation in the implicit time integration.
Definition: solverDeck.h:36