parameter_vector.C
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 // C++ Includes ----------------------------------- 00021 00022 // Local Includes ----------------------------------- 00023 #include "libmesh/parameter_vector.h" 00024 00025 namespace libMesh 00026 { 00027 00028 // ------------------------------------------------------------ 00029 // ParameterVector implementation 00030 00031 00032 00033 void ParameterVector::deep_copy(ParameterVector &target) const 00034 { 00035 const unsigned int Np = libmesh_cast_int<unsigned int> 00036 (this->_params.size()); 00037 target._params.resize(Np); 00038 target._my_data.resize(Np); 00039 for (unsigned int i=0; i != Np; ++i) 00040 { 00041 target._params[i] = &target._my_data[i]; 00042 target._my_data[i] = *(this->_params[i]); 00043 } 00044 } 00045 00046 00047 00048 void ParameterVector::shallow_copy(ParameterVector &target) const 00049 { 00050 target._my_data.clear(); 00051 target._params = this->_params; 00052 } 00053 00054 00055 00056 void ParameterVector::value_copy(const ParameterVector &target) const 00057 { 00058 const unsigned int Np = libmesh_cast_int<unsigned int> 00059 (this->_params.size()); 00060 libmesh_assert_equal_to (target._params.size(), Np); 00061 00062 for (unsigned int i=0; i != Np; ++i) 00063 *(this->_params[i]) = *(target._params[i]); 00064 } 00065 00066 00067 00068 void ParameterVector::deep_resize(unsigned int s) 00069 { 00070 this->_params.resize(s); 00071 this->_my_data.resize(s); 00072 for (unsigned int i=0; i != s; ++i) 00073 this->_params[i] = &this->_my_data[i]; 00074 } 00075 00076 00077 00078 ParameterVector& ParameterVector::operator *= (const Number a) 00079 { 00080 const unsigned int Np = libmesh_cast_int<unsigned int> 00081 (this->_params.size()); 00082 for (unsigned int i=0; i != Np; ++i) 00083 *(this->_params[i]) *= a; 00084 return *this; 00085 } 00086 00087 00088 00089 const ParameterVector& ParameterVector::operator += (const ParameterVector& a) const 00090 { 00091 const unsigned int Np = libmesh_cast_int<unsigned int> 00092 (this->_params.size()); 00093 libmesh_assert_equal_to (a._params.size(), Np); 00094 for (unsigned int i=0; i != Np; ++i) 00095 *(this->_params[i]) += *(a._params[i]); 00096 return *this; 00097 } 00098 00099 00100 ParameterVector& ParameterVector::operator += (const ParameterVector& a) 00101 { 00102 (*this) += a; 00103 return *this; 00104 } 00105 00106 } // namespace libMesh
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: