parameter_vector.C
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 // C++ Includes -----------------------------------
21 
22 // Local Includes -----------------------------------
24 
25 namespace libMesh
26 {
27 
28 // ------------------------------------------------------------
29 // ParameterVector implementation
30 
31 
32 
34 {
35  const unsigned int Np = libmesh_cast_int<unsigned int>
36  (this->_params.size());
37  target._params.resize(Np);
38  target._my_data.resize(Np);
39  for (unsigned int i=0; i != Np; ++i)
40  {
41  target._params[i] = &target._my_data[i];
42  target._my_data[i] = *(this->_params[i]);
43  }
44 }
45 
46 
47 
49 {
50  target._my_data.clear();
51  target._params = this->_params;
52 }
53 
54 
55 
57 {
58  const unsigned int Np = libmesh_cast_int<unsigned int>
59  (this->_params.size());
60  libmesh_assert_equal_to (target._params.size(), Np);
61 
62  for (unsigned int i=0; i != Np; ++i)
63  *(this->_params[i]) = *(target._params[i]);
64 }
65 
66 
67 
68 void ParameterVector::deep_resize(unsigned int s)
69 {
70  this->_params.resize(s);
71  this->_my_data.resize(s);
72  for (unsigned int i=0; i != s; ++i)
73  this->_params[i] = &this->_my_data[i];
74 }
75 
76 
77 
79 {
80  const unsigned int Np = libmesh_cast_int<unsigned int>
81  (this->_params.size());
82  for (unsigned int i=0; i != Np; ++i)
83  *(this->_params[i]) *= a;
84  return *this;
85 }
86 
87 
88 
90 {
91  const unsigned int Np = libmesh_cast_int<unsigned int>
92  (this->_params.size());
93  libmesh_assert_equal_to (a._params.size(), Np);
94  for (unsigned int i=0; i != Np; ++i)
95  *(this->_params[i]) += *(a._params[i]);
96  return *this;
97 }
98 
99 
101 {
102  (*this) += a;
103  return *this;
104 }
105 
106 } // namespace libMesh

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

Hosted By:
SourceForge.net Logo