Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
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
40namespace Sacado {
41
46 template <typename EntryBase, typename EntryType>
48
49 public:
50
52 ParameterFamilyBase(const std::string& name,
53 bool supports_ad,
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
80 addEntry(const Teuchos::RCP< typename Sacado::mpl::apply<EntryType,EvalType>::type >& entry,
81 const bool allow_overwrite = false);
82
84 template <typename EvalType>
85 Teuchos::RCP< typename Sacado::mpl::apply<EntryType,EvalType>::type >
86 getEntry();
87
89 template <typename EvalType>
90 Teuchos::RCP< const typename Sacado::mpl::apply<EntryType,EvalType>::type >
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
std::string getTypeName() const
Returns a string representation of type EntryType.
Teuchos::RCP< typename Sacado::mpl::apply< EntryType, EvalType >::type > getEntry()
Gets the entry corresponding to type EvalType.
bool hasType() const
Determine if family has an entry for the given type EvalType.
std::map< std::string, Teuchos::RCP< EntryBase > > EvalMap
Map of entries for a parameter name.
ParameterFamilyBase & operator=(const ParameterFamilyBase &)
Private to prohibit copying.
bool supportsAD() const
Indicates whether parameter supports AD derivatives.
std::string getName() const
Get the name of the family.
ParameterFamilyBase(const std::string &name, bool supports_ad, bool supports_analytic)
Constructor.
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.
EvalMap family
Family of parameter entries.
EvalMap::const_iterator const_iterator
Const iterator for EvalMap.
ParameterFamilyBase(const ParameterFamilyBase &)
Private to prohibit copying.
bool supportsAnalytic() const
Indicates whether parameter supports analytic derivatives.
const std::string name
Family name.
bool supports_analytic
Family supports analytic derivatives.
EvalMap::iterator iterator
Iterator for EvalMap.
F::template apply< A1, A2, A3, A4, A5 >::type type