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 //
4 // Sacado Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25 // (etphipp@sandia.gov).
26 //
27 // ***********************************************************************
28 // @HEADER
29 
30 #ifndef SACADO_PARAMETERFAMILYBASE_HPP
31 #define SACADO_PARAMETERFAMILYBASE_HPP
32 
33 #include <map>
34 #include <string>
35 #include <iostream>
36 
37 #include "Teuchos_RCP.hpp"
38 #include "Sacado_mpl_apply.hpp"
39 
40 namespace Sacado {
41 
46  template <typename EntryBase, typename EntryType>
48 
49  public:
50 
52  ParameterFamilyBase(const std::string& name,
53  bool supports_ad,
54  bool supports_analytic);
55 
57  virtual ~ParameterFamilyBase();
58 
60  std::string getName() const;
61 
63  bool supportsAD() const;
64 
66  bool supportsAnalytic() const;
67 
69  template <typename EvalType>
70  bool hasType() const;
71 
73 
78  template <typename EvalType>
79  bool
81  const bool allow_overwrite = false);
82 
84  template <typename EvalType>
86  getEntry();
87 
89  template <typename EvalType>
91  getEntry() const;
92 
94 
98  void print(std::ostream& os, bool print_values = false) const;
99 
100  protected:
101 
103  typedef std::map<std::string, Teuchos::RCP<EntryBase> > EvalMap;
104 
106  typedef typename EvalMap::const_iterator const_iterator;
107 
109  typedef typename EvalMap::iterator iterator;
110 
112  template <class EvalType> std::string getTypeName() const;
113 
114  private:
115 
118 
121 
122  protected:
123 
126 
128  const std::string name;
129 
132 
135 
136  };
137 }
138 
139 // Include template definitions
141 
142 #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.