/usr/include/trilinos/Sacado_ParameterVectorBase.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | // $Id$
// $Source$
// @HEADER
// ***********************************************************************
//
// Sacado Package
// Copyright (2006) Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
// (etphipp@sandia.gov).
//
// ***********************************************************************
// @HEADER
#ifndef SACADO_PARAMETERVECTORBASE_HPP
#define SACADO_PARAMETERVECTORBASE_HPP
#include <vector>
#include "Teuchos_Array.hpp"
#include "Sacado_ParameterFamilyBase.hpp"
namespace Sacado {
/*!
* \brief A class to store the active parameters in a code in an ordered
* fashion, along with their "base" values, i.e., the floating point
* value upon which the templated values are based.
*/
template <typename FamilyType, typename BaseValueType>
class ParameterVectorBase {
public:
//! Container for parameter entries
struct Entry {
//! Pointer to family
Teuchos::RCP<FamilyType> family;
//! Base value of parameter family
BaseValueType baseValue;
//! Constructor
Entry(const Teuchos::RCP<FamilyType>& f, BaseValueType bv) :
family(f), baseValue(bv) {}
};
protected:
//! Vector of all parameter families
typedef Teuchos::Array<Entry> EntryVector;
public:
//! Iterator typename
typedef typename EntryVector::iterator iterator;
//! Const iterator typename
typedef typename EntryVector::const_iterator const_iterator;
//! Default constructor
ParameterVectorBase() {}
//! Copy constructor
ParameterVectorBase(const ParameterVectorBase& source) :
params(source.params) {}
//! Destructor
virtual ~ParameterVectorBase() {}
//! Assignment
ParameterVectorBase& operator = (const ParameterVectorBase& source) {
params = source.params; return *this; }
//! Add entry
void addParam(const Teuchos::RCP<FamilyType>& family,
BaseValueType baseValue) {
params.push_back(Entry(family, baseValue));
}
//! Return number of parameters in vector
unsigned int size() const { return params.size(); }
//! Element access
Entry& operator[] (int i) { return params[i]; }
//! Element access
const Entry& operator[] (int i) const { return params[i]; }
//! Iterator pointing at beginning of vector
iterator begin() { return params.begin(); }
//! Iterator pointing at beginning of vector
const_iterator begin() const { return params.begin(); }
//! Iterator pointing at end of vector
iterator end() { return params.end(); }
//! Iterator pointing at end of vector
const_iterator end() const { return params.end(); }
//! Filter vector into types
void
filterParameters(ParameterVectorBase& ad,
ParameterVectorBase& analytic,
ParameterVectorBase& other,
std::vector<int>& index_ad,
std::vector<int>& index_analytic,
std::vector<int>& index_other) {
index_ad.resize(0);
index_analytic.resize(0);
index_other.resize(0);
typename EntryVector::iterator it;
int i;
for (it = params.begin(), i=0; it != params.end(); ++it, ++i) {
if ((*it).family->supportsAD()) {
ad.params.push_back(*it);
index_ad.push_back(i);
}
else if ((*it).family->supportsAnalytic()) {
analytic.params.push_back(*it);
index_analytic.push_back(i);
}
else {
other.params.push_back(*it);
index_other.push_back(i);
}
}
}
protected:
//! Parameter vector
EntryVector params;
};
}
#endif
|