libMesh::ParameterVector Class Reference

#include <parameter_vector.h>

List of all members.

Public Member Functions

 ParameterVector ()
 ParameterVector (const std::vector< Number * > &params)
void deep_copy (ParameterVector &target) const
void shallow_copy (ParameterVector &target) const
void value_copy (const ParameterVector &target) const
void clear ()
std::size_t size () const
void resize (unsigned int s)
void deep_resize (unsigned int s)
Numberoperator[] (unsigned int i) const
Number *& operator[] (unsigned int i)
ParameterVectoroperator*= (const Number a)
ParameterVectoroperator+= (const ParameterVector &a)
const ParameterVectoroperator+= (const ParameterVector &a) const

Private Attributes

std::vector< Number * > _params
std::vector< Number_my_data

Detailed Description

Data structure for specifying which Parameters should be independent variables in a parameter sensitivity calculation.

Definition at line 38 of file parameter_vector.h.


Constructor & Destructor Documentation

libMesh::ParameterVector::ParameterVector (  )  [inline]

Default constructor: "no parameters"

Definition at line 44 of file parameter_vector.h.

00044 {}

libMesh::ParameterVector::ParameterVector ( const std::vector< Number * > &  params  )  [inline, explicit]

Constructor-from-vector-of-Number*: each points to a parameter

Definition at line 50 of file parameter_vector.h.

00050 : _params(params) {}


Member Function Documentation

void libMesh::ParameterVector::clear (  )  [inline]

Resets to "no parameters"

Definition at line 74 of file parameter_vector.h.

References _params.

00074 { _params.clear(); }

void libMesh::ParameterVector::deep_copy ( ParameterVector target  )  const

Deep copy constructor: the target will now own new copies of all the parameter values I'm pointing to

Definition at line 33 of file parameter_vector.C.

References _my_data, and _params.

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

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 }

void libMesh::ParameterVector::deep_resize ( unsigned int  s  ) 

Sets the number of parameters to be used. This method is for resizing a ParameterVector that owns its own parameter values

Definition at line 68 of file parameter_vector.C.

References _my_data, and _params.

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 }

ParameterVector & libMesh::ParameterVector::operator*= ( const Number  a  ) 

Multiplication operator; acts individually on each parameter.

Definition at line 78 of file parameter_vector.C.

References _params.

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 }

const ParameterVector & libMesh::ParameterVector::operator+= ( const ParameterVector a  )  const

Addition operator. The parameter vector to be added in must have the same number of values.

Definition at line 89 of file parameter_vector.C.

References _params.

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 }

ParameterVector & libMesh::ParameterVector::operator+= ( const ParameterVector a  ) 

Addition operator. The parameter vector to be added in must have the same number of values.

Definition at line 100 of file parameter_vector.C.

00101 {
00102   (*this) += a;
00103   return *this;
00104 }

Number *& libMesh::ParameterVector::operator[] ( unsigned int  i  )  [inline]

Returns a reference to a pointer to a parameter value, suitable for repointing it to a different address.

Definition at line 152 of file parameter_vector.h.

References _params.

00153 {
00154   libmesh_assert_greater (_params.size(), i);
00155 
00156   return _params[i];
00157 }

Number * libMesh::ParameterVector::operator[] ( unsigned int  i  )  const [inline]

Returns a pointer to a parameter value

Definition at line 142 of file parameter_vector.h.

References _params.

00143 {
00144   libmesh_assert_greater (_params.size(), i);
00145 
00146   return _params[i];
00147 }

void libMesh::ParameterVector::resize ( unsigned int  s  )  [inline]

Sets the number of parameters to be used. This method is for resizing a ParameterVector that acts as a proxy to other parameter values

Definition at line 86 of file parameter_vector.h.

References _params.

00086 { _params.resize(s); }

void libMesh::ParameterVector::shallow_copy ( ParameterVector target  )  const

Shallow copy constructor: the target will now point to all the parameter values I'm pointing to

Definition at line 48 of file parameter_vector.C.

References _my_data, and _params.

00049 {
00050   target._my_data.clear();
00051   target._params = this->_params;
00052 }

void libMesh::ParameterVector::value_copy ( const ParameterVector target  )  const

Value copy method: the target, which should already have as many parameters as I do, will now have those parameters set to my values.

Definition at line 56 of file parameter_vector.C.

References _params.

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

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 }


Member Data Documentation

Parameters which I own; e.g. as the result of a deep copy

Definition at line 131 of file parameter_vector.h.

Referenced by deep_copy(), deep_resize(), and shallow_copy().

std::vector<Number *> libMesh::ParameterVector::_params [private]

Pointers to parameters which may exist elsewhere

Definition at line 126 of file parameter_vector.h.

Referenced by clear(), deep_copy(), deep_resize(), operator*=(), operator+=(), operator[](), resize(), shallow_copy(), size(), and value_copy().


The documentation for this class was generated from the following files:

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:32 UTC

Hosted By:
SourceForge.net Logo