IFEM  90A354
LinSolParams.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
14 //==============================================================================
15 
16 #ifndef _LIN_SOL_PARAMS_H
17 #define _LIN_SOL_PARAMS_H
18 
19 #include "LinAlgenums.h"
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 namespace tinyxml2 { class XMLElement; }
25 
26 
32 {
33 public:
37  void addValue(const std::string& key, const std::string& value);
38 
41  std::string getStringValue(const std::string& key) const;
42 
45  int getIntValue(const std::string& key) const;
46 
49  double getDoubleValue(const std::string& key) const;
50 
53  bool hasValue(const std::string& key) const;
54 
55 protected:
56  std::map<std::string,std::string> values;
57 };
58 
59 
66 class LinSolParams : public SettingMap
67 {
68 public:
72  LinSolParams(const LinSolParams& par,
74 
76  bool read(const tinyxml2::XMLElement* elem);
77 
79  class BlockParams : public SettingMap
80  {
81  public:
83  BlockParams();
84 
86  struct DirSmoother
87  {
88  int order;
89  std::string type;
90  };
91 
95  bool read(const tinyxml2::XMLElement* child, const std::string& prefix = "");
96 
97  size_t basis;
98  size_t comps;
99  std::vector<DirSmoother> dirSmoother;
100  };
101 
103  size_t getNoBlocks() const { return blocks.size(); }
104 
106  const BlockParams& getBlock(size_t i) const { return blocks[i]; }
107 
110 
111 private:
112  std::vector<BlockParams> blocks;
114 };
115 
116 #endif
Various enums for linear algebra scope.
Linear solver settings for a block of the linear system.
Definition: LinSolParams.h:80
BlockParams()
Default constructor.
Definition: LinSolParams.C:62
size_t comps
Components from basis (1, 2, 3, 12, 13, 23, 123, ..., 0 = all)
Definition: LinSolParams.h:98
size_t basis
Basis for block.
Definition: LinSolParams.h:97
std::vector< DirSmoother > dirSmoother
Directional smoother data.
Definition: LinSolParams.h:99
bool read(const tinyxml2::XMLElement *child, const std::string &prefix="")
Read settings from XML block.
Definition: LinSolParams.C:86
Class for linear solver parameters.
Definition: LinSolParams.h:67
LinAlg::LinearSystemType linSys
Type of linear system matrix.
Definition: LinSolParams.h:113
bool read(const tinyxml2::XMLElement *elem)
Read linear solver parameters from XML document.
Definition: LinSolParams.C:158
size_t getNoBlocks() const
Number of blocks in matrix system.
Definition: LinSolParams.h:103
std::vector< BlockParams > blocks
Parameters for each block.
Definition: LinSolParams.h:112
const BlockParams & getBlock(size_t i) const
Obtain settings for a given block.
Definition: LinSolParams.h:106
LinAlg::LinearSystemType getLinSysType() const
Returns the linear system type.
Definition: LinSolParams.h:109
LinSolParams(LinAlg::LinearSystemType ls=LinAlg::GENERAL_MATRIX)
Default constructor.
Definition: LinSolParams.C:68
A key-value store for settings.
Definition: LinSolParams.h:32
bool hasValue(const std::string &key) const
Checks if the store holds a value for a key.
Definition: LinSolParams.C:56
std::string getStringValue(const std::string &key) const
Obtain a value as a string.
Definition: LinSolParams.C:26
void addValue(const std::string &key, const std::string &value)
Add a value to the store.
Definition: LinSolParams.C:20
int getIntValue(const std::string &key) const
Obtain a value as an integer.
Definition: LinSolParams.C:36
double getDoubleValue(const std::string &key) const
Obtain a value as an double.
Definition: LinSolParams.C:46
std::map< std::string, std::string > values
Map of key-value pairs.
Definition: LinSolParams.h:56
LinearSystemType
Enum defining linear system properties.
Definition: LinAlgenums.h:35
@ GENERAL_MATRIX
General matrix.
Definition: LinAlgenums.h:36
Settings for a directional smoother.
Definition: LinSolParams.h:87
std::string type
Directional smoother types.
Definition: LinSolParams.h:89
int order
Ordering of DOFs.
Definition: LinSolParams.h:88