Inheritance diagram for Variables:

Public Member Functions | |
| Variables () | |
| default constructor | |
| Variables (const ProblemDescDB &problem_db) | |
| standard constructor | |
| Variables (const pair< short, short > &view) | |
| alternate constructor for instantiations on the fly | |
| Variables (const Variables &vars) | |
| copy constructor | |
| virtual | ~Variables () |
| destructor | |
| Variables | operator= (const Variables &vars) |
| assignment operator | |
| virtual size_t | tv () const |
| Returns total number of vars. | |
| virtual const UIntArray & | merged_discrete_ids () const |
| returns the list of discrete variables merged into a continuous array | |
| virtual const RealVector & | continuous_variables () const |
| return the active continuous variables | |
| virtual void | continuous_variable (const Real &c_var, const size_t &i) |
| set an active continuous variable | |
| virtual void | continuous_variables (const RealVector &c_vars) |
| set the active continuous variables | |
| virtual const IntVector & | discrete_variables () const |
| return the active discrete variables | |
| virtual void | discrete_variable (const int &d_var, const size_t &i) |
| set an active discrete variable | |
| virtual void | discrete_variables (const IntVector &d_vars) |
| set the active discrete variables | |
| virtual const StringArray & | continuous_variable_labels () const |
| return the active continuous variable labels | |
| virtual void | continuous_variable_labels (const StringArray &cv_labels) |
| set the active continuous variable labels | |
| virtual const StringArray & | discrete_variable_labels () const |
| return the active discrete variable labels | |
| virtual void | discrete_variable_labels (const StringArray &dv_labels) |
| set the active discrete variable labels | |
| virtual const StringArray & | continuous_variable_types () const |
| return the active continuous variable types | |
| virtual const StringArray & | discrete_variable_types () const |
| return the active discrete variable types | |
| virtual const UIntArray & | continuous_variable_ids () const |
| return the active continuous variable position identifiers | |
| virtual const RealVector & | inactive_continuous_variables () const |
| return the inactive continuous variables | |
| virtual void | inactive_continuous_variables (const RealVector &i_c_vars) |
| set the inactive continuous variables | |
| virtual const IntVector & | inactive_discrete_variables () const |
| return the inactive discrete variables | |
| virtual void | inactive_discrete_variables (const IntVector &i_d_vars) |
| set the inactive discrete variables | |
| virtual const StringArray & | inactive_continuous_variable_labels () const |
| return the inactive continuous variable labels | |
| virtual void | inactive_continuous_variable_labels (const StringArray &i_c_vars) |
| set the inactive continuous variable labels | |
| virtual const StringArray & | inactive_discrete_variable_labels () const |
| return the inactive discrete variable labels | |
| virtual void | inactive_discrete_variable_labels (const StringArray &i_d_vars) |
| set the inactive discrete variable labels | |
| virtual const UIntArray & | inactive_continuous_variable_ids () const |
| return the inactive continuous variable position identifiers | |
| virtual size_t | acv () const |
| returns total number of continuous vars | |
| virtual size_t | adv () const |
| returns total number of discrete vars | |
| virtual RealVector | all_continuous_variables () const |
| returns a single array with all continuous variables | |
| virtual void | all_continuous_variables (const RealVector &a_c_vars) |
| sets all continuous variables using a single array | |
| virtual IntVector | all_discrete_variables () const |
| returns a single array with all discrete variables | |
| virtual void | all_discrete_variables (const IntVector &a_d_vars) |
| sets all discrete variables using a single array | |
| virtual StringArray | all_continuous_variable_labels () const |
| returns a single array with all continuous variable labels | |
| virtual void | all_continuous_variable_labels (const StringArray &a_c_v_labels) |
| sets all continuous variable labels using a single array | |
| virtual StringArray | all_discrete_variable_labels () const |
| returns a single array with all discrete variable labels | |
| virtual void | all_discrete_variable_labels (const StringArray &a_d_v_labels) |
| sets all discrete variable labels using a single array | |
| virtual StringArray | all_variable_labels () const |
| returns a single array with all variable labels | |
| virtual const StringArray & | all_discrete_variable_types () const |
| return the all discrete variable types | |
| virtual void | read (istream &s) |
| read a variables object from an istream | |
| virtual void | write (ostream &s) const |
| write a variables object to an ostream | |
| virtual void | write_aprepro (ostream &s) const |
| write a variables object to an ostream in aprepro format | |
| virtual void | read_annotated (istream &s) |
| read a variables object in annotated format from an istream | |
| virtual void | write_annotated (ostream &s) const |
| write a variables object in annotated format to an ostream | |
| virtual void | write_tabular (ostream &s) const |
| write a variables object in tabular format to an ostream | |
| virtual void | read (BiStream &s) |
| read a variables object from the binary restart stream | |
| virtual void | write (BoStream &s) const |
| write a variables object to the binary restart stream | |
| 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 | cv () const |
| Returns number of active continuous vars. | |
| size_t | dv () const |
| Returns number of active discrete vars. | |
| size_t | icv () const |
| returns number of inactive continuous vars | |
| size_t | idv () const |
| returns number of inactive discrete vars | |
| const Real & | continuous_variable (const size_t &i) const |
| return an active continuous variable | |
| const int & | discrete_variable (const size_t &i) const |
| return an active discrete variable | |
| Variables | copy () const |
| for use when a deep copy is needed (the representation is _not_ shared) | |
| void | reshape (const Sizet2DArray &vars_comps) |
| variablesComponents | |
| const pair< short, short > & | view () const |
| returns variablesView | |
| pair< short, short > | get_view (const ProblemDescDB &problem_db) const |
| defines variablesView from problem_db attributes | |
| const String & | variables_id () const |
| returns the variables identifier string | |
| const Sizet2DArray & | variables_components () const |
| returns the number of variables for each of the constitutive components | |
| const StringArray & | all_continuous_variable_types () const |
| return all continuous variable types | |
| const UIntArray & | all_continuous_variable_ids () const |
| return all continuous variable position identifiers | |
| bool | is_null () const |
| function to check variablesRep (does this envelope contain a letter) | |
Protected Member Functions | |
| Variables (BaseConstructor, const ProblemDescDB &problem_db, const pair< short, short > &view) | |
| derived class constructors - Coplien, p. 139) | |
| virtual void | copy_rep (const Variables *vars_rep) |
| Used by copy() to copy the contents of a letter class. | |
| virtual void | reshape_rep (const Sizet2DArray &vars_comps) |
| Used by reshape() to reshape the contents of a letter class. | |
| void | uncertain_var_types (size_t &acv_cntr) |
| Convenience function for shared code within build_types_ids(). | |
Protected Attributes | |
| pair< short, short > | variablesView |
| view enumerations | |
| Sizet2DArray | variablesComponents |
| design/uncertain/state (first index) by sub-type (second index) | |
| StringArray | allContinuousVarTypes |
| array of variable types for the all continuous variables array | |
| UIntArray | allContinuousVarIds |
| array of position identifiers for the all continuous variables array | |
| RealVector | emptyRealVector |
| no variables corresponding to the request | |
| IntVector | emptyIntVector |
| no variables corresponding to the request | |
| StringArray | emptyStringArray |
| no variables corresponding to the request | |
| UIntArray | emptyUIntArray |
| are no variables corresponding to the request | |
Private Member Functions | |
| Variables * | get_variables (const ProblemDescDB &problem_db) |
| correct letter class | |
| Variables * | get_variables (const pair< short, short > &view) const |
| and by copy() to instantiate a new letter class | |
Private Attributes | |
| String | idVariables |
| variables identifier string from the input file | |
| Variables * | variablesRep |
| pointer to the letter (initialized only for the envelope) | |
| int | referenceCount |
| number of objects sharing variablesRep | |
Friends | |
| bool | operator== (const Variables &vars1, const Variables &vars2) |
| equality operator | |
| bool | operator!= (const Variables &vars1, const Variables &vars2) |
| inequality operator | |
| std::size_t | hash_value (const Variables &vars) |
| hash_value | |
| bool | binary_equal_to (const Variables &vars1, const Variables &vars2) |
| binary_equal_to (since 'operator==' is not suitable for boost/hash_set) | |
The Variables class is the base class for the class hierarchy providing design, uncertain, and state variables for continuous and discrete domains within a Model. Using the fundamental arrays from the input specification, different derived classes define different views of the data. For memory efficiency and enhanced polymorphism, the variables hierarchy employs the "letter/envelope idiom" (see Coplien "Advanced C++", p. 133), for which the base class (Variables) serves as the envelope and one of the derived classes (selected in Variables::get_variables()) serves as the letter.
| Variables | ( | ) |
default constructor
The default constructor: variablesRep is NULL in this case (a populated problem_db is needed to build a meaningful Variables object). This makes it necessary to check for NULL in the copy constructor, assignment operator, and destructor.
| Variables | ( | const ProblemDescDB & | problem_db | ) |
standard constructor
This is the primary envelope constructor which uses problem_db to build a fully populated variables object. It only needs to extract enough data to properly execute get_variables(problem_db), since the constructor overloaded with BaseConstructor builds the actual base class data inherited by the derived classes.
| Variables | ( | const pair< short, short > & | view | ) |
alternate constructor for instantiations on the fly
This is the alternate envelope constructor for instantiations on the fly. Since it does not have access to problem_db, the letter class is not fully populated. This constructor executes get_variables(view), which invokes the default constructor of the derived letter class, which in turn invokes the default constructor of the base class.
copy constructor
Copy constructor manages sharing of variablesRep and incrementing of referenceCount.
| ~Variables | ( | ) | [virtual] |
destructor
Destructor decrements referenceCount and only deletes variablesRep when referenceCount reaches zero.
| Variables | ( | BaseConstructor | , | |
| const ProblemDescDB & | problem_db, | |||
| const pair< short, short > & | view | |||
| ) | [protected] |
derived class constructors - Coplien, p. 139)
This constructor is the one which must build the base class data for all derived classes. get_variables() instantiates a derived class letter and the derived constructor selects this base class constructor in its initialization list (to avoid the recursion of the base class constructor calling get_variables() again). Since the letter IS the representation, its representation pointer is set to NULL (an uninitialized pointer causes problems in ~Variables).
assignment operator
Assignment operator decrements referenceCount for old variablesRep, assigns new variablesRep, and increments referenceCount for new variablesRep.
| Variables copy | ( | ) | const |
for use when a deep copy is needed (the representation is _not_ shared)
Deep copies are used for history mechanisms such as bestVariables and data_pairs since these must catalogue copies (and should not change as the representation within currentVariables changes).
| Variables * get_variables | ( | const ProblemDescDB & | problem_db | ) | [private] |
correct letter class
Initializes variablesRep to the appropriate derived type, as given by problem_db attributes. The standard derived class constructors are invoked.
| Variables * get_variables | ( | const pair< short, short > & | view | ) | const [private] |
and by copy() to instantiate a new letter class
Initializes variablesRep to the appropriate derived type, as given by view. The default derived class constructors are invoked.
UIntArray allContinuousVarIds [protected] |
array of position identifiers for the all continuous variables array
These identifiers define positions of the all continuous variables array within the total variable sequence.
1.5.1