libMesh
Classes | Public Member Functions | Private Attributes | List of all members
libMesh::SensitivityData Class Reference

Data structure for holding completed parameter sensitivity calculations. More...

#include <sensitivity_data.h>

Classes

class  ConstRow
 
class  Row
 

Public Member Functions

 SensitivityData ()
 Default constructor: empty data set. More...
 
 SensitivityData (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
 Constructor from QoISet and ParameterVector: allocates space for all required sensitivities. More...
 
void clear ()
 Clears and deallocates all data. More...
 
void allocate_data (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
 Given QoISet and ParameterVector, allocates space for all required first derivative data. More...
 
void allocate_hessian_data (const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
 Given QoISet and ParameterVector, allocates space for all required second derivative data. More...
 
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)
 Gets/sets the parameter sensitivity derivative for the specified quantity of interest for the specified parameter. More...
 
Numbersecond_derivative (unsigned int qoi_index, unsigned int parameter_index1, unsigned int parameter_index2)
 Gets/sets the parameter sensitivity second derivative for the specified quantity of interest for the specified pair of parameters. More...
 
ConstRow operator[] (unsigned int qoi) const
 Vector address type operator: sd[q][p] is an alias for sd.derivative(q,p) More...
 
Row operator[] (unsigned int qoi)
 

Private Attributes

std::vector< std::vector< Number > > _grad_data
 Data storage; currently pretty trivial. More...
 
std::vector< std::vector< std::vector< Number > > > _hess_data
 

Detailed Description

Data structure for holding completed parameter sensitivity calculations.

Author
Roy Stogner
Date
2009 Holds completed parameter sensitivity calculations.

Definition at line 46 of file sensitivity_data.h.

Constructor & Destructor Documentation

◆ SensitivityData() [1/2]

libMesh::SensitivityData::SensitivityData ( )

Default constructor: empty data set.

Definition at line 74 of file sensitivity_data.h.

74 {}

◆ SensitivityData() [2/2]

libMesh::SensitivityData::SensitivityData ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
)

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 }
void allocate_data(const QoISet &qoi_indices, const System &sys, const ParameterVector &parameter_vector)
Given QoISet and ParameterVector, allocates space for all required first derivative data...

Member Function Documentation

◆ allocate_data()

void libMesh::SensitivityData::allocate_data ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
)

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::n_qois(), and libMesh::ParameterVector::size().

Referenced by SensitivityData().

173 {
174  const std::size_t Np = parameter_vector.size();
175  const unsigned int Nq = sys.n_qois();
176 
177  if (_grad_data.size() < Nq)
178  _grad_data.resize(Nq);
179 
180  for (unsigned int i=0; i != Nq; ++i)
181  if (qoi_indices.has_index(i))
182  {
183  _grad_data[i].clear();
184  _grad_data[i].resize(Np);
185  }
186 }
std::vector< std::vector< Number > > _grad_data
Data storage; currently pretty trivial.

◆ allocate_hessian_data()

void libMesh::SensitivityData::allocate_hessian_data ( const QoISet qoi_indices,
const System sys,
const ParameterVector parameter_vector 
)

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

Definition at line 191 of file sensitivity_data.h.

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

194 {
195  const std::size_t Np = parameter_vector.size();
196  const unsigned int Nq = sys.n_qois();
197 
198  if (_hess_data.size() < Nq)
199  _hess_data.resize(Nq);
200 
201  for (unsigned int i=0; i != Nq; ++i)
202  if (qoi_indices.has_index(i))
203  {
204  _hess_data[i].clear();
205  _hess_data[i].resize(Np);
206  for (std::size_t j=0; j != Np; ++j)
207  _hess_data[i][j].resize(Np);
208  }
209 }
std::vector< std::vector< std::vector< Number > > > _hess_data

◆ clear()

void libMesh::SensitivityData::clear ( )

Clears and deallocates all data.

Definition at line 87 of file sensitivity_data.h.

References _grad_data.

87 { _grad_data.clear(); }
std::vector< std::vector< Number > > _grad_data
Data storage; currently pretty trivial.

◆ derivative() [1/2]

const Number & libMesh::SensitivityData::derivative ( unsigned int  qoi_index,
unsigned int  parameter_index 
) const
Returns
The parameter sensitivity derivative for the specified quantity of interest for the specified parameter

Definition at line 214 of file sensitivity_data.h.

References _grad_data.

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

216 {
217  libmesh_assert_less (qoi_index, _grad_data.size());
218  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
219 
220  return _grad_data[qoi_index][parameter_index];
221 }
std::vector< std::vector< Number > > _grad_data
Data storage; currently pretty trivial.

◆ derivative() [2/2]

Number & libMesh::SensitivityData::derivative ( unsigned int  qoi_index,
unsigned int  parameter_index 
)

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

Definition at line 226 of file sensitivity_data.h.

References _grad_data.

228 {
229  libmesh_assert_less (qoi_index, _grad_data.size());
230  libmesh_assert_less (parameter_index, _grad_data[qoi_index].size());
231 
232  return _grad_data[qoi_index][parameter_index];
233 }
std::vector< std::vector< Number > > _grad_data
Data storage; currently pretty trivial.

◆ operator[]() [1/2]

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

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); }

◆ operator[]() [2/2]

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

Definition at line 142 of file sensitivity_data.h.

142 { return Row(*this, qoi); }
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row

◆ second_derivative() [1/2]

const Number & libMesh::SensitivityData::second_derivative ( unsigned int  qoi_index,
unsigned int  parameter_index1,
unsigned int  parameter_index2 
) const
Returns
The parameter sensitivity derivative for the specified quantity of interest for the specified pair of parameters

Definition at line 238 of file sensitivity_data.h.

References _hess_data.

241 {
242  libmesh_assert_less (qoi_index, _hess_data.size());
243  libmesh_assert_less (parameter_index1, _hess_data[qoi_index].size());
244  libmesh_assert_less (parameter_index2, _hess_data[qoi_index][parameter_index1].size());
245 
246  return _hess_data[qoi_index][parameter_index1][parameter_index2];
247 }
std::vector< std::vector< std::vector< Number > > > _hess_data

◆ second_derivative() [2/2]

Number & libMesh::SensitivityData::second_derivative ( unsigned int  qoi_index,
unsigned int  parameter_index1,
unsigned int  parameter_index2 
)

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

Definition at line 252 of file sensitivity_data.h.

References _hess_data.

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

Member Data Documentation

◆ _grad_data

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

◆ _hess_data

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: