$extrastylesheet
libMesh::QoISet Class Reference

#include <qoi_set.h>

List of all members.

Classes

class  iterator

Public Member Functions

 QoISet ()
 QoISet (const System &sys)
 QoISet (const std::vector< bool > &indices)
 QoISet (const std::vector< unsigned int > &indices)
void clear ()
unsigned int size (const System &sys) const
void add_indices (const std::vector< unsigned int > &indices)
void add_index (unsigned int)
void remove_indices (const std::vector< unsigned int > &indices)
void remove_index (unsigned int)
void set_weight (unsigned int, Real)
Real weight (unsigned int) const
bool has_index (unsigned int) const
iterator begin () const

Private Attributes

std::vector< bool > _indices
std::vector< Real_weights

Detailed Description

Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a parameter sensitivity calculation.

Definition at line 41 of file qoi_set.h.


Constructor & Destructor Documentation

Empty constructor: "calculate all QoIs in the System"

No further changes to this special QoISet should be made; it doesn't even know how many QoIs your system has, it just knows to instruct a function to use all of them.

Definition at line 93 of file qoi_set.h.

: _indices(), _weights() {}
libMesh::QoISet::QoISet ( const System sys) [explicit]

Default constructor: "calculate all QoIs in the System", "give every QoI weight 1.0"

Definition at line 34 of file qoi_set.C.

: _indices(sys.qoi.size(), true) {}
libMesh::QoISet::QoISet ( const std::vector< bool > &  indices) [inline, explicit]

Constructor-from-vector-of-bool: "calculate the QoIs for which \p indices[q] is true"

Definition at line 107 of file qoi_set.h.

                                         :
    _indices(indices), _weights() {}
libMesh::QoISet::QoISet ( const std::vector< unsigned int > &  indices) [inline, explicit]

Constructor-from-vector: "calculate the listed QoIs", "give every QoI weight 1.0"

Definition at line 188 of file qoi_set.h.

References add_indices().

                                                     :
  _indices(), _weights()
{
  this->add_indices(indices);
}

Member Function Documentation

void libMesh::QoISet::add_index ( unsigned int  i) [inline]

Add this index to the set to be calculated

Definition at line 197 of file qoi_set.h.

References _indices.

{
  if (i >= _indices.size())
    _indices.resize(i+1, true);
  _indices[i] = true;
}
void libMesh::QoISet::add_indices ( const std::vector< unsigned int > &  indices)

Add this indices to the set to be calculated

Definition at line 49 of file qoi_set.C.

References _indices, and std::max().

Referenced by QoISet().

{
  unsigned int max_size = 0;
  for (std::vector<unsigned int>::const_iterator i = indices.begin();
       i != indices.end(); ++i)
    max_size = std::max(max_size, *i + 1);

  _indices.resize(max_size);

  for (std::vector<unsigned int>::const_iterator i = indices.begin();
       i != indices.end(); ++i)
    _indices[*i] = true;
}
iterator libMesh::QoISet::begin ( ) const [inline]

Return an iterator pointing to the first index in the set

Definition at line 166 of file qoi_set.h.

References _indices.

{ return iterator(0, _indices); }
void libMesh::QoISet::clear ( ) [inline]

Resets to "calculate all QoIs, give every QoI weight 1.0"

Definition at line 120 of file qoi_set.h.

References _indices, and _weights.

{ _indices.clear(); _weights.clear(); }
void libMesh::QoISet::remove_index ( unsigned int  i) [inline]

Remove this index from the set to be calculated

Definition at line 207 of file qoi_set.h.

References _indices.

{
  if (i >= _indices.size())
    _indices.resize(i+1, true);
  _indices[i] = false;
}
void libMesh::QoISet::remove_indices ( const std::vector< unsigned int > &  indices) [inline]

Remove these indices from the set to be calculated

Definition at line 66 of file qoi_set.C.

References _indices.

{
  for (std::vector<unsigned int>::const_iterator i = indices.begin();
       i != indices.end(); ++i)
    _indices[*i] = false;
}
void libMesh::QoISet::set_weight ( unsigned int  i,
Real  w 
) [inline]

Set the weight for this index

Definition at line 225 of file qoi_set.h.

References _weights.

{
  if (_weights.size() <= i)
    _weights.resize(i+1, 1.0);

  _weights[i] = w;
}
unsigned int libMesh::QoISet::size ( const System sys) const

Returns the number of QoIs that would be computed for the System sys

Definition at line 38 of file qoi_set.C.

References has_index(), and libMesh::System::qoi.

Referenced by libMesh::System::qoi_parameter_sensitivity().

{
  unsigned int qoi_count = 0;
  for (unsigned int i=0; i != sys.qoi.size(); ++i)
    if (this->has_index(i))
      qoi_count++;
  return qoi_count;
}
Real libMesh::QoISet::weight ( unsigned int  i) const [inline]

Get the weight for this index (default 1.0)

Definition at line 236 of file qoi_set.h.

References _weights.

Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::AdjointResidualErrorEstimator::estimate_error().

{
  if (_weights.size() <= i)
    return 1.0;
  return _weights[i];
}

Member Data Documentation

std::vector<bool> libMesh::QoISet::_indices [private]

Interpret _indices.empty() to mean "calculate all indices"

Definition at line 172 of file qoi_set.h.

Referenced by add_index(), add_indices(), begin(), clear(), has_index(), remove_index(), and remove_indices().

std::vector<Real> libMesh::QoISet::_weights [private]

Interpret _weights.size() <= i to mean "weight i = 1.0"

Definition at line 177 of file qoi_set.h.

Referenced by clear(), set_weight(), and weight().


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