$extrastylesheet
libMesh::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 42 of file sensitivity_data.h.


Constructor & Destructor Documentation

Default constructor: empty data set

Definition at line 70 of file sensitivity_data.h.

{}
libMesh::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 156 of file sensitivity_data.h.

References allocate_data().

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

Member Function Documentation

void libMesh::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 166 of file sensitivity_data.h.

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

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

{
  const std::size_t Np = parameter_vector.size();
  const unsigned int Nq =
    cast_int<unsigned int>(sys.qoi.size());

  if (_grad_data.size() < Nq)
    _grad_data.resize(Nq);

  for (unsigned int i=0; i != Nq; ++i)
    if (qoi_indices.has_index(i))
      {
        _grad_data[i].clear();
        _grad_data[i].resize(Np);
      }
}
void libMesh::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 188 of file sensitivity_data.h.

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

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian().

{
  const std::size_t Np = parameter_vector.size();
  const unsigned int Nq =
    cast_int<unsigned int>(sys.qoi.size());

  if (_hess_data.size() < Nq)
    _hess_data.resize(Nq);

  for (unsigned int i=0; i != Nq; ++i)
    if (qoi_indices.has_index(i))
      {
        _hess_data[i].clear();
        _hess_data[i].resize(Np);
        for (std::size_t j=0; j != Np; ++j)
          _hess_data[i][j].resize(Np);
      }
}

Clears and deallocates all data

Definition at line 83 of file sensitivity_data.h.

References _grad_data.

{ _grad_data.clear(); }
const Number & libMesh::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 212 of file sensitivity_data.h.

References _grad_data.

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

{
  libmesh_assert_less (qoi_index, _grad_data.size());
  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());

  return _grad_data[qoi_index][parameter_index];
}
Number & libMesh::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 224 of file sensitivity_data.h.

References _grad_data.

{
  libmesh_assert_less (qoi_index, _grad_data.size());
  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());

  return _grad_data[qoi_index][parameter_index];
}
ConstRow libMesh::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 136 of file sensitivity_data.h.

{ return ConstRow(*this, qoi); }
Row libMesh::SensitivityData::operator[] ( unsigned int  qoi) [inline]

Definition at line 138 of file sensitivity_data.h.

{ return Row(*this, qoi); }
const Number & libMesh::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 236 of file sensitivity_data.h.

References _hess_data.

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian().

{
  libmesh_assert_less (qoi_index, _hess_data.size());
  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());

  return _hess_data[qoi_index][parameter_index1][parameter_index2];
}
Number & libMesh::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 250 of file sensitivity_data.h.

References _hess_data.

{
  libmesh_assert_less (qoi_index, _hess_data.size());
  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());

  return _hess_data[qoi_index][parameter_index1][parameter_index2];
}

Member Data Documentation

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

Data storage; currently pretty trivial

Definition at line 144 of file sensitivity_data.h.

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

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

Definition at line 145 of file sensitivity_data.h.

Referenced by allocate_hessian_data(), and second_derivative().


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