libMesh::SensitivityData Class Reference

Holds completed parameter sensitivity calculations. More...

#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

Holds completed parameter sensitivity calculations.

Data structure for holding completed parameter sensitivity calculations.

Author
Roy Stogner
Date
2009

Definition at line 46 of file sensitivity_data.h.

Constructor & Destructor Documentation

libMesh::SensitivityData::SensitivityData ( )
inline

Default constructor: empty data set

Definition at line 74 of file sensitivity_data.h.

References libMesh::sys.

74 {}
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 160 of file sensitivity_data.h.

References allocate_data().

163 {
164  this->allocate_data(qoi_indices, sys, parameter_vector);
165 }
ImplicitSystem & sys
void allocate_data(const QoISet &qoi_indices, const System &sys, const ParameterVector &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 170 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(), clear(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and SensitivityData().

173 {
174  const std::size_t Np = parameter_vector.size();
175  const unsigned int Nq =
176  cast_int<unsigned int>(sys.qoi.size());
177 
178  if (_grad_data.size() < Nq)
179  _grad_data.resize(Nq);
180 
181  for (unsigned int i=0; i != Nq; ++i)
182  if (qoi_indices.has_index(i))
183  {
184  _grad_data[i].clear();
185  _grad_data[i].resize(Np);
186  }
187 }
std::vector< std::vector< Number > > _grad_data
ImplicitSystem & sys
std::vector< Number > qoi
Definition: system.h:1551
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 192 of file sensitivity_data.h.

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

Referenced by clear(), and libMesh::ImplicitSystem::qoi_parameter_hessian().

195 {
196  const std::size_t Np = parameter_vector.size();
197  const unsigned int Nq =
198  cast_int<unsigned int>(sys.qoi.size());
199 
200  if (_hess_data.size() < Nq)
201  _hess_data.resize(Nq);
202 
203  for (unsigned int i=0; i != Nq; ++i)
204  if (qoi_indices.has_index(i))
205  {
206  _hess_data[i].clear();
207  _hess_data[i].resize(Np);
208  for (std::size_t j=0; j != Np; ++j)
209  _hess_data[i][j].resize(Np);
210  }
211 }
std::vector< std::vector< std::vector< Number > > > _hess_data
ImplicitSystem & sys
std::vector< Number > qoi
Definition: system.h:1551
void libMesh::SensitivityData::clear ( )
inline

Clears and deallocates all data

Definition at line 87 of file sensitivity_data.h.

References _grad_data, allocate_data(), allocate_hessian_data(), derivative(), and second_derivative().

87 { _grad_data.clear(); }
std::vector< std::vector< Number > > _grad_data
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 216 of file sensitivity_data.h.

References _grad_data.

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

218 {
219  libmesh_assert_less (qoi_index, _grad_data.size());
220  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
221 
222  return _grad_data[qoi_index][parameter_index];
223 }
std::vector< std::vector< Number > > _grad_data
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 228 of file sensitivity_data.h.

References _grad_data.

230 {
231  libmesh_assert_less (qoi_index, _grad_data.size());
232  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
233 
234  return _grad_data[qoi_index][parameter_index];
235 }
std::vector< std::vector< Number > > _grad_data
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 140 of file sensitivity_data.h.

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

Definition at line 142 of file sensitivity_data.h.

References libMesh::SensitivityData::Row::Row().

142 { return Row(*this, qoi); }
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
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 240 of file sensitivity_data.h.

References _hess_data.

Referenced by clear(), and libMesh::ImplicitSystem::qoi_parameter_hessian().

243 {
244  libmesh_assert_less (qoi_index, _hess_data.size());
245  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
246  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());
247 
248  return _hess_data[qoi_index][parameter_index1][parameter_index2];
249 }
std::vector< std::vector< std::vector< Number > > > _hess_data
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 254 of file sensitivity_data.h.

References _hess_data.

257 {
258  libmesh_assert_less (qoi_index, _hess_data.size());
259  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
260  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());
261 
262  return _hess_data[qoi_index][parameter_index1][parameter_index2];
263 }
std::vector< std::vector< std::vector< Number > > > _hess_data

Member Data Documentation

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

Data storage; currently pretty trivial

Definition at line 148 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 149 of file sensitivity_data.h.

Referenced by allocate_hessian_data(), and second_derivative().


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