SensitivityData Class Reference

#include <sensitivity_data.h>

List of all members.

Classes

class  ConstRow
class  Row

Public Member Functions

 SensitivityData ()
 SensitivityData (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
void clear ()
void allocate_data (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
void allocate_hessian_data (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
const Numberderivative (unsigned int qoi_index, unsigned int parameter_index) const
const Numbersecond_derivative (unsigned int qoi_index, unsigned int parameter_index1, unsigned int parameter_index2) const
Numberderivative (unsigned int qoi_index, unsigned int parameter_index)
Numbersecond_derivative (unsigned int qoi_index, unsigned int parameter_index1, unsigned int parameter_index2)
ConstRow operator[] (unsigned int qoi) const
Row operator[] (unsigned int qoi)

Private Attributes

std::vector< std::vector
< Number > > 
_grad_data
std::vector< std::vector
< std::vector< Number > > > 
_hess_data


Detailed Description

Data structure for holding completed parameter sensitivity calculations.

Definition at line 38 of file sensitivity_data.h.


Constructor & Destructor Documentation

SensitivityData::SensitivityData (  )  [inline]

Default constructor: empty data set

Definition at line 66 of file sensitivity_data.h.

00066 {}

SensitivityData::SensitivityData ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
) [inline]

Constructor from QoISet and ParameterVector: allocates space for all required sensitivities

Definition at line 152 of file sensitivity_data.h.

References allocate_data().

00155 {
00156   this->allocate_data(qoi_indices, sys, parameter_vector);
00157 }


Member Function Documentation

void SensitivityData::allocate_data ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
) [inline]

Given QoISet and ParameterVector, allocates space for all required first derivative data

Definition at line 162 of file sensitivity_data.h.

References _grad_data, QoISet::has_index(), System::qoi, and ParameterVector::size().

Referenced by ImplicitSystem::adjoint_qoi_parameter_sensitivity(), ImplicitSystem::forward_qoi_parameter_sensitivity(), ImplicitSystem::qoi_parameter_hessian_vector_product(), and SensitivityData().

00165 {
00166   const unsigned int Np = parameter_vector.size();
00167   const unsigned int Nq = sys.qoi.size();
00168 
00169   if (_grad_data.size() < Nq)
00170     _grad_data.resize(Nq);
00171 
00172   for (unsigned int i=0; i != Nq; ++i)
00173     if (qoi_indices.has_index(i))
00174       {
00175         _grad_data[i].clear();
00176         _grad_data[i].resize(Np);
00177       }
00178 }

void SensitivityData::allocate_hessian_data ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
) [inline]

Given QoISet and ParameterVector, allocates space for all required second derivative data

Definition at line 183 of file sensitivity_data.h.

References _hess_data, QoISet::has_index(), System::qoi, and ParameterVector::size().

Referenced by ImplicitSystem::qoi_parameter_hessian().

00186 {
00187   const unsigned int Np = parameter_vector.size();
00188   const unsigned int Nq = sys.qoi.size();
00189 
00190   if (_hess_data.size() < Nq)
00191     _hess_data.resize(Nq);
00192 
00193   for (unsigned int i=0; i != Nq; ++i)
00194     if (qoi_indices.has_index(i))
00195       {
00196         _hess_data[i].clear();
00197         _hess_data[i].resize(Np);
00198         for (unsigned int j=0; j != Np; ++j)
00199           _hess_data[i][j].resize(Np);
00200       }
00201 }

void SensitivityData::clear (  )  [inline]

Clears and deallocates all data

Definition at line 79 of file sensitivity_data.h.

References _grad_data.

00079 { _grad_data.clear(); }

Number & SensitivityData::derivative ( unsigned int  qoi_index,
unsigned int  parameter_index 
) [inline]

Gets/sets the parameter sensitivity derivative for the specified quantity of interest for the specified parameter

Definition at line 218 of file sensitivity_data.h.

References _grad_data.

00220 {
00221   libmesh_assert(qoi_index < _grad_data.size());
00222   libmesh_assert(parameter_index < _grad_data[qoi_index].size());
00223 
00224   return _grad_data[qoi_index][parameter_index];
00225 }

const Number & SensitivityData::derivative ( unsigned int  qoi_index,
unsigned int  parameter_index 
) const [inline]

Returns the parameter sensitivity derivative for the specified quantity of interest for the specified parameter

Definition at line 206 of file sensitivity_data.h.

References _grad_data.

Referenced by SensitivityData::ConstRow::operator[](), and SensitivityData::Row::operator[]().

00208 {
00209   libmesh_assert(qoi_index < _grad_data.size());
00210   libmesh_assert(parameter_index < _grad_data[qoi_index].size());
00211 
00212   return _grad_data[qoi_index][parameter_index];
00213 }

Row SensitivityData::operator[] ( unsigned int  qoi  )  [inline]

Definition at line 134 of file sensitivity_data.h.

00134 { return Row(*this, qoi); }

ConstRow SensitivityData::operator[] ( unsigned int  qoi  )  const [inline]

Vector address type operator: sd[q][p] is an alias for sd.derivative(q,p)

Definition at line 132 of file sensitivity_data.h.

00132 { return ConstRow(*this, qoi); }

Number & SensitivityData::second_derivative ( unsigned int  qoi_index,
unsigned int  parameter_index1,
unsigned int  parameter_index2 
) [inline]

Gets/sets the parameter sensitivity second derivative for the specified quantity of interest for the specified pair of parameters

Definition at line 244 of file sensitivity_data.h.

References _hess_data.

00247 {
00248   libmesh_assert(qoi_index < _hess_data.size());
00249   libmesh_assert(parameter_index1 < _hess_data[qoi_index].size());
00250   libmesh_assert(parameter_index2 < _hess_data[qoi_index][parameter_index1].size());
00251 
00252   return _hess_data[qoi_index][parameter_index1][parameter_index2];
00253 }

const Number & SensitivityData::second_derivative ( unsigned int  qoi_index,
unsigned int  parameter_index1,
unsigned int  parameter_index2 
) const [inline]

Returns the parameter sensitivity derivative for the specified quantity of interest for the specified pair of parameters

Definition at line 230 of file sensitivity_data.h.

References _hess_data.

Referenced by ImplicitSystem::qoi_parameter_hessian().

00233 {
00234   libmesh_assert(qoi_index < _hess_data.size());
00235   libmesh_assert(parameter_index1 < _hess_data[qoi_index].size());
00236   libmesh_assert(parameter_index2 < _hess_data[qoi_index][parameter_index1].size());
00237 
00238   return _hess_data[qoi_index][parameter_index1][parameter_index2];
00239 }


Member Data Documentation

std::vector<std::vector<Number> > SensitivityData::_grad_data [private]

Data storage; currently pretty trivial

Definition at line 140 of file sensitivity_data.h.

Referenced by allocate_data(), clear(), and derivative().

std::vector<std::vector<std::vector<Number> > > SensitivityData::_hess_data [private]

Definition at line 141 of file sensitivity_data.h.

Referenced by allocate_hessian_data(), and second_derivative().


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

Site Created By: libMesh Developers
Last modified: November 25 2009 03:44:57.

Hosted By:
SourceForge.net Logo