Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
parameter
Sacado_ParameterRegistration.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_PARAMETERREGISTRATION_HPP
31
#define SACADO_PARAMETERREGISTRATION_HPP
32
33
#include <sstream>
34
#include "
Sacado_ParameterAccessor.hpp
"
35
#include "
Sacado_Traits.hpp
"
36
#include "
Sacado_ScalarParameterLibrary.hpp
"
37
38
namespace
Sacado
{
39
45
template
<
typename
EvalType,
typename
EvalTypeTraits = DefaultEvalTypeTraits>
46
class
ParameterRegistration
:
47
public
Sacado::ScalarParameterEntry
<EvalType, EvalTypeTraits > {
48
50
typedef
typename
EvalTypeTraits::template apply<EvalType>::type
ScalarT
;
51
52
53
public
:
54
55
typedef
ScalarParameterLibrary<EvalTypeTraits>
ParamLib
;
56
58
ParameterRegistration
(
const
std::string &name_,
59
ParameterAccessor<EvalType, EvalTypeTraits>
* access_,
60
ParamLib
& paramLib)
61
:
access
(access_),
name
(name_) {
62
63
if
(!paramLib.
isParameter
(
name
))
64
paramLib.
addParameterFamily
(
name
,
true
,
false
);
65
if (!paramLib.template isParameterForType<EvalType>(
name
))
66
paramLib.template addEntry<EvalType>(
name
, Teuchos::rcp(
this
,
false
));
67
}
68
70
ParameterRegistration
(
const
std::string &name_,
71
ParameterAccessor<EvalType, EvalTypeTraits>
* access_,
72
const
Teuchos::RCP<ParamLib>& paramLib)
73
:
access
(access_),
name
(name_) {
74
75
if
(paramLib != Teuchos::null) {
76
if
(!paramLib->isParameter(
name
))
77
paramLib->addParameterFamily(
name
,
true
,
false
);
78
if
(!paramLib->template isParameterForType<EvalType>(
name
)) {
79
paramLib->template addEntry<EvalType>(
name
, Teuchos::rcp(
this
,
false
));
80
}
81
}
82
}
83
85
virtual
~ParameterRegistration
() {}
86
88
virtual
void
setRealValue
(
double
value) {
89
setValue
(
ScalarT
(value)); }
90
92
virtual
void
setValue
(
const
ScalarT
& value) {
93
access
->setValue(
name
, value);
94
}
95
97
virtual
const
ScalarT
&
getValue
()
const
{
98
return
access
->getValue(
name
);
99
}
100
101
protected
:
102
104
ParameterAccessor<EvalType, EvalTypeTraits>
*
access
;
105
const
std::string
name
;
106
107
};
108
109
}
110
111
#endif
// SACADO_PARAMETERREGISTRATION_HPP
Sacado_ParameterAccessor.hpp
Sacado_ScalarParameterLibrary.hpp
Sacado_Traits.hpp
Sacado::ParameterAccessor
Abstract class that provides access to a parameter value in a code for the parameter library....
Definition
Sacado_ParameterAccessor.hpp:50
Sacado::ParameterLibraryBase::isParameter
bool isParameter(const std::string &name) const
Determine if parameter of name name is in the library.
Definition
Sacado_ParameterLibraryBaseImp.hpp:47
Sacado::ParameterLibraryBase::addParameterFamily
bool addParameterFamily(const std::string &name, bool supports_ad, bool supports_analytic)
Create a new parameter family.
Definition
Sacado_ParameterLibraryBaseImp.hpp:75
Sacado::ParameterRegistration::ParamLib
ScalarParameterLibrary< EvalTypeTraits > ParamLib
Definition
Sacado_ParameterRegistration.hpp:55
Sacado::ParameterRegistration::ParameterRegistration
ParameterRegistration(const std::string &name_, ParameterAccessor< EvalType, EvalTypeTraits > *access_, const Teuchos::RCP< ParamLib > ¶mLib)
Constructor: Registers the parameter with the Parameter Library.
Definition
Sacado_ParameterRegistration.hpp:70
Sacado::ParameterRegistration::~ParameterRegistration
virtual ~ParameterRegistration()
Destructor.
Definition
Sacado_ParameterRegistration.hpp:85
Sacado::ParameterRegistration::setRealValue
virtual void setRealValue(double value)
Set real parameter value.
Definition
Sacado_ParameterRegistration.hpp:88
Sacado::ParameterRegistration::ParameterRegistration
ParameterRegistration(const std::string &name_, ParameterAccessor< EvalType, EvalTypeTraits > *access_, ParamLib ¶mLib)
Constructor: Registers the parameter with the Parameter Library.
Definition
Sacado_ParameterRegistration.hpp:58
Sacado::ParameterRegistration::name
const std::string name
Definition
Sacado_ParameterRegistration.hpp:105
Sacado::ParameterRegistration::access
ParameterAccessor< EvalType, EvalTypeTraits > * access
Pointer to source function.
Definition
Sacado_ParameterRegistration.hpp:104
Sacado::ParameterRegistration::ScalarT
EvalTypeTraits::template apply< EvalType >::type ScalarT
Scalar type.
Definition
Sacado_ParameterRegistration.hpp:50
Sacado::ParameterRegistration::getValue
virtual const ScalarT & getValue() const
Get parameter value using ParameterAccessor.
Definition
Sacado_ParameterRegistration.hpp:97
Sacado::ParameterRegistration::setValue
virtual void setValue(const ScalarT &value)
Set parameter values using ParameterAccessor.
Definition
Sacado_ParameterRegistration.hpp:92
Sacado::ScalarParameterEntry
A base class for scalar parameter values.
Definition
Sacado_ScalarParameterEntry.hpp:87
Sacado::ScalarParameterLibrary
Specialization of Sacado::ParameterLibraryBase for scalar parameters.
Definition
Sacado_ScalarParameterLibrary.hpp:48
Sacado
Definition
Sacado_mpl_apply.hpp:39
Generated by
1.17.0