Dakota
Version 6.19
Explore and Predict with Confidence
|
Derived class within the Variables hierarchy which separates continuous and discrete variables (no domain type array merging). More...
Public Member Functions | |
MixedVariables (const ProblemDescDB &problem_db, const ShortShortPair &view) | |
standard constructor More... | |
MixedVariables (const SharedVariablesData &svd) | |
lightweight constructor | |
~MixedVariables () | |
destructor | |
Public Member Functions inherited from Variables | |
Variables () | |
default constructor | |
Variables (const ProblemDescDB &problem_db) | |
standard constructor (explicit disallows its use for implicit type conversion) | |
Variables (const SharedVariablesData &svd) | |
alternate constructor for instantiations on the fly (explicit disallows its use for implicit type conversion) | |
Variables (const Variables &vars) | |
copy constructor | |
virtual | ~Variables () |
destructor | |
Variables | operator= (const Variables &vars) |
assignment operator | |
virtual void | read_annotated (std::istream &s) |
read a variables object in annotated format from an istream | |
virtual void | write_annotated (std::ostream &s) const |
write a variables object in annotated format to an std::ostream | |
virtual void | read (MPIUnpackBuffer &s) |
read a variables object from a packed MPI buffer | |
virtual void | write (MPIPackBuffer &s) const |
write a variables object to a packed MPI buffer | |
size_t | tv () const |
total number of vars | |
size_t | total_active () const |
total number of active vars | |
size_t | cv () const |
number of active continuous vars | |
size_t | cv_start () const |
start index of active continuous vars | |
size_t | div () const |
number of active discrete int vars | |
size_t | div_start () const |
start index of active discrete int vars | |
size_t | dsv () const |
number of active discrete string vars | |
size_t | dsv_start () const |
start index of active discrete string vars | |
size_t | drv () const |
number of active discrete real vars | |
size_t | drv_start () const |
start index of active discrete real vars | |
size_t | icv () const |
number of inactive continuous vars | |
size_t | icv_start () const |
start index of inactive continuous vars | |
size_t | idiv () const |
number of inactive discrete int vars | |
size_t | idiv_start () const |
start index of inactive discrete int vars | |
size_t | idsv () const |
number of inactive discrete string vars | |
size_t | idsv_start () const |
start index of inactive discrete string vars | |
size_t | idrv () const |
number of inactive discrete real vars | |
size_t | idrv_start () const |
start index of inactive discrete real vars | |
size_t | acv () const |
total number of continuous vars | |
size_t | adiv () const |
total number of discrete integer vars | |
size_t | adsv () const |
total number of discrete string vars | |
size_t | adrv () const |
total number of discrete real vars | |
const SharedVariablesData & | shared_data () const |
return sharedVarsData | |
SharedVariablesData & | shared_data () |
return sharedVarsData | |
void | shape () |
shape a Variables object based on sharedVarsData | |
void | reshape () |
reshape an existing Variables object based on updated sharedVarsData | |
void | reshape (const SharedVariablesData &svd) |
reshape an existing Variables object based on incoming SVD | |
void | active_variables (const Variables &vars) |
copy the active cv/div/dsv/drv variables from vars | |
void | all_variables (const Variables &vars) |
copy all cv/div/dsv/drv variables from vars | |
void | active_to_all_variables (const Variables &vars) |
copy the active cv/div/dsv/drv variables from incoming vars to all variables in this instance | |
void | all_to_active_variables (const Variables &vars) |
copy all cv/div/dsv/drv variables from incoming vars to active variables in this instance | |
void | inactive_variables (const Variables &vars) |
copy the inactive cv/div/dsv/drv variables from vars | |
void | active_to_inactive_variables (const Variables &vars) |
copy the active cv/div/dsv/drv variables from vars to inactive on this | |
void | inactive_into_all_variables (const Variables &vars) |
insert the inactive cv/div/dsv/drv variables from vars into all arrays | |
void | map_variables_by_view (const Variables &vars) |
map from vars into the corresponding variables based on active views | |
Real | continuous_variable (size_t index) const |
return an active continuous variable | |
const RealVector & | continuous_variables () const |
return the active continuous variables (Note: returns a view by const reference, but initializing a RealVector from this reference invokes the Teuchos matrix copy constructor to create a Teuchos::Copy instance; to obtain a mutable view, use continuous_variables_view()) | |
void | continuous_variable (Real c_var, size_t index) |
set an active continuous variable | |
void | continuous_variables (const RealVector &c_vars) |
set the active continuous variables | |
int | discrete_int_variable (size_t index) const |
return an active discrete integer variable | |
const IntVector & | discrete_int_variables () const |
return the active discrete integer variables (Note: returns a view by const reference, but initializing an IntVector from this reference invokes the Teuchos matrix copy constructor to create a Teuchos::Copy instance; to obtain a mutable view, use discrete_int_variables_view()) | |
void | discrete_int_variable (int di_var, size_t index) |
set an active discrete integer variable | |
void | discrete_int_variables (const IntVector &di_vars) |
set the active discrete integer variables | |
const String & | discrete_string_variable (size_t index) const |
return an active discrete string variable | |
StringMultiArrayConstView | discrete_string_variables () const |
return the active discrete string variables (Note: returns a view by const reference, but initializing a StringArray from this reference invokes the Teuchos matrix copy constructor to create a Teuchos::Copy instance; to obtain a mutable view, use discrete_string_variables_view()) | |
void | discrete_string_variable (const String &ds_var, size_t index) |
set an active discrete string variable | |
void | discrete_string_variables (StringMultiArrayConstView ds_vars) |
set the active discrete string variables | |
Real | discrete_real_variable (size_t index) const |
return an active discrete real variable | |
const RealVector & | discrete_real_variables () const |
return the active discrete real variables (Note: returns a view by const reference, but initializing a RealVector from this reference invokes the Teuchos matrix copy constructor to create a Teuchos::Copy instance; to obtain a mutable view, use discrete_real_variables_view()) | |
void | discrete_real_variable (Real dr_var, size_t index) |
set an active discrete real variable | |
void | discrete_real_variables (const RealVector &dr_vars) |
set the active discrete real variables | |
RealVector & | continuous_variables_view () |
return a mutable view of the active continuous variables | |
IntVector & | discrete_int_variables_view () |
return a mutable view of the active discrete integer variables | |
StringMultiArrayView | discrete_string_variables_view () |
return a mutable view of the active discrete string variables More... | |
RealVector & | discrete_real_variables_view () |
return a mutable view of the active discrete real variables | |
StringMultiArrayConstView | continuous_variable_labels () const |
return the active continuous variable labels | |
void | continuous_variable_labels (StringMultiArrayConstView cv_labels) |
set the active continuous variable labels | |
void | continuous_variable_label (const String &cv_label, size_t index) |
set an active continuous variable label | |
StringMultiArrayConstView | discrete_int_variable_labels () const |
return the active discrete integer variable labels | |
void | discrete_int_variable_labels (StringMultiArrayConstView div_labels) |
set the active discrete integer variable labels | |
void | discrete_int_variable_label (const String &div_label, size_t index) |
set an active discrete integer variable label | |
StringMultiArrayConstView | discrete_string_variable_labels () const |
return the active discrete string variable labels | |
void | discrete_string_variable_labels (StringMultiArrayConstView dsv_labels) |
set the active discrete string variable labels | |
void | discrete_string_variable_label (const String &dsv_label, size_t index) |
set an active discrete string variable label | |
StringMultiArrayConstView | discrete_real_variable_labels () const |
return the active discrete real variable labels | |
void | discrete_real_variable_labels (StringMultiArrayConstView drv_labels) |
set the active discrete real variable labels | |
void | discrete_real_variable_label (const String &drv_label, size_t index) |
set an active discrete real variable label | |
void | active_labels (const Variables &vars) |
copy all cv/div/dsv/drv variable labels from vars | |
void | all_labels (const Variables &vars) |
copy all cv/div/dsv/drv variable labels from vars | |
void | active_to_all_labels (const Variables &vars) |
copy the active cv/div/dsv/drv variable labels from incoming vars to all variables in this instance | |
void | all_to_active_labels (const Variables &vars) |
copy all cv/div/dsv/drv variable labels from incoming vars to active variables in this instance | |
void | inactive_labels (const Variables &vars) |
copy the inactive cv/div/dsv/drv variable labels from vars | |
UShortMultiArrayConstView | continuous_variable_types () const |
return the active continuous variable types | |
void | continuous_variable_types (UShortMultiArrayConstView cv_types) |
set the active continuous variable types | |
void | continuous_variable_type (unsigned short cv_type, size_t index) |
set an active continuous variable type | |
UShortMultiArrayConstView | discrete_int_variable_types () const |
return the active discrete integer variable types | |
void | discrete_int_variable_types (UShortMultiArrayConstView div_types) |
set the active discrete integer variable types | |
void | discrete_int_variable_type (unsigned short div_type, size_t index) |
set an active discrete integer variable type | |
UShortMultiArrayConstView | discrete_string_variable_types () const |
return the active discrete string variable types | |
void | discrete_string_variable_types (UShortMultiArrayConstView dsv_types) |
set the active discrete string variable types | |
void | discrete_string_variable_type (unsigned short dsv_type, size_t index) |
set an active discrete string variable type | |
UShortMultiArrayConstView | discrete_real_variable_types () const |
return the active discrete real variable types | |
void | discrete_real_variable_types (UShortMultiArrayConstView drv_types) |
set the active discrete real variable types | |
void | discrete_real_variable_type (unsigned short drv_type, size_t index) |
set an active discrete real variable type | |
SizetMultiArrayConstView | continuous_variable_ids () const |
return the active continuous variable position identifiers | |
void | continuous_variable_ids (SizetMultiArrayConstView cv_ids) |
set the active continuous variable position identifiers | |
void | continuous_variable_id (size_t cv_id, size_t index) |
set an active continuous variable position identifier | |
const RealVector & | inactive_continuous_variables () const |
return the inactive continuous variables | |
void | inactive_continuous_variables (const RealVector &ic_vars) |
set the inactive continuous variables | |
void | inactive_continuous_variable (Real ic_var, size_t index) |
set an inactive continuous variable | |
const IntVector & | inactive_discrete_int_variables () const |
return the inactive discrete int variables | |
void | inactive_discrete_int_variables (const IntVector &idi_vars) |
set the inactive discrete int variables | |
void | inactive_discrete_int_variable (int idi_var, size_t index) |
set an inactive discrete int variable | |
StringMultiArrayConstView | inactive_discrete_string_variables () const |
return the inactive discrete string variables | |
void | inactive_discrete_string_variables (StringMultiArrayConstView ids_vars) |
set the inactive discrete string variables | |
void | inactive_discrete_string_variable (const String &ids_var, size_t index) |
set an inactive discrete string variable | |
const RealVector & | inactive_discrete_real_variables () const |
return the inactive discrete real variables | |
void | inactive_discrete_real_variables (const RealVector &idr_vars) |
set the inactive discrete real variables | |
void | inactive_discrete_real_variable (Real idr_var, size_t index) |
set an inactive discrete real variable | |
StringMultiArrayConstView | inactive_continuous_variable_labels () const |
return the inactive continuous variable labels | |
void | inactive_continuous_variable_labels (StringMultiArrayConstView ic_vars) |
set the inactive continuous variable labels | |
StringMultiArrayConstView | inactive_discrete_int_variable_labels () const |
return the inactive discrete variable labels | |
void | inactive_discrete_int_variable_labels (StringMultiArrayConstView idi_vars) |
set the inactive discrete variable labels | |
StringMultiArrayConstView | inactive_discrete_string_variable_labels () const |
return the inactive discrete variable labels | |
void | inactive_discrete_string_variable_labels (StringMultiArrayConstView ids_vars) |
set the inactive discrete variable labels | |
StringMultiArrayConstView | inactive_discrete_real_variable_labels () const |
return the inactive discrete variable labels | |
void | inactive_discrete_real_variable_labels (StringMultiArrayConstView idr_vars) |
set the inactive discrete variable labels | |
UShortMultiArrayConstView | inactive_continuous_variable_types () const |
return the inactive continuous variable types | |
UShortMultiArrayConstView | inactive_discrete_int_variable_types () const |
return the inactive discrete integer variable types | |
UShortMultiArrayConstView | inactive_discrete_string_variable_types () const |
return the inactive discrete string variable types | |
UShortMultiArrayConstView | inactive_discrete_real_variable_types () const |
return the inactive discrete real variable types | |
SizetMultiArrayConstView | inactive_continuous_variable_ids () const |
return the inactive continuous variable position identifiers | |
const RealVector & | all_continuous_variables () const |
returns a single array with all continuous variables | |
void | all_continuous_variables (const RealVector &ac_vars) |
sets all continuous variables using a single array | |
void | all_continuous_variable (Real ac_var, size_t index) |
set a variable within the all continuous array | |
const IntVector & | all_discrete_int_variables () const |
returns a single array with all discrete variables | |
void | all_discrete_int_variables (const IntVector &adi_vars) |
sets all discrete variables using a single array | |
void | all_discrete_int_variable (int adi_var, size_t index) |
set a variable within the all discrete array | |
StringMultiArrayConstView | all_discrete_string_variables () const |
returns a single array with all discrete variables | |
void | all_discrete_string_variables (StringMultiArrayConstView ads_vars) |
sets all discrete variables using a single array | |
void | all_discrete_string_variable (const String &ads_var, size_t index) |
set a variable within the all discrete array | |
const RealVector & | all_discrete_real_variables () const |
returns a single array with all discrete variables | |
void | all_discrete_real_variables (const RealVector &adr_vars) |
sets all discrete variables using a single array | |
void | all_discrete_real_variable (Real adr_var, size_t index) |
set a variable within the all discrete array | |
void | as_vector (const StringSetArray &dss_vals, RealVector &var_values) const |
get the active variables as a vector of reals, converting string values to zero-based set indices | |
StringMultiArrayView | all_continuous_variable_labels () const |
returns a single array with all continuous variable labels | |
void | all_continuous_variable_labels (StringMultiArrayConstView acv_labels) |
sets all continuous variable labels using a single array | |
void | all_continuous_variable_label (const String &acv_label, size_t index) |
set a label within the all continuous label array | |
StringMultiArrayView | all_discrete_int_variable_labels () const |
returns a single array with all discrete variable labels | |
void | all_discrete_int_variable_labels (StringMultiArrayConstView adiv_labels) |
sets all discrete variable labels using a single array | |
void | all_discrete_int_variable_label (const String &adiv_label, size_t index) |
set a label within the all discrete label array | |
StringMultiArrayView | all_discrete_string_variable_labels () const |
returns a single array with all discrete variable labels | |
void | all_discrete_string_variable_labels (StringMultiArrayConstView adsv_labels) |
sets all discrete variable labels using a single array | |
void | all_discrete_string_variable_label (const String &adsv_label, size_t index) |
set a label within the all discrete label array | |
StringMultiArrayView | all_discrete_real_variable_labels () const |
returns a single array with all discrete variable labels | |
void | all_discrete_real_variable_labels (StringMultiArrayConstView adrv_labels) |
sets all discrete variable labels using a single array | |
void | all_discrete_real_variable_label (const String &adrv_label, size_t index) |
set a label within the all discrete label array | |
UShortMultiArrayConstView | all_continuous_variable_types () const |
return all continuous variable types | |
UShortMultiArrayConstView | all_discrete_int_variable_types () const |
return all discrete variable types | |
UShortMultiArrayConstView | all_discrete_string_variable_types () const |
return all discrete variable types | |
UShortMultiArrayConstView | all_discrete_real_variable_types () const |
return all discrete variable types | |
SizetMultiArrayConstView | all_continuous_variable_ids () const |
return all continuous variable position identifiers | |
SizetMultiArrayConstView | all_discrete_int_variable_ids () const |
return all discrete integer variable position identifiers | |
SizetMultiArrayConstView | all_discrete_string_variable_ids () const |
return all discrete string variable position identifiers | |
SizetMultiArrayConstView | all_discrete_real_variable_ids () const |
return all discrete real variable position identifiers | |
StringArray | ordered_labels (unsigned short vars_part=ALL_VARS) const |
get all or active labels in input spec order | |
Variables | copy (bool deep_svd=false) const |
a deep variables copy for use in history mechanisms (SharedVariablesData uses a shallow copy by default) | |
Variables | copy (const SharedVariablesData &svd) const |
a deep variables copy that shares an incoming SharedVariablesData | |
void | copy_rep (std::shared_ptr< Variables > source_vars_rep) |
copy attributes from source to target representation (shared code among copy() implementations) | |
const ShortShortPair & | view () const |
returns variablesView | |
ShortShortPair | get_view (const ProblemDescDB &problem_db) const |
defines variablesView from problem_db attributes | |
void | active_view (short view1) |
overrides the active view | |
void | inactive_view (short view2) |
sets the inactive view based on higher level (nested) context | |
const String & | variables_id () const |
returns the variables identifier string | |
const SizetArray & | variables_components_totals () const |
returns the number of variables for each of the constitutive components | |
bool | is_null () const |
function to check variablesRep (does this envelope contain a letter) | |
Protected Member Functions | |
void | read (std::istream &s) |
read a variables object from an std::istream | |
void | read_tabular (std::istream &s, unsigned short vars_part=ALL_VARS) |
void | write (std::ostream &s, unsigned short vars_part=ALL_VARS) const |
write a variables object to an std::ostream, e.g., the console, optionally specifying which partition (all/active/inactive) | |
void | write_aprepro (std::ostream &s) const |
write a variables object to an std::ostream in aprepro format, e.g., a parameters file | |
void | write_tabular (std::ostream &s, unsigned short vars_part=ALL_VARS) const |
write a variables object in tabular format to an std::ostream, optionally specifying which partition (all/active/inactive) | |
void | write_tabular_partial (std::ostream &s, size_t start_index, size_t num_items) const |
write range of variables in tabular format to an std::ostream | |
void | write_tabular_labels (std::ostream &s, unsigned short vars_part=ALL_VARS) const |
write the labels in input spec order to a std::ostream, optionally specifying which partition (all/active/inactive) | |
void | write_tabular_partial_labels (std::ostream &s, size_t start_index, size_t num_items) const |
write range of variable labels in input spec order to a std::ostream | |
template<typename Reader > | |
void | read_core (std::istream &s, Reader read_handler, unsigned short vars_part) |
Implementation of reading various formats using the specified read handler. More... | |
template<typename Writer > | |
void | write_core (std::ostream &s, Writer write_handler, unsigned short vars_part) const |
Implementation for writing various formats using the specified write handler. | |
template<typename Writer > | |
bool | write_partial_core (std::ostream &s, Writer write_handler, size_t start_index, size_t end_index, size_t &acv_offset, size_t &adiv_offset, size_t &adsv_offset, size_t &adrv_offset, size_t &av_cntr, size_t num_cv, size_t num_div, size_t num_dsv, size_t num_drv) const |
Implementation for partial writing in various formats using the specified write handler. | |
Protected Member Functions inherited from Variables | |
Variables (BaseConstructor, const ProblemDescDB &problem_db, const ShortShortPair &view) | |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) | |
Variables (BaseConstructor, const SharedVariablesData &svd) | |
constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139) | |
void | build_views () |
construct active/inactive views of all variables arrays | |
void | build_active_views () |
construct active views of all variables arrays | |
void | build_inactive_views () |
construct inactive views of all variables arrays | |
Additional Inherited Members | |
Protected Attributes inherited from Variables | |
SharedVariablesData | sharedVarsData |
reference-counted instance of shared variables data: id's, labels, counts | |
RealVector | allContinuousVars |
array combining all of the continuous variables | |
IntVector | allDiscreteIntVars |
array combining all of the discrete integer variables | |
StringMultiArray | allDiscreteStringVars |
array combining all of the discrete string variables | |
RealVector | allDiscreteRealVars |
array combining all of the discrete real variables | |
RealVector | continuousVars |
the active continuous variables array view | |
IntVector | discreteIntVars |
the active discrete integer variables array view | |
RealVector | discreteRealVars |
the active discrete real variables array view | |
RealVector | inactiveContinuousVars |
the inactive continuous variables array view | |
IntVector | inactiveDiscreteIntVars |
the inactive discrete integer variables array view | |
RealVector | inactiveDiscreteRealVars |
the inactive discrete real variables array view | |
Derived class within the Variables hierarchy which separates continuous and discrete variables (no domain type array merging).
Derived variables classes take different views of the design, uncertain, and state variable types and the continuous and discrete domain types. The MixedVariables derived class separates the continuous and discrete domain types (see Variables::get_variables(problem_db)).
MixedVariables | ( | const ProblemDescDB & | problem_db, |
const ShortShortPair & | view | ||
) |
standard constructor
In this class, the distinct approach is used (design, uncertain, and state variable types and continuous and discrete domain types are distinct). Most iterators/strategies use this approach.
References Variables::allContinuousVars, Variables::allDiscreteIntVars, Variables::allDiscreteRealVars, Variables::allDiscreteStringVars, Dakota::copy_data_partial(), ProblemDescDB::get_iv(), ProblemDescDB::get_rv(), and ProblemDescDB::get_sa().
|
protectedvirtual |
Tabular reader that reads data in order design, aleatory, epistemic, state according to counts in vc_totals (extract in order: cdv/ddiv/ddrv, cauv/dauiv/daurv, ceuv/deuiv/deurv, csv/dsiv/dsrv, which might reflect active or all depending on context. Assumes container sized, since might be a view into a larger array.
Reimplemented from Variables.
References MixedVariables::read_core().
|
protected |
Implementation of reading various formats using the specified read handler.
Reordering is required in all read/write cases that will be visible to the user since all derived vars classes should use the same CDV/DDV/UV/CSV/DSV ordering for clarity. Neutral file I/O, binary streams, and packed buffers do not need to reorder (so long as read/write are consistent) since this data is not intended for public consumption.
References SharedVariablesData::active_components_totals(), Variables::all_continuous_variable_labels(), Variables::all_discrete_int_variable_labels(), Variables::all_discrete_real_variable_labels(), Variables::all_discrete_string_variable_labels(), Variables::allContinuousVars, Variables::allDiscreteIntVars, Variables::allDiscreteRealVars, Variables::allDiscreteStringVars, SharedVariablesData::components_totals(), SharedVariablesData::cv_start(), SharedVariablesData::div_start(), SharedVariablesData::drv_start(), SharedVariablesData::dsv_start(), SharedVariablesData::icv_start(), SharedVariablesData::idiv_start(), SharedVariablesData::idrv_start(), SharedVariablesData::idsv_start(), SharedVariablesData::inactive_components_totals(), and Variables::sharedVarsData.
Referenced by MixedVariables::read(), and MixedVariables::read_tabular().