1 /*  _______________________________________________________________________
2 
3     DAKOTA: Design Analysis Kit for Optimization and Terascale Applications
4     Copyright 2014-2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
5     This software is distributed under the GNU Lesser General Public License.
6     For more information, see the README file in the top Dakota directory.
7     _______________________________________________________________________ */
8 
9 #ifndef ADAPTED_BASIS_MODEL_H
10 #define ADAPTED_BASIS_MODEL_H
11 
12 #include "SubspaceModel.hpp"
13 #include "DakotaIterator.hpp"
14 
15 namespace Dakota {
16 
17 /// forward declarations
18 class NonDPolynomialChaos;
19 class ProblemDescDB;
20 
21 
22 /// Adapted basis model for input (variable space) reduction
23 
24 /** Specialization of a RecastModel that creates an adapted basis model
25     during build phase and creates a RecastModel in the reduced space */
26 class AdaptedBasisModel: public SubspaceModel
27 {
28 public:
29 
30   //
31   //- Heading: Constructor and destructor
32   //
33 
34   /// Problem database constructor
35   AdaptedBasisModel(ProblemDescDB& problem_db);
36   /// destructor
37   ~AdaptedBasisModel();
38 
39 protected:
40 
41   //
42   //- Heading: Virtual function redefinitions
43   //
44 
45   void derived_init_communicators(ParLevLIter pl_iter, int max_eval_concurrency,
46                                   bool recurse_flag);
47 
48   void derived_set_communicators(ParLevLIter pl_iter, int max_eval_concurrency,
49                                  bool recurse_flag);
50 
51   void derived_free_communicators(ParLevLIter pl_iter, int max_eval_concurrency,
52                                   bool recurse_flag);
53 
54   // ---
55   // Construct time convenience functions
56   // ---
57 
58   /// retrieve the sub-Model from the DB to pass up the constructor chain
59   Model get_sub_model(ProblemDescDB& problem_db);
60 
61   // ---
62   // Subspace identification functions: rank-revealing build phase
63   // ---
64 
65   // Iteratively sample the fullspace model until subspace identified
66   // that meets user-specified criteria
67   void compute_subspace();
68 
69 
70   // ---
71   // Problem transformation functions
72   // ---
73 
74   /// translate the characterization of uncertain variables in the
75   /// native_model to the reduced space of the transformed model
76   void uncertain_vars_to_subspace();
77 
78   // ---
79   // Callback functions that perform data transform during the Recast operations
80   // ---
81 
82   /// map the active continuous recast variables to the active
83   /// submodel variables (linear transformation)
84   static void variables_mapping(const Variables& recast_xi_vars,
85 				Variables& sub_model_x_vars);
86 
87   // ---
88   // Member data
89   // ---
90 
91   /// BMA TODO: The initialization order of this Model, base
92   /// RecastModel, and interdependence with PCE and its sub-model need
93   /// fixing. Cannot make this a shared_ptr as it'll get default
94   /// constructed and cleared after get_sub_model is called. Leaving
95   /// as Iterator* for now, but we're just getting lucky with
96   /// initialization (would probably break in a DEBUG build.
97 
98   /// PCE representation pointer that is initialized in get_sub_model() and
99   /// then assigned into pcePilotExpansion in the constructor initializer list
100   NonDPolynomialChaos* pcePilotExpRepPtr;
101   /// low-order (linear or quadratic) PCE generator for computing rotation
102   /// matrices A_i for each of the QoI; this is low-order and potentially
103   /// high-dimension whereas a client PCE could be high-order in the
104   /// reduced dimension
105   Iterator pcePilotExpansion;
106 };
107 
108 } // namespace Dakota
109 
110 #endif
111