Fluid structure interaction suite
constants.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 by Luca Heltai
4 //
5 // This file is part of the FSI-suite platform, based on the deal.II library.
6 //
7 // The FSI-suite platform is free software; you can use it, redistribute it,
8 // and/or modify it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation; either version 3.0 of the License,
10 // or (at your option) any later version. The full text of the license can be
11 // found in the file LICENSE at the top level of the FSI-suite platform
12 // distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef parsed_tools_constants_h
17 #define parsed_tools_constants_h
18 
20 
22 
23 namespace ParsedTools
24 {
43  class Constants : public dealii::ParameterAcceptor
44  {
45  public:
98  Constants(
99  const std::string &section_name = "",
100  const std::vector<std::string> &names = {},
101  const std::vector<double> &default_values = {},
102  const std::vector<std::string> &optional_names_for_parameter_file = {},
103  const std::vector<std::string> &optional_documentation_strings = {});
104 
108  operator const std::map<std::string, double> &() const;
109 
110 #ifdef DEAL_II_WITH_SYMENGINE
115  operator const dealii::Differentiation::SD::types::substitution_map &()
116  const;
117 #endif
118 
125  const double &
126  operator[](const std::string &key) const;
127 
128  private:
132  std::map<std::string, double> constants;
133 
134 
135 #ifdef DEAL_II_WITH_SYMENGINE
140  mutable dealii::Differentiation::SD::types::substitution_map
142 #endif
143 
144 
149  std::map<std::string, std::string> constants_parameter_entries;
150 
154  std::map<std::string, std::string> constants_documentation;
155  };
156 } // namespace ParsedTools
157 #endif
const std::string section_name
A wrapper for physical constants to be shared among functions and classes.
Definition: constants.h:44
Differentiation::SD::types::substitution_map constant_substitution_map
Return the constants defined in this class as a Differentiation::SD::types::substitution_map.
Definition: constants.h:141
Constants(const std::string &section_name="", const std::vector< std::string > &names={}, const std::vector< double > &default_values={}, const std::vector< std::string > &optional_names_for_parameter_file={}, const std::vector< std::string > &optional_documentation_strings={})
Build a ParameterAcceptor based collection of constants.
Definition: constants.cc:24
std::map< std::string, std::string > constants_documentation
The documentation of each constant.
Definition: constants.h:154
std::map< std::string, std::string > constants_parameter_entries
The documentation string used to parse the constants from the parameter file.
Definition: constants.h:149
std::map< std::string, double > constants
The actual constants.
Definition: constants.h:132
const double & operator[](const std::string &key) const
Return the constant associated with the given name.
Definition: constants.cc:83
We collect in this namespace some wrappers around commonly used deal.II classes, derived from the Par...