libMesh::SensitivityData Class Reference

#include <sensitivity_data.h>

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

libMesh::SensitivityData::SensitivityData ( )
inline

Default constructor: empty data set

Definition at line 70 of file sensitivity_data.h.

70 {}
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().

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

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().

169 {
170  const std::size_t Np = parameter_vector.size();
171  const unsigned int Nq =
172  libmesh_cast_int<unsigned int>(sys.qoi.size());
173 
174  if (_grad_data.size() < Nq)
175  _grad_data.resize(Nq);
176 
177  for (unsigned int i=0; i != Nq; ++i)
178  if (qoi_indices.has_index(i))
179  {
180  _grad_data[i].clear();
181  _grad_data[i].resize(Np);
182  }
183 }
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, libMesh::resize(), and libMesh::ParameterVector::size().

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

191 {
192  const std::size_t Np = parameter_vector.size();
193  const unsigned int Nq =
194  libmesh_cast_int<unsigned int>(sys.qoi.size());
195 
196  if (_hess_data.size() < Nq)
197  _hess_data.resize(Nq);
198 
199  for (unsigned int i=0; i != Nq; ++i)
200  if (qoi_indices.has_index(i))
201  {
202  _hess_data[i].clear();
203  _hess_data[i].resize(Np);
204  for (std::size_t j=0; j != Np; ++j)
205  _hess_data[i][j].resize(Np);
206  }
207 }
void libMesh::SensitivityData::clear ( )
inline

Clears and deallocates all data

Definition at line 83 of file sensitivity_data.h.

References _grad_data.

83 { _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[]().

214 {
215  libmesh_assert_less (qoi_index, _grad_data.size());
216  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
217 
218  return _grad_data[qoi_index][parameter_index];
219 }
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.

226 {
227  libmesh_assert_less (qoi_index, _grad_data.size());
228  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
229 
230  return _grad_data[qoi_index][parameter_index];
231 }
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.

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

Definition at line 138 of file sensitivity_data.h.

138 { 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().

239 {
240  libmesh_assert_less (qoi_index, _hess_data.size());
241  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
242  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());
243 
244  return _hess_data[qoi_index][parameter_index1][parameter_index2];
245 }
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.

253 {
254  libmesh_assert_less (qoi_index, _hess_data.size());
255  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
256  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());
257 
258  return _hess_data[qoi_index][parameter_index1][parameter_index2];
259 }

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:

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:31 UTC

Hosted By:
SourceForge.net Logo