Dakota  Version
Explore and Predict with Confidence
Public Member Functions | List of all members
SimulationResponse Class Reference

Container class for response functions and their derivatives.
SimulationResponse provides the body class. More...

Inheritance diagram for SimulationResponse:
Response

Public Member Functions

 SimulationResponse ()
 default constructor
 
 SimulationResponse (const Variables &vars, const ProblemDescDB &problem_db)
 standard constructor built from problem description database
 
 SimulationResponse (const SharedResponseData &srd, const ActiveSet &set)
 alternate constructor that shares a SharedResponseData instance
 
 SimulationResponse (const SharedResponseData &srd)
 alternate constructor that shares a SharedResponseData instance
 
 SimulationResponse (const ActiveSet &set)
 alternate constructor using limited data
 
 ~SimulationResponse ()
 destructor
 
- Public Member Functions inherited from Response
 Response ()
 default constructor
 
 Response (short type, const Variables &vars, const ProblemDescDB &problem_db)
 standard constructor built from problem description database
 
 Response (const SharedResponseData &srd, const ActiveSet &set)
 alternate constructor that shares response data
 
 Response (short type, const ActiveSet &set)
 alternate constructor using limited data without sharing
 
 Response (const SharedResponseData &srd)
 alternate constructor using limited data (explicit disallows implicit type conversion)
 
 Response (const Response &response)
 copy constructor
 
virtual ~Response ()
 destructor
 
Response operator= (const Response &response)
 assignment operator
 
const SharedResponseDatashared_data () const
 return sharedRespData
 
SharedResponseDatashared_data ()
 return sharedRespData
 
size_t num_functions () const
 return the number of response functions
 
const ActiveSetactive_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
 
ShortArray & active_set_request_vector ()
 return the active set request vector
 
void active_set_request_vector (const ShortArray &asrv)
 set the active set request vector and verify consistent number of response functions
 
const SizetArray & active_set_derivative_vector () const
 return the active set derivative vector
 
SizetArray & active_set_derivative_vector ()
 return the active set derivative vector
 
void active_set_derivative_vector (const SizetArray &asdv)
 set the active set derivative vector and reshape functionGradients/functionHessians if needed
 
void active_set_derivative_vector (SizetMultiArrayConstView asdv)
 set the active set derivative vector and reshape functionGradients/functionHessians if needed
 
const Real & function_value (size_t i) const
 return a function value
 
Real & function_value_view (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
 
RealVector function_values_view () const
 return all function values as a view for accessing the function values vector from a const response
 
void function_value (const Real &fn_val, size_t i)
 set a function value
 
void function_values (const RealVector &fn_vals)
 set all function values
 
const Real * function_gradient (int i) const
 return the i-th function gradient as a const Real*
 
RealVector function_gradient_view (int i)
 return the i-th function gradient as a SerialDenseVector view (shallow copy) for updating in place
 
RealVector function_gradient_view (int i) const
 return the i-th function gradient as a SerialDenseVector view (shallow copy) for accessing a column vector from a const matrix
 
RealVector function_gradient_copy (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
 
RealMatrix function_gradients_view () const
 return all function gradients as a view for updating in place
 
void function_gradient (const RealVector &assign_grad, int fn_index)
 set a function gradient
 
void function_gradient (const RealVector &assign_grad, int fn_index, const SizetArray &assign_indices, const SizetArray &curr_indices)
 set a function gradient, managing dissimilar DVV
 
void function_gradient (const RealVector &assign_grad, int fn_index, const SizetArray &assign_dvv)
 set a function gradient, managing dissimilar DVV
 
void function_gradients (const RealMatrix &fn_grads)
 set all function gradients
 
const RealSymMatrix & function_hessian (size_t i) const
 return the i-th function Hessian
 
RealSymMatrix function_hessian_view (size_t i)
 return the i-th function Hessian as a Teuchos::View (shallow copy) for updating in place
 
RealSymMatrix function_hessian_view (size_t i) const
 return the i-th function Hessian as a Teuchos::View (shallow copy) for accessing the i-th matrix within a const matrix array
 
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
 
RealSymMatrixArray function_hessians_view () const
 return all function Hessians as Teuchos::Views (shallow copies) for updating in place
 
void function_hessian (const RealSymMatrix &assign_hessian, size_t fn_index)
 set a function Hessian
 
void function_hessian (const RealSymMatrix &assign_hessian, size_t fn_index, const SizetArray &assign_indices, const SizetArray &curr_indices)
 set a function Hessian, using DVV index mappings
 
void function_hessian (const RealSymMatrix &assign_hessian, size_t fn_index, const SizetArray &assign_dvv)
 set a function Hessian, managing dissimilar DVV
 
void function_hessians (const RealSymMatrixArray &fn_hessians)
 set all function Hessians
 
void map_dvv_indices (const SizetArray &assign_dvv, SizetArray &assign_indices, SizetArray &curr_indices)
 define source and target indices for updating derivatives by matching assign_dvv against the current DVV
 
const IntVector & field_lengths () const
 return the field lengths (from SharedResponseData)
 
void field_lengths (const IntVector &field_lens)
 set the field lengths (within SharedResponseData)
 
RealVector field_values_view (size_t i) const
 return const field values for the i-th field
 
RealVector field_values_view (size_t i)
 return a "view" of the i-th field values for updating in place
 
void field_values (const RealVector &field_val, size_t i)
 set the values for the i-th field
 
RealMatrix field_gradients_view (size_t i) const
 return a view of the gradients of each element of the i-th field
 
RealSymMatrixArray field_hessians_view (size_t i) const
 return a view of the hessians of each element of the i-th field
 
RealMatrix field_coords_view (size_t i)
 return a "view" of the i-th field's coordinates
 
const RealMatrix field_coords_view (size_t i) const
 return a const "view" of the i-th field's coordinates
 
void field_coords (const RealMatrix &field_coords, size_t i)
 set the i-th field's coordinates
 
const IntVector & num_coords_per_field () const
 return the number of coordinates each field has (from SharedResponseData)
 
const StringArray & function_labels () const
 return the fine-grained (unrolled) response function identifier strings from sharedRespData
 
void function_labels (const StringArray &labels)
 set the fine-grained (unrolled) response function identifier strings within sharedRespData
 
const StringArray & field_group_labels ()
 return the user-provided field group labels instead of the unrolled labels available through function_labels()
 
const std::vector< RespMetadataT > & metadata () const
 get the (possibly empty) response metadata; (get labels through shared_data())
 
void metadata (const std::vector< RespMetadataT > &md)
 set the response metadata (set labels through shared_data())
 
void metadata (const std::vector< RespMetadataT > &md, size_t start)
 set a portion of the response metadata starting from given position
 
void read (std::istream &s, const unsigned short format=FLEXIBLE_RESULTS)
 read a response object of specified format from a std::istream
 
void write (std::ostream &s) const
 write a response object to a std::ostream
 
void read_annotated (std::istream &s)
 read a response object in annotated format from a std::istream
 
void write_annotated (std::ostream &s) const
 write a response object in annotated format to a std::ostream
 
void read_tabular (std::istream &s)
 read responseRep::functionValues in tabular format from a std::istream
 
void write_tabular (std::ostream &s, bool eol=true) const
 write responseRep::functionValues in tabular format to a std::ostream
 
void write_tabular_partial (std::ostream &s, size_t start_index, size_t num_items) const
 write portion of responseRep::functionValues in tabular format to a std::ostream
 
void write_tabular_labels (std::ostream &s, bool eol=true) const
 write the response labels in tabular format to a std::ostream
 
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 (bool deep_srd=false) const
 return a deep response copy of the contained responseRep for use in history mechanisms (SharedResponseData uses a shallow copy by default)
 
int data_size ()
 return the number of doubles active in response. Used for sizing double* response_data arrays passed into read_data and write_data.
 
void read_data (double *response_data)
 read from an incoming double* array
 
void write_data (double *response_data)
 write to an incoming double* array
 
void overlay (const Response &response)
 add incoming response to functionValues/Gradients/Hessians
 
void update (const Response &response, bool pull_metadata=false)
 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 (size_t num_fns, size_t num_params, bool grad_flag, bool hess_flag)
 rehapes response data arrays
 
void reshape_metadata (size_t num_meta)
 rehapes response metadata arrays
 
void reset ()
 resets all response data to zero
 
void reset_inactive ()
 resets all inactive response data to zero
 
bool is_null () const
 function to check responseRep (does this handle contain a body)
 
virtual void set_scalar_covariance (RealVector &scalars)
 method to set the covariance matrix defined for ExperimentResponse
 
virtual const ExperimentCovariance & experiment_covariance () const
 retrieve the ExperimentCovariance structure
 
virtual void set_full_covariance (std::vector< RealMatrix > &matrices, std::vector< RealVector > &diagonals, RealVector &scalars, IntVector matrix_map_indices, IntVector diagonal_map_indices, IntVector scalar_map_indices)
 method to set the full covariance matrices for ExperimentResponse
 
virtual Real apply_covariance (const RealVector &residuals) const
 method to compute the triple product v'*inv(C)*v.
 
virtual void apply_covariance_inv_sqrt (const RealVector &residuals, RealVector &weighted_residuals) const
 method to compute (v'*inv(C)^1/2), to compute weighted residual
 
virtual void apply_covariance_inv_sqrt (const RealMatrix &gradients, RealMatrix &weighted_gradients) const
 
virtual void apply_covariance_inv_sqrt (const RealSymMatrixArray &hessians, RealSymMatrixArray &weighted_hessians) const
 
virtual void get_covariance_diagonal (RealVector &diagonal) const
 
virtual Real covariance_determinant () const
 covariance determinant for one experiment (default 1.0)
 
virtual Real log_covariance_determinant () const
 log of covariance determinant for one experiment (default 0.0)
 

Additional Inherited Members

- Protected Member Functions inherited from Response
 Response (BaseConstructor, const Variables &vars, const ProblemDescDB &problem_db)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const SharedResponseData &srd, const ActiveSet &set)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const ActiveSet &set)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
 Response (BaseConstructor, const SharedResponseData &srd)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 
virtual void copy_rep (std::shared_ptr< Response > source_resp_rep)
 Implementation of data copy for Response letters (specialized by some derived letter types); pulls base class data from source_resp_rep into the this object.

 
- Protected Attributes inherited from Response
SharedResponseData sharedRespData
 reference-counted instance of shared response data: id's, labels
 
RealVector functionValues
 Abstract set of response functions. Ordered: [primary_scalar, primary_field, nonlinear_inequality, nonlinear_equality].
 
RealMatrix functionGradients
 first derivatives of the response functions More...
 
RealSymMatrixArray functionHessians
 second derivatives of the response functions
 
IntRealMatrixMap fieldCoords
 coordinates (independent vars like x,t) on which field values depend
 
ActiveSet responseActiveSet
 copy of the ActiveSet used by the Model to generate a Response instance
 
std::vector< RespMetadataT > metaData
 metadata storage
 

Detailed Description

Container class for response functions and their derivatives.
SimulationResponse provides the body class.

The SimulationResponse class is the "representation" of the response container class. It is the "body" portion of the "handle-body idiom" (see Coplien "Advanced C++", p. 58). The handle class (Response) provides for memory efficiency in management of multiple response objects through reference counting and representation sharing. The body class (SimulationResponse) actually contains the response data (functionValues, functionGradients, functionHessians, etc.). The representation is hidden in that an instance of SimulationResponse may only be created by Response. Therefore, programmers create instances of the Response handle class, and only need to be aware of the handle/body mechanisms when it comes to managing shallow copies (shared representation) versus deep copies (separate representation used for history mechanisms).


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