parameter_vector.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_PARAMETER_VECTOR_H
21 #define LIBMESH_PARAMETER_VECTOR_H
22 
23 
24 // Local Includes -----------------------------------
25 #include "libmesh/libmesh_common.h"
26 
27 // C++ Includes -----------------------------------
28 #include <vector>
29 
30 namespace libMesh
31 {
32 
33 
39 {
40 public:
45 
49  explicit
50  ParameterVector(const std::vector<Number *> &params) : _params(params) {}
51 
56  void deep_copy(ParameterVector &target) const;
57 
62  void shallow_copy(ParameterVector &target) const;
63 
69  void value_copy(const ParameterVector &target) const;
70 
74  void clear() { _params.clear(); }
75 
79  std::size_t size() const { return _params.size(); }
80 
86  void resize(unsigned int s) { _params.resize(s); }
87 
92  void deep_resize(unsigned int s);
93 
97  Number * operator[](unsigned int i) const;
98 
103  Number *& operator[](unsigned int i);
104 
109 
115 
120  const ParameterVector& operator += (const ParameterVector& a) const;
121 
122 private:
126  std::vector<Number *> _params;
127 
131  std::vector<Number> _my_data;
132 };
133 
134 
135 
136 // ------------------------------------------------------------
137 // ParameterVector inline methods
138 
139 
140 
141 inline
142 Number* ParameterVector::operator[] (unsigned int i) const
143 {
144  libmesh_assert_greater (_params.size(), i);
145 
146  return _params[i];
147 }
148 
149 
150 
151 inline
153 {
154  libmesh_assert_greater (_params.size(), i);
155 
156  return _params[i];
157 }
158 
159 } // namespace libMesh
160 
161 #endif // LIBMESH_PARAMETER_VECTOR_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo