Container class for response functions and their derivatives. Response provides the handle class. More...
Public Member Functions | |
Response () | |
default constructor | |
Response (const Variables &vars, const ProblemDescDB &problem_db) | |
standard constructor built from problem description database | |
Response (const ActiveSet &set) | |
alternate constructor using limited data | |
Response (const Response &response) | |
copy constructor | |
~Response () | |
destructor | |
Response | operator= (const Response &response) |
assignment operator | |
size_t | num_functions () const |
return the number of response functions | |
const ActiveSet & | active_set () const |
return the active set | |
void | active_set (const ActiveSet &set) |
set the active set | |
const ShortArray & | active_set_request_vector () const |
return the active set request vector | |
void | active_set_request_vector (const ShortArray &asrv) |
set the active set request vector | |
const SizetArray & | active_set_derivative_vector () const |
return the active set derivative vector | |
void | active_set_derivative_vector (const SizetArray &asdv) |
set the active set derivative vector | |
const String & | responses_id () const |
return the response identifier | |
const String & | function_label (const size_t &i) const |
return a response function identifier string | |
const StringArray & | function_labels () const |
return the response function identifier strings | |
void | function_label (const String &label, const size_t &i) |
set a response function identifier string | |
void | function_labels (const StringArray &labels) |
set the response function identifier strings | |
const Real & | function_value (const size_t &i) const |
return a function value | |
Real & | function_value_view (const size_t &i) |
return a "view" of a function value for updating in place | |
const RealVector & | function_values () const |
return all function values | |
RealVector | function_values_view () |
return all function values as a view for updating in place | |
void | function_value (const Real &function_val, const size_t &i) |
set a function value | |
void | function_values (const RealVector &function_vals) |
set all function values | |
const Real * | function_gradient (const int &i) const |
return the i-th function gradient as a const Real* | |
RealVector | function_gradient_view (const int &i) const |
return the i-th function gradient as a SerialDenseVector Teuchos::View (shallow copy) for updating in place | |
RealVector | function_gradient_copy (const int &i) const |
return the i-th function gradient as a SerialDenseVector Teuchos::Copy (deep copy) | |
const RealMatrix & | function_gradients () const |
return all function gradients | |
RealMatrix | function_gradients_view () |
return all function gradients as a view for updating in place | |
void | function_gradient (const RealVector &function_grad, const int &i) |
set a function gradient | |
void | function_gradients (const RealMatrix &function_grads) |
set all function gradients | |
const RealSymMatrix & | function_hessian (const size_t &i) const |
return the i-th function Hessian | |
RealSymMatrix | function_hessian_view (const size_t &i) |
return the i-th function Hessian as a Teuchos::View (shallow copy) for updating in place | |
const RealSymMatrixArray & | function_hessians () const |
return all function Hessians | |
RealSymMatrixArray | function_hessians_view () |
return all function Hessians as Teuchos::Views (shallow copies) for updating in place | |
void | function_hessian (const RealSymMatrix &function_hessian, const size_t &i) |
set a function Hessian | |
void | function_hessians (const RealSymMatrixArray &function_hessians) |
set all function Hessians | |
void | read (std::istream &s) |
read a response object from an std::istream | |
void | write (std::ostream &s) const |
write a response object to an std::ostream | |
void | read_annotated (std::istream &s) |
read a response object in annotated format from an std::istream | |
void | write_annotated (std::ostream &s) const |
write a response object in annotated format to an std::ostream | |
void | read_tabular (std::istream &s) |
read responseRep::functionValues in tabular format from an std::istream | |
void | write_tabular (std::ostream &s) const |
write responseRep::functionValues in tabular format to an std::ostream | |
void | read (BiStream &s) |
read a response object from the binary restart stream | |
void | write (BoStream &s) const |
write a response object to the binary restart stream | |
void | read (MPIUnpackBuffer &s) |
read a response object from a packed MPI buffer | |
void | write (MPIPackBuffer &s) const |
write a response object to a packed MPI buffer | |
Response | copy () const |
a deep copy for use in history mechanisms | |
int | data_size () |
handle class forward to corresponding body class member function | |
void | read_data (double *response_data) |
handle class forward to corresponding body class member function | |
void | write_data (double *response_data) |
handle class forward to corresponding body class member function | |
void | overlay (const Response &response) |
handle class forward to corresponding body class member function | |
void | update (const Response &response) |
Used in place of operator= when only results data updates are desired (functionValues/functionGradients/functionHessians are updated, ASV/labels/id's/etc. are not). Care is taken to allow different derivative array sizing between the two response objects. | |
void | update (const RealVector &source_fn_vals, const RealMatrix &source_fn_grads, const RealSymMatrixArray &source_fn_hessians, const ActiveSet &source_set) |
Overloaded form which allows update from components of a response object. Care is taken to allow different derivative array sizing. | |
void | update_partial (size_t start_index_target, size_t num_items, const Response &response, size_t start_index_source) |
partial update of this response object from another response object. The response objects may have different numbers of response functions. | |
void | update_partial (size_t start_index_target, size_t num_items, const RealVector &source_fn_vals, const RealMatrix &source_fn_grads, const RealSymMatrixArray &source_fn_hessians, const ActiveSet &source_set, size_t start_index_source) |
Overloaded form which allows partial update from components of a response object. The response objects may have different numbers of response functions. | |
void | reshape (const size_t &num_fns, const size_t &num_params, bool grad_flag, bool hess_flag) |
rehapes response data arrays | |
void | reset () |
handle class forward to corresponding body class member function | |
void | reset_inactive () |
handle class forward to corresponding body class member function | |
bool | is_null () const |
function to check responseRep (does this handle contain a body) | |
Private Attributes | |
ResponseRep * | responseRep |
pointer to the body (handle-body idiom) | |
Friends | |
bool | operator== (const Response &resp1, const Response &resp2) |
equality operator | |
bool | operator!= (const Response &resp1, const Response &resp2) |
inequality operator |
Container class for response functions and their derivatives. Response provides the handle class.
The Response class is a container class for an abstract set of functions (functionValues) and their first (functionGradients) and second (functionHessians) derivatives. The functions may involve objective and constraint functions (optimization data set), least squares terms (parameter estimation data set), or generic response functions (uncertainty quantification data set). It is not currently part of a class hierarchy, since the abstraction has been sufficiently general and has not required specialization. For memory efficiency, it employs the "handle-body idiom" approach to reference counting and representation sharing (see Coplien "Advanced C++", p. 58), for which Response serves as the handle and ResponseRep serves as the body.
Response | ( | ) |
default constructor
Need a populated problem description database to build a meaningful Response object, so set the responseRep=NULL in default constructor for efficiency. This then requires a check on NULL in the copy constructor, assignment operator, and destructor.