parameter_vector.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_PARAMETER_VECTOR_H 00021 #define LIBMESH_PARAMETER_VECTOR_H 00022 00023 00024 // Local Includes ----------------------------------- 00025 #include "libmesh/libmesh_common.h" 00026 00027 // C++ Includes ----------------------------------- 00028 #include <vector> 00029 00030 namespace libMesh 00031 { 00032 00033 00038 class ParameterVector 00039 { 00040 public: 00044 ParameterVector() {} 00045 00049 explicit 00050 ParameterVector(const std::vector<Number *> ¶ms) : _params(params) {} 00051 00056 void deep_copy(ParameterVector &target) const; 00057 00062 void shallow_copy(ParameterVector &target) const; 00063 00069 void value_copy(const ParameterVector &target) const; 00070 00074 void clear() { _params.clear(); } 00075 00079 std::size_t size() const { return _params.size(); } 00080 00086 void resize(unsigned int s) { _params.resize(s); } 00087 00092 void deep_resize(unsigned int s); 00093 00097 Number * operator[](unsigned int i) const; 00098 00103 Number *& operator[](unsigned int i); 00104 00108 ParameterVector& operator *= (const Number a); 00109 00114 ParameterVector& operator += (const ParameterVector& a); 00115 00120 const ParameterVector& operator += (const ParameterVector& a) const; 00121 00122 private: 00126 std::vector<Number *> _params; 00127 00131 std::vector<Number> _my_data; 00132 }; 00133 00134 00135 00136 // ------------------------------------------------------------ 00137 // ParameterVector inline methods 00138 00139 00140 00141 inline 00142 Number* ParameterVector::operator[] (unsigned int i) const 00143 { 00144 libmesh_assert_greater (_params.size(), i); 00145 00146 return _params[i]; 00147 } 00148 00149 00150 00151 inline 00152 Number*& ParameterVector::operator[] (unsigned int i) 00153 { 00154 libmesh_assert_greater (_params.size(), i); 00155 00156 return _params[i]; 00157 } 00158 00159 } // namespace libMesh 00160 00161 #endif // LIBMESH_PARAMETER_VECTOR_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: