Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_ParameterFamilyBase.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef SACADO_PARAMETERFAMILYBASE_HPP
11 #define SACADO_PARAMETERFAMILYBASE_HPP
12 
13 #include <map>
14 #include <string>
15 #include <iostream>
16 
17 #include "Teuchos_RCP.hpp"
18 #include "Sacado_mpl_apply.hpp"
19 
20 namespace Sacado {
21 
26  template <typename EntryBase, typename EntryType>
28 
29  public:
30 
32  ParameterFamilyBase(const std::string& name,
33  bool supports_ad,
34  bool supports_analytic);
35 
37  virtual ~ParameterFamilyBase();
38 
40  std::string getName() const;
41 
43  bool supportsAD() const;
44 
46  bool supportsAnalytic() const;
47 
49  template <typename EvalType>
50  bool hasType() const;
51 
53 
58  template <typename EvalType>
59  bool
61  const bool allow_overwrite = false);
62 
64  template <typename EvalType>
66  getEntry();
67 
69  template <typename EvalType>
71  getEntry() const;
72 
74 
78  void print(std::ostream& os, bool print_values = false) const;
79 
80  protected:
81 
83  typedef std::map<std::string, Teuchos::RCP<EntryBase> > EvalMap;
84 
86  typedef typename EvalMap::const_iterator const_iterator;
87 
89  typedef typename EvalMap::iterator iterator;
90 
92  template <class EvalType> std::string getTypeName() const;
93 
94  private:
95 
98 
101 
102  protected:
103 
106 
108  const std::string name;
109 
112 
115 
116  };
117 }
118 
119 // Include template definitions
121 
122 #endif
ParameterFamilyBase(const std::string &name, bool supports_ad, bool supports_analytic)
Constructor.
const std::string name
Family name.
EvalMap::const_iterator const_iterator
Const iterator for EvalMap.
EvalMap::iterator iterator
Iterator for EvalMap.
std::string getTypeName() const
Returns a string representation of type EntryType.
std::string getName() const
Get the name of the family.
F::template apply< A1, A2, A3, A4, A5 >::type type
void print(std::ostream &os, bool print_values=false) const
Print the family.
bool addEntry(const Teuchos::RCP< typename Sacado::mpl::apply< EntryType, EvalType >::type > &entry, const bool allow_overwrite=false)
Add a new parameter using custom entry.
bool hasType() const
Determine if family has an entry for the given type EvalType.
Teuchos::RCP< typename Sacado::mpl::apply< EntryType, EvalType >::type > getEntry()
Gets the entry corresponding to type EvalType.
EvalMap family
Family of parameter entries.
bool supportsAD() const
Indicates whether parameter supports AD derivatives.
ParameterFamilyBase & operator=(const ParameterFamilyBase &)
Private to prohibit copying.
std::map< std::string, Teuchos::RCP< EntryBase > > EvalMap
Map of entries for a parameter name.
bool supportsAnalytic() const
Indicates whether parameter supports analytic derivatives.
bool supports_analytic
Family supports analytic derivatives.