Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
parameter
Sacado_ParameterVectorBase.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_PARAMETERVECTORBASE_HPP
31
#define SACADO_PARAMETERVECTORBASE_HPP
32
33
#include <vector>
34
35
#include "Teuchos_Array.hpp"
36
37
#include "
Sacado_ParameterFamilyBase.hpp
"
38
39
namespace
Sacado
{
40
46
template
<
typename
FamilyType,
typename
BaseValueType>
47
class
ParameterVectorBase
{
48
49
public
:
50
52
struct
Entry
{
53
55
Teuchos::RCP<FamilyType>
family
;
56
58
BaseValueType
baseValue
;
59
61
Entry
(
const
Teuchos::RCP<FamilyType>& f, BaseValueType bv) :
62
family
(f),
baseValue
(bv) {}
63
64
};
65
66
protected
:
67
69
typedef
Teuchos::Array<Entry>
EntryVector
;
70
71
public
:
72
74
typedef
typename
EntryVector::iterator
iterator
;
75
77
typedef
typename
EntryVector::const_iterator
const_iterator
;
78
80
ParameterVectorBase
() {}
81
83
ParameterVectorBase
(
const
ParameterVectorBase
& source) :
84
params
(source.
params
) {}
85
87
virtual
~ParameterVectorBase
() {}
88
90
ParameterVectorBase
&
operator =
(
const
ParameterVectorBase
& source) {
91
params
= source.
params
;
return
*
this
; }
92
94
void
addParam
(
const
Teuchos::RCP<FamilyType>& family,
95
BaseValueType baseValue) {
96
params
.push_back(
Entry
(family, baseValue));
97
}
98
100
unsigned
int
size
()
const
{
return
params
.size(); }
101
103
Entry
&
operator[]
(
int
i) {
return
params
[i]; }
104
106
const
Entry
&
operator[]
(
int
i)
const
{
return
params
[i]; }
107
109
iterator
begin
() {
return
params
.begin(); }
110
112
const_iterator
begin
()
const
{
return
params
.begin(); }
113
115
iterator
end
() {
return
params
.end(); }
116
118
const_iterator
end
()
const
{
return
params
.end(); }
119
121
void
122
filterParameters
(
ParameterVectorBase
& ad,
123
ParameterVectorBase
& analytic,
124
ParameterVectorBase
& other,
125
std::vector<int>& index_ad,
126
std::vector<int>& index_analytic,
127
std::vector<int>& index_other) {
128
index_ad.resize(0);
129
index_analytic.resize(0);
130
index_other.resize(0);
131
132
typename
EntryVector::iterator it;
133
int
i;
134
for
(it =
params
.begin(), i=0; it !=
params
.end(); ++it, ++i) {
135
if
((*it).family->supportsAD()) {
136
ad.
params
.push_back(*it);
137
index_ad.push_back(i);
138
}
139
else
if
((*it).family->supportsAnalytic()) {
140
analytic.
params
.push_back(*it);
141
index_analytic.push_back(i);
142
}
143
else
{
144
other.
params
.push_back(*it);
145
index_other.push_back(i);
146
}
147
}
148
}
149
150
protected
:
151
153
EntryVector
params
;
154
};
155
}
156
157
#endif
Sacado_ParameterFamilyBase.hpp
Sacado::ParameterVectorBase::filterParameters
void filterParameters(ParameterVectorBase &ad, ParameterVectorBase &analytic, ParameterVectorBase &other, std::vector< int > &index_ad, std::vector< int > &index_analytic, std::vector< int > &index_other)
Filter vector into types.
Definition
Sacado_ParameterVectorBase.hpp:122
Sacado::ParameterVectorBase::addParam
void addParam(const Teuchos::RCP< FamilyType > &family, BaseValueType baseValue)
Add entry.
Definition
Sacado_ParameterVectorBase.hpp:94
Sacado::ParameterVectorBase::params
EntryVector params
Parameter vector.
Definition
Sacado_ParameterVectorBase.hpp:153
Sacado::ParameterVectorBase::begin
const_iterator begin() const
Iterator pointing at beginning of vector.
Definition
Sacado_ParameterVectorBase.hpp:112
Sacado::ParameterVectorBase::operator[]
Entry & operator[](int i)
Element access.
Definition
Sacado_ParameterVectorBase.hpp:103
Sacado::ParameterVectorBase::EntryVector
Teuchos::Array< Entry > EntryVector
Vector of all parameter families.
Definition
Sacado_ParameterVectorBase.hpp:69
Sacado::ParameterVectorBase::~ParameterVectorBase
virtual ~ParameterVectorBase()
Destructor.
Definition
Sacado_ParameterVectorBase.hpp:87
Sacado::ParameterVectorBase::begin
iterator begin()
Iterator pointing at beginning of vector.
Definition
Sacado_ParameterVectorBase.hpp:109
Sacado::ParameterVectorBase::operator=
ParameterVectorBase & operator=(const ParameterVectorBase &source)
Assignment.
Definition
Sacado_ParameterVectorBase.hpp:90
Sacado::ParameterVectorBase::ParameterVectorBase
ParameterVectorBase(const ParameterVectorBase &source)
Copy constructor.
Definition
Sacado_ParameterVectorBase.hpp:83
Sacado::ParameterVectorBase::iterator
EntryVector::iterator iterator
Iterator typename.
Definition
Sacado_ParameterVectorBase.hpp:74
Sacado::ParameterVectorBase::end
const_iterator end() const
Iterator pointing at end of vector.
Definition
Sacado_ParameterVectorBase.hpp:118
Sacado::ParameterVectorBase::const_iterator
EntryVector::const_iterator const_iterator
Const iterator typename.
Definition
Sacado_ParameterVectorBase.hpp:77
Sacado::ParameterVectorBase::size
unsigned int size() const
Return number of parameters in vector.
Definition
Sacado_ParameterVectorBase.hpp:100
Sacado::ParameterVectorBase::end
iterator end()
Iterator pointing at end of vector.
Definition
Sacado_ParameterVectorBase.hpp:115
Sacado::ParameterVectorBase::ParameterVectorBase
ParameterVectorBase()
Default constructor.
Definition
Sacado_ParameterVectorBase.hpp:80
Sacado
Definition
Sacado_mpl_apply.hpp:39
Sacado::ParameterVectorBase::Entry
Container for parameter entries.
Definition
Sacado_ParameterVectorBase.hpp:52
Sacado::ParameterVectorBase::Entry::family
Teuchos::RCP< FamilyType > family
Pointer to family.
Definition
Sacado_ParameterVectorBase.hpp:55
Sacado::ParameterVectorBase::Entry::baseValue
BaseValueType baseValue
Base value of parameter family.
Definition
Sacado_ParameterVectorBase.hpp:58
Sacado::ParameterVectorBase::Entry::Entry
Entry(const Teuchos::RCP< FamilyType > &f, BaseValueType bv)
Constructor.
Definition
Sacado_ParameterVectorBase.hpp:61
Generated by
1.17.0