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 //- Class:       SharedVariablesData
10 //- Description: Encapsulation of data that can be shared among Variables
11 //-              instances.
12 //- Owner:       Mike Eldred
13 //- Version: $Id: SharedVariablesData.hpp 6784 2010-05-18 21:10:35Z mseldre $
14 
15 #ifndef SHARED_VARIABLES_DATA_H
16 #define SHARED_VARIABLES_DATA_H
17 
18 #include "dakota_data_types.hpp"
19 #include "DataVariables.hpp"
20 #include <boost/serialization/access.hpp>
21 #include <boost/serialization/split_member.hpp>
22 #include <boost/serialization/tracking.hpp>
23 #include <boost/shared_ptr.hpp>
24 
25 namespace Dakota {
26 
27 // forward declarations
28 class ProblemDescDB;
29 
30 
31 /// The representation of a SharedVariablesData instance.  This representation,
32 /// or body, may be shared by multiple SharedVariablesData handle instances.
33 
34 /** The SharedVariablesData/SharedVariablesDataRep pairs utilize a
35     handle-body idiom (Coplien, Advanced C++). */
36 
37 class SharedVariablesDataRep
38 {
39   //
40   //- Heading: Friends
41   //
42 
43   friend class SharedVariablesData;
44 
45   /// allow boost access to serialize this class
46   friend class boost::serialization::access;
47 
48 public:
49 
50   /// destructor must be public for shared_ptr
51   ~SharedVariablesDataRep();
52 
53 private:
54 
55   //
56   //- Heading: Constructor and destructor
57   //
58 
59   /// standard constructor
60   SharedVariablesDataRep(const ProblemDescDB& problem_db,
61 			 const std::pair<short,short>& view);
62   /// medium weight constructor providing detailed variable counts
63   SharedVariablesDataRep(const std::pair<short,short>& view,
64 			 const std::map<unsigned short, size_t>& vars_comps,
65 			 const BitArray& all_relax_di,
66 			 const BitArray& all_relax_dr);
67   /// lightweight constructor providing variable count totals
68   SharedVariablesDataRep(const std::pair<short,short>& view,
69 			 const SizetArray& vars_comps_totals,
70 			 const BitArray& all_relax_di,
71 			 const BitArray& all_relax_dr);
72   /// default constructor
73   SharedVariablesDataRep();
74 
75   //
76   //- Heading: Member functions
77   //
78 
79   /// populate variables{Components,CompsTotals} from user variable
80   /// type and count specifications
81   void initialize_components_totals(const ProblemDescDB& problem_db);
82   /// update variablesCompsTotals from variablesComponents
83   void components_to_totals();
84 
85   /// populate allRelaxedDiscrete{Int,Real} from user specifications
86   /// (relax variables that are not declared as categorical)
87   void relax_noncategorical(const ProblemDescDB& problem_db);
88 
89   /// Set the ard_cntr entry in the all-relaxed-discrete integer or
90   /// real container ard_container, based on user-specification of
91   /// categorical, accounting for empty
92   void set_relax(const BitArray& user_cat_spec, size_t ucs_index,
93 		 size_t ard_cntr, BitArray& ard_container);
94 
95   /// compute all variables sums from variablesCompsTotals
96   void all_counts(size_t& num_acv, size_t& num_adiv, size_t& num_adsv,
97 		  size_t& num_adrv) const;
98   /// adjust counts based on allRelaxedDiscrete{Int,Real}
99   void relax_counts(size_t& num_cv, size_t& num_div, size_t& num_drv,
100 		    size_t offset_di, size_t offset_dr) const;
101   /// compute design variables sums from variablesCompsTotals
102   void design_counts(size_t& num_cdv, size_t& num_ddiv, size_t& num_ddsv,
103 		     size_t& num_ddrv) const;
104   /// compute aleatory uncertain variables sums from variablesCompsTotals
105   void aleatory_uncertain_counts(size_t& num_cauv,  size_t& num_dauiv,
106 				 size_t& num_dausv, size_t& num_daurv) const;
107   /// compute epistemic uncertain variables sums from variablesCompsTotals
108   void epistemic_uncertain_counts(size_t& num_ceuv,  size_t& num_deuiv,
109 				  size_t& num_deusv, size_t& num_deurv) const;
110   /// compute uncertain variables sums from variablesCompsTotals
111   void uncertain_counts(size_t& num_cuv,  size_t& num_duiv,
112 			size_t& num_dusv, size_t& num_durv) const;
113   /// compute state variables sums from variablesCompsTotals
114   void state_counts(size_t& num_csv,  size_t& num_dsiv,
115 		    size_t& num_dssv, size_t& num_dsrv) const;
116 
117   /// define start indices and counts for active variables based on view
118   void view_start_counts(short view, size_t& cv_start, size_t& div_start,
119 			 size_t& dsv_start, size_t& drv_start,
120 			 size_t& num_cv, size_t& num_div, size_t& num_dsv,
121 			 size_t& num_drv) const;
122 
123   /// define active variable subsets based on active view
124   void view_subsets(short view, bool& cdv,  bool& ddv, bool& cauv, bool& dauv,
125 		    bool& ceuv, bool& deuv, bool& csv, bool& dsv) const;
126 
127   /// size all{Continuous,DiscreteInt,DiscreteString,DiscreteReal}Labels,
128   /// with or without discrete relaxation
129   void size_all_labels();
130   /// size all{Continuous,DiscreteInt,DiscreteString,DiscreteReal}Types,
131   /// with or without discrete relaxation
132   void size_all_types();
133 
134   /// convert index within active continuous variables (as identified
135   /// by bools) to index within aggregated variables (all continous,
136   /// discrete {int,string,real})
137   size_t cv_index_to_all_index(size_t cv_index,
138 			       bool cdv, bool cauv, bool ceuv, bool csv) const;
139   /// convert index within active discrete integer variables (as
140   /// identified by bools) to index within aggregated variables (all
141   /// continous, discrete {int,string,real})
142   size_t div_index_to_all_index(size_t div_index,
143 				bool ddv, bool dauv, bool deuv, bool dsv) const;
144   /// convert index within active discrete string variables (as
145   /// identified by bools) to index within aggregated variables (all
146   /// continous, discrete {int,string,real})
147   size_t dsv_index_to_all_index(size_t dsv_index,
148 				bool ddv, bool dauv, bool deuv, bool dsv) const;
149   /// convert index within active discrete real variables (as
150   /// identified by bools) to index within aggregated variables (all
151   /// continous, discrete {int,string,real})
152   size_t drv_index_to_all_index(size_t drv_index,
153 				bool ddv, bool dauv, bool deuv, bool dsv) const;
154 
155   /// create a BitArray indicating the active continuous subset of all
156   /// {continuous,discrete {int,string,real}} variables
157   BitArray cv_to_all_mask(bool cdv, bool cauv, bool ceuv, bool csv) const;
158   /// create a BitArray indicating the active discrete int subset of all
159   /// {continuous,discrete {int,string,real}} variables
160   BitArray div_to_all_mask(bool ddv, bool dauv, bool deuv, bool dsv) const;
161   /// create a BitArray indicating the active discrete string subset of all
162   /// {continuous,discrete {int,string,real}} variables
163   BitArray dsv_to_all_mask(bool ddv, bool dauv, bool deuv, bool dsv) const;
164   /// create a BitArray indicating the active discrete real subset of all
165   /// {continuous,discrete {int,string,real}} variables
166   BitArray drv_to_all_mask(bool ddv, bool dauv, bool deuv, bool dsv) const;
167 
168   /// aggregate all{Continuous,DiscreteInt,DiscreteString,DiscreteReal}Labels
169   /// from user specification or defaults
170   void initialize_all_labels(const ProblemDescDB& problem_db);
171   /// initialize all{Continuous,DiscreteInt,DiscreteString,DiscreteReal}Types,
172   /// with or without discrete relaxation
173   void initialize_all_types();
174   /// initialize allContinuousIds (discrete not currently needed),
175   /// with or without discrete relaxation
176   void initialize_all_ids();
177 
178   /// initialize {c,di,ds,dr}vStart and num{D,DI,DS,DR}V
179   void initialize_active_start_counts();
180   /// initialize i{c,di,ds,dr}vStart and numI{D,DI,DS,DR}V
181   void initialize_inactive_start_counts();
182 
183   /// initialize activeVarsCompsTotals given {c,di,dr}vStart and num{C,DI,DR}V
184   void initialize_active_components();
185   /// initialize inactiveVarsCompsTotals given i{c,di,dr}vStart and
186   /// numI{C,DI,DR}V
187   void initialize_inactive_components();
188 
189   /// retrieve the count within variablesComponents corresponding to key
190   size_t vc_lookup(unsigned short key) const;
191 
192   /// copy the data from svd_rep to the current representation
193   void copy_rep(SharedVariablesDataRep* svd_rep);
194 
195   /// serialize the core shared variables data
196   template<class Archive>
197   void save(Archive& ar, const unsigned int version) const;
198 
199   /// load the core shared variables data and restore class state
200   template<class Archive>
201   void load(Archive& ar, const unsigned int version);
202 
203   BOOST_SERIALIZATION_SPLIT_MEMBER()
204 
205 
206   //
207   //- Heading: Data
208   //
209 
210   /// variables identifier string from the input file
211   String variablesId;
212 
213   /// map linking variable types to counts
214   std::map<unsigned short, size_t> variablesComponents;
215   /// totals for variable type counts for
216   /// {continuous,discrete integer,discrete string,discrete real}
217   /// {design,aleatory uncertain,epistemic uncertain,state}.
218   /** This data reflects the variable counts as originally specified
219       and is not altered by relaxation. */
220   SizetArray variablesCompsTotals;
221   /// totals for active variable type counts for
222   /// {continuous,discrete integer,discrete string,discrete real}
223   /// {design,aleatory uncertain,epistemic uncertain,state}.
224   /** This data reflects the variable counts as originally specified
225       and is not altered by relaxation. */
226   SizetArray activeVarsCompsTotals;
227   /// totals for inactive variable type counts for
228   /// {continuous,discrete integer,discrete string,discrete real}
229   /// {design,aleatory uncertain,epistemic uncertain,state}.
230   /** This data reflects the variable counts as originally specified
231       and is not altered by relaxation. */
232   SizetArray inactiveVarsCompsTotals;
233 
234   /// the variables view pair containing active (first) and inactive (second)
235   /// view enumerations
236   std::pair<short, short> variablesView;
237   /// start index of active continuous variables within allContinuousVars
238   size_t cvStart;
239   /// start index of active discrete integer variables within allDiscreteIntVars
240   size_t divStart;
241   /// start index of active discrete string vars within allDiscreteStringVars
242   size_t dsvStart;
243   /// start index of active discrete real variables within allDiscreteRealVars
244   size_t drvStart;
245   /// start index of inactive continuous variables within allContinuousVars
246   size_t icvStart;
247   /// start index of inactive discrete integer vars within allDiscreteIntVars
248   size_t idivStart;
249   /// start index of inactive discrete string vars within allDiscreteStringVars
250   size_t idsvStart;
251   /// start index of inactive discrete real variables within allDiscreteRealVars
252   size_t idrvStart;
253   size_t numCV;   ///< number of active continuous variables
254   size_t numDIV;  ///< number of active discrete integer variables
255   size_t numDSV;  ///< number of active discrete string variables
256   size_t numDRV;  ///< number of active discrete real variables
257   size_t numICV;  ///< number of inactive continuous variables
258   size_t numIDIV; ///< number of inactive discrete integer variables
259   size_t numIDSV; ///< number of inactive discrete string variables
260   size_t numIDRV; ///< number of inactive discrete real variables
261 
262   /// array of variable labels for all of the continuous variables
263   StringMultiArray allContinuousLabels;
264   /// array of variable labels for all of the discrete integer variables
265   StringMultiArray allDiscreteIntLabels;
266   /// array of variable labels for all of the discrete string variables
267   StringMultiArray allDiscreteStringLabels;
268   /// array of variable labels for all of the discrete real variables
269   StringMultiArray allDiscreteRealLabels;
270 
271   /// array of variable types for all of the continuous variables
272   UShortMultiArray allContinuousTypes;
273   /// array of variable types for all of the discrete integer variables
274   UShortMultiArray allDiscreteIntTypes;
275   /// array of variable types for all of the discrete string variables
276   UShortMultiArray allDiscreteStringTypes;
277   /// array of variable types for all of the discrete real variables
278   UShortMultiArray allDiscreteRealTypes;
279 
280   /// array of 1-based position identifiers for the all continuous
281   /// variables array
282   /** These identifiers define positions of the all continuous variables
283       array within the total variable sequence.  A primary use case is
284       for defining derivative ids (DVV) based on an active subset. */
285   SizetMultiArray allContinuousIds;
286 
287   /// array of 1-based ids (into total variable set) for discrete int
288   SizetMultiArray allDiscreteIntIds;
289   /// array of 1-based ids (into total variable set) for discrete string
290   SizetMultiArray allDiscreteStringIds;
291   /// array of 1-based ids (into total variable set) for discrete real
292   SizetMultiArray allDiscreteRealIds;
293 
294   /// array of booleans to indicate relaxation (promotion from
295   /// DiscreteInt to Continuous) for all specified discrete int variables
296   /// Note: container will be empty when not relaxing variables
297   BitArray allRelaxedDiscreteInt;
298   /// array of booleans to indicate relaxation (promotion from
299   /// DiscreteReal to Continuous) for all specified discrete real variables
300   /// Note: container will be empty when not relaxing variables
301   BitArray allRelaxedDiscreteReal;
302 };
303 
304 
SharedVariablesDataRep()305 inline SharedVariablesDataRep::SharedVariablesDataRep():
306   cvStart(0), divStart(0), dsvStart(0), drvStart(0), icvStart(0), idivStart(0),
307   idsvStart(0), idrvStart(0), numCV(0), numDIV(0), numDSV(0), numDRV(0),
308   numICV(0), numIDIV(0), numIDSV(0), numIDRV(0)
309 { /* empty ctor */ }
310 
311 
~SharedVariablesDataRep()312 inline SharedVariablesDataRep::~SharedVariablesDataRep()
313 { /* empty dtor */ }
314 
315 
vc_lookup(unsigned short key) const316 inline size_t SharedVariablesDataRep::vc_lookup(unsigned short key) const
317 {
318   std::map<unsigned short, size_t>::const_iterator cit
319     = variablesComponents.find(key);
320   return (cit == variablesComponents.end()) ? 0 : cit->second;
321 }
322 
323 
324 inline void SharedVariablesDataRep::
all_counts(size_t & num_acv,size_t & num_adiv,size_t & num_adsv,size_t & num_adrv) const325 all_counts(size_t& num_acv, size_t& num_adiv, size_t& num_adsv,
326 	   size_t& num_adrv) const
327 {
328   num_acv = variablesCompsTotals[TOTAL_CDV]  + variablesCompsTotals[TOTAL_CAUV]
329           + variablesCompsTotals[TOTAL_CEUV] + variablesCompsTotals[TOTAL_CSV];
330   // num_adsv is always categorical
331   // num_adiv and num_adrv are updated below for relaxed non-categorical
332   num_adiv
333     = variablesCompsTotals[TOTAL_DDIV]  + variablesCompsTotals[TOTAL_DAUIV]
334     + variablesCompsTotals[TOTAL_DEUIV] + variablesCompsTotals[TOTAL_DSIV];
335   num_adsv
336     = variablesCompsTotals[TOTAL_DDSV]  + variablesCompsTotals[TOTAL_DAUSV]
337     + variablesCompsTotals[TOTAL_DEUSV] + variablesCompsTotals[TOTAL_DSSV];
338   num_adrv
339     = variablesCompsTotals[TOTAL_DDRV]  + variablesCompsTotals[TOTAL_DAURV]
340     + variablesCompsTotals[TOTAL_DEURV] + variablesCompsTotals[TOTAL_DSRV];
341 
342   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any()) {
343     size_t num_relax_int  = allRelaxedDiscreteInt.count(),
344            num_relax_real = allRelaxedDiscreteReal.count();
345     num_acv  += num_relax_int + num_relax_real;
346     num_adiv -= num_relax_int;
347     num_adrv -= num_relax_real;
348   }
349 }
350 
351 
352 inline void SharedVariablesDataRep::
relax_counts(size_t & num_cv,size_t & num_div,size_t & num_drv,size_t offset_di,size_t offset_dr) const353 relax_counts(size_t& num_cv, size_t& num_div, size_t& num_drv,
354 	     size_t offset_di, size_t offset_dr) const
355 {
356   size_t i, num_relax_int  = 0, num_relax_real = 0,
357     end_di = num_div + offset_di, end_dr = num_drv + offset_dr;
358   for (i=offset_di; i<end_di; ++i)
359     if (allRelaxedDiscreteInt[i])
360       ++num_relax_int;
361   for (i=offset_dr; i<end_dr; ++i)
362     if (allRelaxedDiscreteReal[i])
363       ++num_relax_real;
364   num_cv  += num_relax_int + num_relax_real;
365   num_div -= num_relax_int;
366   num_drv -= num_relax_real;
367 }
368 
369 
370 inline void SharedVariablesDataRep::
design_counts(size_t & num_cdv,size_t & num_ddiv,size_t & num_ddsv,size_t & num_ddrv) const371 design_counts(size_t& num_cdv, size_t& num_ddiv, size_t& num_ddsv,
372 	      size_t& num_ddrv) const
373 {
374   num_cdv  = variablesCompsTotals[TOTAL_CDV];
375   num_ddiv = variablesCompsTotals[TOTAL_DDIV];
376   num_ddsv = variablesCompsTotals[TOTAL_DDSV];
377   num_ddrv = variablesCompsTotals[TOTAL_DDRV];
378 
379   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any())
380     relax_counts(num_cdv, num_ddiv, num_ddrv, 0, 0);
381 }
382 
383 
384 inline void SharedVariablesDataRep::
aleatory_uncertain_counts(size_t & num_cauv,size_t & num_dauiv,size_t & num_dausv,size_t & num_daurv) const385 aleatory_uncertain_counts(size_t& num_cauv,  size_t& num_dauiv,
386 			  size_t& num_dausv, size_t& num_daurv) const
387 {
388   num_cauv  = variablesCompsTotals[TOTAL_CAUV];
389   num_dauiv = variablesCompsTotals[TOTAL_DAUIV];
390   num_dausv = variablesCompsTotals[TOTAL_DAUSV];
391   num_daurv = variablesCompsTotals[TOTAL_DAURV];
392 
393   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any())
394     relax_counts(num_cauv, num_dauiv, num_daurv,
395 		 variablesCompsTotals[TOTAL_DDIV],
396 		 variablesCompsTotals[TOTAL_DDRV]);
397 }
398 
399 
400 inline void SharedVariablesDataRep::
epistemic_uncertain_counts(size_t & num_ceuv,size_t & num_deuiv,size_t & num_deusv,size_t & num_deurv) const401 epistemic_uncertain_counts(size_t& num_ceuv,  size_t& num_deuiv,
402 			   size_t& num_deusv, size_t& num_deurv) const
403 {
404   num_ceuv  = variablesCompsTotals[TOTAL_CEUV];
405   num_deuiv = variablesCompsTotals[TOTAL_DEUIV];
406   num_deusv = variablesCompsTotals[TOTAL_DEUSV];
407   num_deurv = variablesCompsTotals[TOTAL_DEURV];
408 
409   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any())
410     relax_counts(num_ceuv, num_deuiv, num_deurv,
411 		 variablesCompsTotals[TOTAL_DDIV] +
412 		 variablesCompsTotals[TOTAL_DAUIV],
413 		 variablesCompsTotals[TOTAL_DDRV] +
414 		 variablesCompsTotals[TOTAL_DAURV]);
415 }
416 
417 
418 inline void SharedVariablesDataRep::
uncertain_counts(size_t & num_cuv,size_t & num_duiv,size_t & num_dusv,size_t & num_durv) const419 uncertain_counts(size_t& num_cuv,  size_t& num_duiv,
420 		 size_t& num_dusv, size_t& num_durv) const
421 {
422   num_cuv  = variablesCompsTotals[TOTAL_CAUV]
423            + variablesCompsTotals[TOTAL_CEUV];
424   num_duiv = variablesCompsTotals[TOTAL_DAUIV]
425            + variablesCompsTotals[TOTAL_DEUIV];
426   num_dusv = variablesCompsTotals[TOTAL_DAUSV]
427            + variablesCompsTotals[TOTAL_DEUSV];
428   num_durv = variablesCompsTotals[TOTAL_DAURV]
429            + variablesCompsTotals[TOTAL_DEURV];
430 
431   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any())
432     relax_counts(num_cuv, num_duiv, num_durv, variablesCompsTotals[TOTAL_DDIV],
433 		 variablesCompsTotals[TOTAL_DDRV]);
434 }
435 
436 
437 inline void SharedVariablesDataRep::
state_counts(size_t & num_csv,size_t & num_dsiv,size_t & num_dssv,size_t & num_dsrv) const438 state_counts(size_t& num_csv,  size_t& num_dsiv,
439 	     size_t& num_dssv, size_t& num_dsrv) const
440 {
441   num_csv  = variablesCompsTotals[TOTAL_CSV];
442   num_dsiv = variablesCompsTotals[TOTAL_DSIV];
443   num_dssv = variablesCompsTotals[TOTAL_DSSV];
444   num_dsrv = variablesCompsTotals[TOTAL_DSRV];
445 
446   if (allRelaxedDiscreteInt.any() || allRelaxedDiscreteReal.any())
447     relax_counts(num_csv, num_dsiv, num_dsrv, variablesCompsTotals[TOTAL_DDIV] +
448 		 variablesCompsTotals[TOTAL_DAUIV] +
449 		 variablesCompsTotals[TOTAL_DEUIV],
450 		 variablesCompsTotals[TOTAL_DDRV]  +
451 		 variablesCompsTotals[TOTAL_DAURV] +
452 		 variablesCompsTotals[TOTAL_DEURV]);
453 }
454 
455 
456 inline void SharedVariablesDataRep::
view_subsets(short view,bool & cdv,bool & ddv,bool & cauv,bool & dauv,bool & ceuv,bool & deuv,bool & csv,bool & dsv) const457 view_subsets(short view, bool&  cdv, bool& ddv, bool& cauv, bool& dauv,
458 	     bool& ceuv, bool& deuv, bool& csv, bool& dsv) const
459 {
460   // Continuous/discrete distinction is finer granularity than is currently
461   // necessary, but is more readily extensible...
462 
463   switch (view) {
464   case RELAXED_ALL:                 case MIXED_ALL:
465     cdv = ddv = cauv = dauv = ceuv = deuv = csv = dsv = true;        break;
466   case RELAXED_UNCERTAIN:           case MIXED_UNCERTAIN:
467     cdv = ddv = csv = dsv = false; cauv = dauv = ceuv = deuv = true; break;
468   case RELAXED_ALEATORY_UNCERTAIN:  case MIXED_ALEATORY_UNCERTAIN:
469     cdv = ddv = ceuv = deuv = csv = dsv = false; cauv = dauv = true; break;
470   case RELAXED_EPISTEMIC_UNCERTAIN: case MIXED_EPISTEMIC_UNCERTAIN:
471     cdv = ddv = cauv = dauv = csv = dsv = false; ceuv = deuv = true; break;
472   case RELAXED_DESIGN:              case MIXED_DESIGN:
473     cauv = dauv = ceuv = deuv = csv = dsv = false; cdv = ddv = true; break;
474   case RELAXED_STATE:               case MIXED_STATE:
475     cdv = ddv = cauv = dauv = ceuv = deuv = false; csv = dsv = true; break;
476   default: // EMPTY_VIEW (e.g., inactive view not yet defined)
477     cdv = ddv = cauv = dauv = ceuv = deuv = csv = dsv = false;       break;
478   }
479 }
480 
481 
size_all_labels()482 inline void SharedVariablesDataRep::size_all_labels()
483 {
484   size_t num_acv, num_adiv, num_adsv, num_adrv;
485   all_counts(num_acv, num_adiv, num_adsv, num_adrv);
486 
487   allContinuousLabels.resize(boost::extents[num_acv]);    // updated size
488   allDiscreteIntLabels.resize(boost::extents[num_adiv]);  // updated size
489   allDiscreteStringLabels.resize(boost::extents[num_adsv]);
490   allDiscreteRealLabels.resize(boost::extents[num_adrv]); // updated size
491 }
492 
493 
size_all_types()494 inline void SharedVariablesDataRep::size_all_types()
495 {
496   size_t num_acv, num_adiv, num_adsv, num_adrv;
497   all_counts(num_acv, num_adiv, num_adsv, num_adrv);
498 
499   allContinuousTypes.resize(boost::extents[num_acv]);
500   allDiscreteIntTypes.resize(boost::extents[num_adiv]);
501   allDiscreteStringTypes.resize(boost::extents[num_adsv]);
502   allDiscreteRealTypes.resize(boost::extents[num_adrv]);
503 }
504 
505 
initialize_active_start_counts()506 inline void SharedVariablesDataRep::initialize_active_start_counts()
507 {
508   view_start_counts(variablesView.first, cvStart, divStart, dsvStart, drvStart,
509 		    numCV, numDIV, numDSV, numDRV);
510 }
511 
512 
initialize_inactive_start_counts()513 inline void SharedVariablesDataRep::initialize_inactive_start_counts()
514 {
515   view_start_counts(variablesView.second, icvStart, idivStart, idsvStart,
516 		    idrvStart, numICV, numIDIV, numIDSV, numIDRV);
517 }
518 
519 
520 /// Container class encapsulating variables data that can be shared
521 /// among a set of Variables instances.
522 
523 /** An array of Variables objects (e.g., Analyzer::allVariables) contains
524     repeated configuration data (id's, labels, counts).  SharedVariablesData
525     employs a handle-body idiom to allow this shared data to be managed
526     in a single object with many references to it, one per Variables
527     object in the array.  This allows scaling to larger sample sets. */
528 
529 class SharedVariablesData
530 {
531 public:
532 
533   //
534   //- Heading: Friends
535   //
536 
537   /// allow boost access to serialize this class
538   friend class boost::serialization::access;
539 
540 
541   //
542   //- Heading: Constructors, destructor, and operators
543   //
544 
545   /// default constructor
546   SharedVariablesData();
547   /// standard constructor
548   SharedVariablesData(const ProblemDescDB& problem_db,
549 		      const std::pair<short,short>& view);
550   /// medium weight constructor providing detailed variable counts
551   SharedVariablesData(const std::pair<short,short>& view,
552 		      const std::map<unsigned short, size_t>& vars_comps,
553 		      const BitArray& all_relax_di = BitArray(),
554 		      const BitArray& all_relax_dr = BitArray());
555   /// lightweight constructor providing variable count totals
556   SharedVariablesData(const std::pair<short,short>& view,
557 		      const SizetArray& vars_comps_totals,
558 		      const BitArray& all_relax_di = BitArray(),
559 		      const BitArray& all_relax_dr = BitArray());
560   /// copy constructor
561   SharedVariablesData(const SharedVariablesData& svd);
562   /// destructor
563   ~SharedVariablesData();
564 
565   /// assignment operator
566   SharedVariablesData& operator=(const SharedVariablesData& svd);
567 
568   //
569   //- Heading: member functions
570   //
571 
572   /// create a deep copy of the current object and return by value
573   SharedVariablesData copy() const;
574 
575   /// compute all variables sums from
576   /// SharedVariablesDataRep::variablesCompsTotals and
577   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
578   void all_counts(size_t& num_acv, size_t& num_adiv, size_t& num_adsv,
579 		  size_t& num_adrv) const;
580   /// compute design variables sums from
581   /// SharedVariablesDataRep::variablesCompsTotals and
582   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
583   void design_counts(size_t& num_cdv, size_t& num_ddiv, size_t& num_ddsv,
584 		     size_t& num_ddrv) const;
585   /// compute aleatory uncertain variables sums from
586   /// SharedVariablesDataRep::variablesCompsTotals and
587   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
588   void aleatory_uncertain_counts(size_t& num_cauv,  size_t& num_dauiv,
589 				 size_t& num_dausv, size_t& num_daurv) const;
590   /// compute epistemic uncertain variables sums from
591   /// SharedVariablesDataRep::variablesCompsTotals and
592   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
593   void epistemic_uncertain_counts(size_t& num_ceuv,  size_t& num_deuiv,
594 				  size_t& num_deusv, size_t& num_deurv) const;
595   /// compute uncertain variables sums from
596   /// SharedVariablesDataRep::variablesCompsTotals and
597   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
598   void uncertain_counts(size_t& num_cuv,  size_t& num_duiv,
599 			size_t& num_dusv, size_t& num_durv) const;
600   /// compute state variables sums from
601   /// SharedVariablesDataRep::variablesCompsTotals and
602   /// SharedVariablesDataRep::allRelaxedDiscrete{Int,Real}
603   void state_counts(size_t& num_csv,  size_t& num_dsiv,
604 		    size_t& num_dssv, size_t& num_dsrv) const;
605 
606   /// define active variable subsets based on active view
607   void active_subsets(bool& cdv,  bool& ddv,  bool& cauv, bool& dauv,
608 		      bool& ceuv, bool& deuv, bool& csv,  bool& dsv) const;
609   /// define active variable subsets based on active view
610   void inactive_subsets(bool& cdv,  bool& ddv,  bool& cauv, bool& dauv,
611 			bool& ceuv, bool& deuv, bool& csv,  bool& dsv) const;
612   /// define active variable subsets based on active view
613   void complement_subsets(bool& cdv,  bool& ddv,  bool& cauv, bool& dauv,
614 			  bool& ceuv, bool& deuv, bool& csv,  bool& dsv) const;
615 
616   /// convert index within active continuous variables to index within
617   /// aggregated variables (all continous, discrete {int,string,real})
618   size_t cv_index_to_all_index(size_t cv_index) const;
619   /// convert index within inactive continuous variables to index within
620   /// aggregated variables (all continous, discrete {int,string,real})
621   size_t icv_index_to_all_index(size_t ccv_index) const;
622   /// convert index within complement of active continuous variables to index
623   /// within aggregated variables (all continous, discrete {int,string,real})
624   size_t ccv_index_to_all_index(size_t ccv_index) const;
625   /// convert index within all continuous variables to index within
626   /// aggregated variables (all continous, discrete {int,string,real})
627   size_t acv_index_to_all_index(size_t acv_index) const;
628 
629   /// convert index within active discrete integer variables to index within
630   /// aggregated variables (all continous, discrete {int,string,real})
631   size_t div_index_to_all_index(size_t div_index) const;
632   /// convert index within inactive discrete integer variables to index within
633   /// aggregated variables (all continous, discrete {int,string,real})
634   size_t idiv_index_to_all_index(size_t div_index) const;
635   /// convert index within complement of active discrete integer variables
636   /// to index within aggregated variables (all continous, discrete
637   /// {int,string,real})
638   size_t cdiv_index_to_all_index(size_t div_index) const;
639   /// convert index within all discrete integer variables to index within
640   /// aggregated variables (all continous, discrete {int,string,real})
641   size_t adiv_index_to_all_index(size_t adiv_index) const;
642 
643   /// convert index within active discrete string variables to index within
644   /// aggregated variables (all continous, discrete {int,string,real})
645   size_t dsv_index_to_all_index(size_t dsv_index) const;
646   /// convert index within inactive discrete string variables to index within
647   /// aggregated variables (all continous, discrete {int,string,real})
648   size_t idsv_index_to_all_index(size_t dsv_index) const;
649   /// convert index within complement of active discrete string variables
650   /// to index within aggregated variables (all continous, discrete
651   /// {int,string,real})
652   size_t cdsv_index_to_all_index(size_t dsv_index) const;
653   /// convert index within all discrete string variables to index within
654   /// aggregated variables (all continous, discrete {int,string,real})
655   size_t adsv_index_to_all_index(size_t adsv_index) const;
656 
657   /// convert index within active discrete real variables to index within
658   /// aggregated variables (all continous, discrete {int,string,real})
659   size_t drv_index_to_all_index(size_t drv_index) const;
660   /// convert index within inactive discrete real variables to index within
661   /// aggregated variables (all continous, discrete {int,string,real})
662   size_t idrv_index_to_all_index(size_t drv_index) const;
663   /// convert index within complement of active discrete real variables
664   /// to index within aggregated variables (all continous, discrete
665   /// {int,string,real})
666   size_t cdrv_index_to_all_index(size_t drv_index) const;
667   /// convert index within all discrete real variables to index within
668   /// aggregated variables (all continous, discrete {int,string,real})
669   size_t adrv_index_to_all_index(size_t adrv_index) const;
670 
671   /// convert index within active continuous variables to index within
672   /// aggregated active variables (active continous, discrete {int,string,real})
673   size_t cv_index_to_active_index(size_t cv_index) const;
674   /// convert index within active discrete integer variables to index within
675   /// aggregated active variables (active continous, discrete {int,string,real})
676   size_t div_index_to_active_index(size_t div_index) const;
677   /// convert index within active discrete string variables to index within
678   /// aggregated active variables (active continous, discrete {int,string,real})
679   size_t dsv_index_to_active_index(size_t dsv_index) const;
680   /// convert index within active discrete real variables to index within
681   /// aggregated active variables (active continous, discrete {int,string,real})
682   size_t drv_index_to_active_index(size_t drv_index) const;
683 
684   /// convert index within complement of active continuous variables
685   /// to index within all continuous variables
686   size_t ccv_index_to_acv_index(size_t ccv_index) const;
687   /// convert index within complement of active discrete integer variables
688   /// to index within all discrete integer variables
689   size_t cdiv_index_to_adiv_index(size_t div_index) const;
690   /// convert index within complement of active discrete string variables
691   /// to index within all discrete string variables
692   size_t cdsv_index_to_adsv_index(size_t dsv_index) const;
693   /// convert index within complement of active discrete real
694   /// variables to index within all discrete real variables
695   size_t cdrv_index_to_adrv_index(size_t drv_index) const;
696 
697   /// create a BitArray indicating the active continuous subset of all
698   /// {continuous,discrete {int,string,real}} variables
699   BitArray cv_to_all_mask() const;
700   /// create a BitArray indicating the inactive continuous subset of all
701   /// {continuous,discrete {int,string,real}} variables
702   BitArray icv_to_all_mask() const;
703   /// create a BitArray indicating the complement continuous subset of all
704   /// {continuous,discrete {int,string,real}} variables
705   BitArray ccv_to_all_mask() const;
706   /// create a BitArray indicating the all continuous subset of all
707   /// {continuous,discrete {int,string,real}} variables
708   BitArray acv_to_all_mask() const;
709 
710   /// create a BitArray indicating the active discrete int subset of all
711   /// {continuous,discrete {int,string,real}} variables
712   BitArray div_to_all_mask() const;
713   /// create a BitArray indicating the inactive discrete int subset of all
714   /// {continuous,discrete {int,string,real}} variables
715   BitArray idiv_to_all_mask() const;
716   /// create a BitArray indicating the complement discrete int subset of all
717   /// {continuous,discrete {int,string,real}} variables
718   BitArray cdiv_to_all_mask() const;
719   /// create a BitArray indicating the all discrete int subset of all
720   /// {continuous,discrete {int,string,real}} variables
721   BitArray adiv_to_all_mask() const;
722 
723   /// create a BitArray indicating the active discrete string subset of all
724   /// {continuous,discrete {int,string,real}} variables
725   BitArray dsv_to_all_mask() const;
726   /// create a BitArray indicating the inactive discrete string subset of all
727   /// {continuous,discrete {int,string,real}} variables
728   BitArray idsv_to_all_mask() const;
729   /// create a BitArray indicating the complement discrete string subset of all
730   /// {continuous,discrete {int,string,real}} variables
731   BitArray cdsv_to_all_mask() const;
732   /// create a BitArray indicating the all discrete string subset of all
733   /// {continuous,discrete {int,string,real}} variables
734   BitArray adsv_to_all_mask() const;
735 
736   /// create a BitArray indicating the active discrete real subset of all
737   /// {continuous,discrete {int,string,real}} variables
738   BitArray drv_to_all_mask() const;
739   /// create a BitArray indicating the inactive discrete real subset of all
740   /// {continuous,discrete {int,string,real}} variables
741   BitArray idrv_to_all_mask() const;
742   /// create a BitArray indicating the complement discrete real subset of all
743   /// {continuous,discrete {int,string,real}} variables
744   BitArray cdrv_to_all_mask() const;
745   /// create a BitArray indicating the all discrete real subset of all
746   /// {continuous,discrete {int,string,real}} variables
747   BitArray adrv_to_all_mask() const;
748 
749   /// initialize start index and counts for active variables
750   void initialize_active_start_counts();
751   /// initialize start index and counts for inactive variables
752   void initialize_inactive_start_counts();
753 
754   /// initialize the active components totals given active variable counts
755   void initialize_active_components();
756   /// initialize the inactive components totals given inactive variable counts
757   void initialize_inactive_components();
758 
759   /// return allRelaxedDiscreteInt
760   const BitArray& all_relaxed_discrete_int() const;
761   /// return allRelaxedDiscreteReal
762   const BitArray& all_relaxed_discrete_real() const;
763 
764   /// get num_items continuous labels beginning at index start
765   StringMultiArrayView
766     all_continuous_labels(size_t start, size_t num_items) const;
767   /// set num_items continuous labels beginning at index start
768   void all_continuous_labels(StringMultiArrayConstView cv_labels, size_t start,
769 			     size_t num_items);
770   /// set continuous label at index start
771   void all_continuous_label(const String& cv_label, size_t index);
772 
773   /// get num_items discrete integer labels beginning at index start
774   StringMultiArrayView
775     all_discrete_int_labels(size_t start, size_t num_items) const;
776   /// set num_items discrete integer labels beginning at index start
777   void all_discrete_int_labels(StringMultiArrayConstView div_labels,
778 			       size_t start, size_t num_items);
779   /// set discrete integer label at index start
780   void all_discrete_int_label(const String& div_label, size_t index);
781 
782   /// get num_items discrete string labels beginning at index start
783   StringMultiArrayView
784     all_discrete_string_labels(size_t start, size_t num_items) const;
785   /// set num_items discrete string labels beginning at index start
786   void all_discrete_string_labels(StringMultiArrayConstView dsv_labels,
787 				  size_t start, size_t num_items);
788   /// set discrete string label at index start
789   void all_discrete_string_label(const String& dsv_label, size_t index);
790 
791   /// get num_items discrete real labels beginning at index start
792   StringMultiArrayView
793     all_discrete_real_labels(size_t start, size_t num_items) const;
794   /// set num_items discrete real labels beginning at index start
795   void all_discrete_real_labels(StringMultiArrayConstView drv_labels,
796 				size_t start, size_t num_items);
797   /// set discrete real label at index start
798   void all_discrete_real_label(const String& drv_label, size_t index);
799 
800   /// assemble all variable labels (continuous and discrete {int,string,real})
801   /// in standard (input specification-based) order
802   void assemble_all_labels(StringArray& all_labels) const;
803 
804   /// get num_items continuous types beginning at index start
805   UShortMultiArrayConstView
806     all_continuous_types(size_t start, size_t num_items) const;
807   /// set num_items continuous types beginning at index start
808   void all_continuous_types(UShortMultiArrayConstView cv_types,
809 			    size_t start, size_t num_items);
810   /// set continuous type at index
811   void all_continuous_type(unsigned short cv_type, size_t index);
812 
813   /// get num_items discrete integer types beginning at index start
814   UShortMultiArrayConstView
815     all_discrete_int_types(size_t start, size_t num_items) const;
816   /// set num_items discrete integer types beginning at index start
817   void all_discrete_int_types(UShortMultiArrayConstView div_types,
818 			      size_t start, size_t num_items);
819   /// set discrete integer type at index
820   void all_discrete_int_type(unsigned short div_type, size_t index);
821 
822   /// get num_items discrete string types beginning at index start
823   UShortMultiArrayConstView
824     all_discrete_string_types(size_t start, size_t num_items) const;
825   /// set num_items discrete string types beginning at index start
826   void all_discrete_string_types(UShortMultiArrayConstView dsv_types,
827 			       size_t start, size_t num_items);
828   /// set discrete string type at index
829   void all_discrete_string_type(unsigned short dsv_type, size_t index);
830 
831   /// get num_items discrete real types beginning at index start
832   UShortMultiArrayConstView
833     all_discrete_real_types(size_t start, size_t num_items) const;
834   /// set num_items discrete real types beginning at index start
835   void all_discrete_real_types(UShortMultiArrayConstView drv_types,
836 			       size_t start, size_t num_items);
837   /// set discrete real type at index
838   void all_discrete_real_type(unsigned short drv_type, size_t index);
839 
840   /// get num_items continuous ids beginning at index start
841   SizetMultiArrayConstView
842     all_continuous_ids(size_t start, size_t num_items) const;
843   /// set num_items continuous ids beginning at index start
844   void all_continuous_ids(SizetMultiArrayConstView cv_ids,
845 			  size_t start, size_t num_items);
846   /// set num_items continuous ids beginning at index start
847   void all_continuous_id(size_t id, size_t index);
848 
849   /// get num_items discrete int ids beginning at index start
850   SizetMultiArrayConstView
851     all_discrete_int_ids(size_t start, size_t num_items) const;
852   /// get num_items discrete string ids beginning at index start
853   SizetMultiArrayConstView
854     all_discrete_string_ids(size_t start, size_t num_items) const;
855   /// get num_items discrete real ids beginning at index start
856   SizetMultiArrayConstView
857     all_discrete_real_ids(size_t start, size_t num_items) const;
858 
859   // get ids of discrete variables that have been relaxed into
860   // continuous variable arrays
861   //const SizetArray& relaxed_discrete_ids() const;
862 
863   /// return the user-provided or default Variables identifier
864   const String& id() const;
865 
866   /// return variable type counts for
867   /// {continuous,discrete integer,discrete real}
868   /// {design,aleatory uncertain,epistemic uncertain,state}
869   const SizetArray& components_totals() const;
870   /// return active variable type counts for
871   /// {continuous,discrete integer,discrete real}
872   /// {design,aleatory uncertain,epistemic uncertain,state}
873   const SizetArray& active_components_totals() const;
874   /// return inactive variable type counts for
875   /// {continuous,discrete integer,discrete real}
876   /// {design,aleatory uncertain,epistemic uncertain,state}
877   const SizetArray& inactive_components_totals() const;
878 
879   /// retrieve the variables type count within
880   /// svdRep->variablesComponents corresponding to (a fine-grain
881   /// variables type) key
882   size_t vc_lookup(unsigned short key) const;
883 
884   /// retreive the Variables view
885   const std::pair<short,short>& view() const;
886   /// set the inactive Variables view
887   void inactive_view(short view2);
888 
889   size_t cv()         const; ///< get number of active continuous vars
890   size_t cv_start()   const; ///< get start index of active continuous vars
891   size_t div()        const; ///< get number of active discrete int vars
892   size_t div_start()  const; ///< get start index of active discrete int vars
893   size_t dsv()        const; ///< get number of active discrete string vars
894   size_t dsv_start()  const; ///< get start index of active discrete string vars
895   size_t drv()        const; ///< get number of active discrete real vars
896   size_t drv_start()  const; ///< get start index of active discrete real vars
897   size_t icv()        const; ///< get number of inactive continuous vars
898   size_t icv_start()  const; ///< get start index of inactive continuous vars
899   size_t idiv()       const; ///< get number of inactive discrete int vars
900   size_t idiv_start() const; ///< get start index of inactive discrete int vars
901   size_t idsv()       const; ///< get number of inactive discrete string vars
902   size_t idsv_start() const; ///< get start index of inactive discr string vars
903   size_t idrv()       const; ///< get number of inactive discrete real vars
904   size_t idrv_start() const; ///< get start index of inactive discrete real vars
905 
906   void cv(size_t ncv);         ///< set number of active continuous vars
907   void cv_start(size_t cvs);   ///< set start index of active continuous vars
908   void div(size_t ndiv);       ///< set number of active discrete int vars
909   void div_start(size_t divs); ///< set start index of active discrete int vars
910   void dsv(size_t ndsv);       ///< set number of active discrete string vars
911   void dsv_start(size_t dsvs); ///< set start index of active discr string vars
912   void drv(size_t ndrv);       ///< set number of active discrete real vars
913   void drv_start(size_t drvs); ///< set start index of active discrete real vars
914   void icv(size_t nicv);       ///< set number of inactive continuous vars
915   void icv_start(size_t icvs); ///< set start index of inactive continuous vars
916   void idiv(size_t nidiv);     ///< set number of inactive discrete int vars
917   void idiv_start(size_t idivs); ///< set start index of inactive discr int vars
918   void idsv(size_t nidsv);       ///< set number of inactive discr string vars
919   void idsv_start(size_t idsvs); ///< set start index of inact discr string vars
920   void idrv(size_t nidrv);       ///< set number of inactive discrete real vars
921   void idrv_start(size_t idrvs); ///< set start index of inact discr real vars
922 
923 private:
924 
925   /// serialize through the pointer, which requires object tracking:
926   /// write and read are symmetric for this class
927   template<class Archive>
928   void serialize(Archive& ar, const unsigned int version);
929 
930   //
931   //- Heading: Private data members
932   //
933 
934   /// pointer to the body (handle-body idiom)
935   boost::shared_ptr<SharedVariablesDataRep> svdRep;
936 };
937 
938 
SharedVariablesData()939 inline SharedVariablesData::SharedVariablesData()
940 { /* empty ctor */ }
941 
942 
943 inline SharedVariablesData::
SharedVariablesData(const ProblemDescDB & problem_db,const std::pair<short,short> & view)944 SharedVariablesData(const ProblemDescDB& problem_db,
945 		    const std::pair<short,short>& view):
946   svdRep(new SharedVariablesDataRep(problem_db, view))
947 { /* empty ctor */ }
948 
949 
950 inline SharedVariablesData::
SharedVariablesData(const std::pair<short,short> & view,const std::map<unsigned short,size_t> & vars_comps,const BitArray & all_relax_di,const BitArray & all_relax_dr)951 SharedVariablesData(const std::pair<short,short>& view,
952 		    const std::map<unsigned short, size_t>& vars_comps,
953 		    const BitArray& all_relax_di, const BitArray& all_relax_dr):
954   svdRep(new SharedVariablesDataRep(view, vars_comps, all_relax_di,
955 				    all_relax_dr))
956 { /* empty ctor */ }
957 
958 
959 inline SharedVariablesData::
SharedVariablesData(const std::pair<short,short> & view,const SizetArray & vars_comps_totals,const BitArray & all_relax_di,const BitArray & all_relax_dr)960 SharedVariablesData(const std::pair<short,short>& view,
961 		    const SizetArray& vars_comps_totals,
962 		    const BitArray& all_relax_di, const BitArray& all_relax_dr):
963   svdRep(new SharedVariablesDataRep(view, vars_comps_totals, all_relax_di,
964 				    all_relax_dr))
965 { /* empty ctor */ }
966 
967 
SharedVariablesData(const SharedVariablesData & svd)968 inline SharedVariablesData::SharedVariablesData(const SharedVariablesData& svd)
969 {
970   // share the representation (body)
971   svdRep = svd.svdRep;
972 }
973 
974 
975 inline SharedVariablesData& SharedVariablesData::
operator =(const SharedVariablesData & svd)976 operator=(const SharedVariablesData& svd)
977 {
978   // share the inbound representation (body) by copying the pointer
979   svdRep = svd.svdRep;
980   return *this;
981 }
982 
983 
~SharedVariablesData()984 inline SharedVariablesData::~SharedVariablesData()
985 { /* empty dtor in case we add virtual functions */ }
986 
987 
988 inline void SharedVariablesData::
all_counts(size_t & num_acv,size_t & num_adiv,size_t & num_adsv,size_t & num_adrv) const989 all_counts(size_t& num_acv, size_t& num_adiv, size_t& num_adsv,
990 	   size_t& num_adrv) const
991 { svdRep->all_counts(num_acv, num_adiv, num_adsv, num_adrv); }
992 
993 
994 inline void SharedVariablesData::
design_counts(size_t & num_cdv,size_t & num_ddiv,size_t & num_ddsv,size_t & num_ddrv) const995 design_counts(size_t& num_cdv, size_t& num_ddiv, size_t& num_ddsv,
996 	      size_t& num_ddrv) const
997 { svdRep->design_counts(num_cdv, num_ddiv, num_ddsv, num_ddrv); }
998 
999 
1000 inline void SharedVariablesData::
aleatory_uncertain_counts(size_t & num_cauv,size_t & num_dauiv,size_t & num_dausv,size_t & num_daurv) const1001 aleatory_uncertain_counts(size_t& num_cauv,  size_t& num_dauiv,
1002 			  size_t& num_dausv, size_t& num_daurv) const
1003 {
1004   svdRep->aleatory_uncertain_counts(num_cauv, num_dauiv, num_dausv, num_daurv);
1005 }
1006 
1007 
1008 inline void SharedVariablesData::
epistemic_uncertain_counts(size_t & num_ceuv,size_t & num_deuiv,size_t & num_deusv,size_t & num_deurv) const1009 epistemic_uncertain_counts(size_t& num_ceuv,  size_t& num_deuiv,
1010 			   size_t& num_deusv, size_t& num_deurv) const
1011 {
1012   svdRep->epistemic_uncertain_counts(num_ceuv, num_deuiv, num_deusv, num_deurv);
1013 }
1014 
1015 
1016 inline void SharedVariablesData::
uncertain_counts(size_t & num_cuv,size_t & num_duiv,size_t & num_dusv,size_t & num_durv) const1017 uncertain_counts(size_t& num_cuv, size_t& num_duiv, size_t& num_dusv,
1018 		 size_t& num_durv) const
1019 { svdRep->uncertain_counts(num_cuv, num_duiv, num_dusv, num_durv); }
1020 
1021 
1022 inline void SharedVariablesData::
state_counts(size_t & num_csv,size_t & num_dsiv,size_t & num_dssv,size_t & num_dsrv) const1023 state_counts(size_t& num_csv, size_t& num_dsiv, size_t& num_dssv,
1024 	     size_t& num_dsrv) const
1025 { svdRep->state_counts(num_csv, num_dsiv, num_dssv, num_dsrv); }
1026 
1027 
1028 inline void SharedVariablesData::
active_subsets(bool & cdv,bool & ddv,bool & cauv,bool & dauv,bool & ceuv,bool & deuv,bool & csv,bool & dsv) const1029 active_subsets(bool& cdv, bool& ddv, bool& cauv, bool& dauv, bool& ceuv,
1030 	       bool& deuv, bool& csv, bool& dsv) const
1031 {
1032   svdRep->view_subsets(svdRep->variablesView.first,
1033 		       cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1034 }
1035 
1036 
1037 inline void SharedVariablesData::
inactive_subsets(bool & cdv,bool & ddv,bool & cauv,bool & dauv,bool & ceuv,bool & deuv,bool & csv,bool & dsv) const1038 inactive_subsets(bool& cdv, bool& ddv, bool& cauv, bool& dauv, bool& ceuv,
1039 		 bool& deuv, bool& csv, bool& dsv) const
1040 {
1041   svdRep->view_subsets(svdRep->variablesView.second,
1042 		       cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1043 }
1044 
1045 
1046 inline void SharedVariablesData::
complement_subsets(bool & cdv,bool & ddv,bool & cauv,bool & dauv,bool & ceuv,bool & deuv,bool & csv,bool & dsv) const1047 complement_subsets(bool& cdv, bool& ddv, bool& cauv, bool& dauv, bool& ceuv,
1048 		   bool& deuv, bool& csv, bool& dsv) const
1049 {
1050   bool active_cdv,  active_ddv,  active_cauv, active_dauv,
1051        active_ceuv, active_deuv, active_csv,  active_dsv;
1052   svdRep->view_subsets(svdRep->variablesView.first, active_cdv, active_ddv,
1053 		       active_cauv, active_dauv, active_ceuv, active_deuv,
1054 		       active_csv, active_dsv);
1055   cdv  = !active_cdv;  ddv  = !active_ddv;
1056   cauv = !active_cauv; dauv = !active_dauv;
1057   ceuv = !active_ceuv, deuv = !active_deuv;
1058   csv  = !active_csv,  dsv  = !active_dsv;
1059 }
1060 
1061 
cv_index_to_all_index(size_t cv_index) const1062 inline size_t SharedVariablesData::cv_index_to_all_index(size_t cv_index) const
1063 {
1064   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1065   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1066   return svdRep->cv_index_to_all_index(cv_index, cdv, cauv, ceuv, csv);
1067 }
1068 
1069 
1070 inline size_t SharedVariablesData::
icv_index_to_all_index(size_t icv_index) const1071 icv_index_to_all_index(size_t icv_index) const
1072 {
1073   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1074   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1075   return svdRep->cv_index_to_all_index(icv_index, cdv, cauv, ceuv, csv);
1076 }
1077 
1078 
1079 inline size_t SharedVariablesData::
ccv_index_to_all_index(size_t ccv_index) const1080 ccv_index_to_all_index(size_t ccv_index) const
1081 {
1082   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1083   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1084   return svdRep->cv_index_to_all_index(ccv_index, cdv, cauv, ceuv, csv);
1085 }
1086 
1087 
1088 inline size_t SharedVariablesData::
acv_index_to_all_index(size_t acv_index) const1089 acv_index_to_all_index(size_t acv_index) const
1090 { return svdRep->cv_index_to_all_index(acv_index, true, true, true, true); }
1091 
1092 
1093 inline size_t SharedVariablesData::
div_index_to_all_index(size_t div_index) const1094 div_index_to_all_index(size_t div_index) const
1095 {
1096   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1097   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1098   return svdRep->div_index_to_all_index(div_index, ddv, dauv, deuv, dsv);
1099 }
1100 
1101 
1102 inline size_t SharedVariablesData::
idiv_index_to_all_index(size_t idiv_index) const1103 idiv_index_to_all_index(size_t idiv_index) const
1104 {
1105   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1106   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1107   return svdRep->div_index_to_all_index(idiv_index, ddv, dauv, deuv, dsv);
1108 }
1109 
1110 
1111 inline size_t SharedVariablesData::
cdiv_index_to_all_index(size_t cdiv_index) const1112 cdiv_index_to_all_index(size_t cdiv_index) const
1113 {
1114   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1115   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1116   return svdRep->div_index_to_all_index(cdiv_index, ddv, dauv, deuv, dsv);
1117 }
1118 
1119 
1120 inline size_t SharedVariablesData::
adiv_index_to_all_index(size_t adiv_index) const1121 adiv_index_to_all_index(size_t adiv_index) const
1122 { return svdRep->div_index_to_all_index(adiv_index, true, true, true, true); }
1123 
1124 
1125 inline size_t SharedVariablesData::
dsv_index_to_all_index(size_t dsv_index) const1126 dsv_index_to_all_index(size_t dsv_index) const
1127 {
1128   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1129   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1130   return svdRep->dsv_index_to_all_index(dsv_index, ddv, dauv, deuv, dsv);
1131 }
1132 
1133 
1134 inline size_t SharedVariablesData::
idsv_index_to_all_index(size_t idsv_index) const1135 idsv_index_to_all_index(size_t idsv_index) const
1136 {
1137   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1138   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1139   return svdRep->dsv_index_to_all_index(idsv_index, ddv, dauv, deuv, dsv);
1140 }
1141 
1142 
1143 inline size_t SharedVariablesData::
cdsv_index_to_all_index(size_t cdsv_index) const1144 cdsv_index_to_all_index(size_t cdsv_index) const
1145 {
1146   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1147   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1148   return svdRep->dsv_index_to_all_index(cdsv_index, ddv, dauv, deuv, dsv);
1149 }
1150 
1151 
1152 inline size_t SharedVariablesData::
adsv_index_to_all_index(size_t adsv_index) const1153 adsv_index_to_all_index(size_t adsv_index) const
1154 { return svdRep->dsv_index_to_all_index(adsv_index, true, true, true, true); }
1155 
1156 
1157 inline size_t SharedVariablesData::
drv_index_to_all_index(size_t drv_index) const1158 drv_index_to_all_index(size_t drv_index) const
1159 {
1160   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1161   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1162   return svdRep->drv_index_to_all_index(drv_index, ddv, dauv, deuv, dsv);
1163 }
1164 
1165 
1166 inline size_t SharedVariablesData::
idrv_index_to_all_index(size_t idrv_index) const1167 idrv_index_to_all_index(size_t idrv_index) const
1168 {
1169   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1170   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1171   return svdRep->drv_index_to_all_index(idrv_index, ddv, dauv, deuv, dsv);
1172 }
1173 
1174 
1175 inline size_t SharedVariablesData::
cdrv_index_to_all_index(size_t cdrv_index) const1176 cdrv_index_to_all_index(size_t cdrv_index) const
1177 {
1178   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1179   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1180   return svdRep->drv_index_to_all_index(cdrv_index, ddv, dauv, deuv, dsv);
1181 }
1182 
1183 
1184 inline size_t SharedVariablesData::
adrv_index_to_all_index(size_t adrv_index) const1185 adrv_index_to_all_index(size_t adrv_index) const
1186 { return svdRep->drv_index_to_all_index(adrv_index, true, true, true, true); }
1187 
1188 
cv_to_all_mask() const1189 inline BitArray SharedVariablesData::cv_to_all_mask() const
1190 {
1191   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1192   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1193   return svdRep->cv_to_all_mask(cdv, cauv, ceuv, csv);
1194 }
1195 
1196 
icv_to_all_mask() const1197 inline BitArray SharedVariablesData::icv_to_all_mask() const
1198 {
1199   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1200   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1201   return svdRep->cv_to_all_mask(cdv, cauv, ceuv, csv);
1202 }
1203 
1204 
ccv_to_all_mask() const1205 inline BitArray SharedVariablesData::ccv_to_all_mask() const
1206 {
1207   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1208   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1209   return svdRep->cv_to_all_mask(cdv, cauv, ceuv, csv);
1210 }
1211 
1212 
acv_to_all_mask() const1213 inline BitArray SharedVariablesData::acv_to_all_mask() const
1214 { return svdRep->cv_to_all_mask(true, true, true, true); }
1215 
1216 
div_to_all_mask() const1217 inline BitArray SharedVariablesData::div_to_all_mask() const
1218 {
1219   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1220   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1221   return svdRep->div_to_all_mask(ddv, dauv, deuv, dsv);
1222 }
1223 
1224 
idiv_to_all_mask() const1225 inline BitArray SharedVariablesData::idiv_to_all_mask() const
1226 {
1227   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1228   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1229   return svdRep->div_to_all_mask(ddv, dauv, deuv, dsv);
1230 }
1231 
1232 
cdiv_to_all_mask() const1233 inline BitArray SharedVariablesData::cdiv_to_all_mask() const
1234 {
1235   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1236   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1237   return svdRep->div_to_all_mask(ddv, dauv, deuv, dsv);
1238 }
1239 
1240 
adiv_to_all_mask() const1241 inline BitArray SharedVariablesData::adiv_to_all_mask() const
1242 { return svdRep->div_to_all_mask(true, true, true, true); }
1243 
1244 
dsv_to_all_mask() const1245 inline BitArray SharedVariablesData::dsv_to_all_mask() const
1246 {
1247   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1248   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1249   return svdRep->dsv_to_all_mask(ddv, dauv, deuv, dsv);
1250 }
1251 
1252 
idsv_to_all_mask() const1253 inline BitArray SharedVariablesData::idsv_to_all_mask() const
1254 {
1255   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1256   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1257   return svdRep->dsv_to_all_mask(ddv, dauv, deuv, dsv);
1258 }
1259 
1260 
cdsv_to_all_mask() const1261 inline BitArray SharedVariablesData::cdsv_to_all_mask() const
1262 {
1263   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1264   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1265   return svdRep->dsv_to_all_mask(ddv, dauv, deuv, dsv);
1266 }
1267 
1268 
adsv_to_all_mask() const1269 inline BitArray SharedVariablesData::adsv_to_all_mask() const
1270 { return svdRep->dsv_to_all_mask(true, true, true, true); }
1271 
1272 
drv_to_all_mask() const1273 inline BitArray SharedVariablesData::drv_to_all_mask() const
1274 {
1275   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1276   active_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1277   return svdRep->drv_to_all_mask(ddv, dauv, deuv, dsv);
1278 }
1279 
1280 
idrv_to_all_mask() const1281 inline BitArray SharedVariablesData::idrv_to_all_mask() const
1282 {
1283   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1284   inactive_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1285   return svdRep->drv_to_all_mask(ddv, dauv, deuv, dsv);
1286 }
1287 
1288 
cdrv_to_all_mask() const1289 inline BitArray SharedVariablesData::cdrv_to_all_mask() const
1290 {
1291   bool cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv;
1292   complement_subsets(cdv, ddv, cauv, dauv, ceuv, deuv, csv, dsv);
1293   return svdRep->drv_to_all_mask(ddv, dauv, deuv, dsv);
1294 }
1295 
1296 
adrv_to_all_mask() const1297 inline BitArray SharedVariablesData::adrv_to_all_mask() const
1298 { return svdRep->drv_to_all_mask(true, true, true, true); }
1299 
1300 
initialize_active_start_counts()1301 inline void SharedVariablesData::initialize_active_start_counts()
1302 { svdRep->initialize_active_start_counts(); }
1303 
1304 
initialize_inactive_start_counts()1305 inline void SharedVariablesData::initialize_inactive_start_counts()
1306 { svdRep->initialize_inactive_start_counts(); }
1307 
1308 
initialize_active_components()1309 inline void SharedVariablesData::initialize_active_components()
1310 { svdRep->initialize_active_components(); }
1311 
1312 
initialize_inactive_components()1313 inline void SharedVariablesData::initialize_inactive_components()
1314 { svdRep->initialize_inactive_components(); }
1315 
1316 
all_relaxed_discrete_int() const1317 inline const BitArray& SharedVariablesData::all_relaxed_discrete_int() const
1318 { return svdRep->allRelaxedDiscreteInt; }
1319 
1320 
all_relaxed_discrete_real() const1321 inline const BitArray& SharedVariablesData::all_relaxed_discrete_real() const
1322 { return svdRep->allRelaxedDiscreteReal; }
1323 
1324 
1325 inline StringMultiArrayView SharedVariablesData::
all_continuous_labels(size_t start,size_t num_items) const1326 all_continuous_labels(size_t start, size_t num_items) const
1327 {
1328   return svdRep->
1329     allContinuousLabels[boost::indices[idx_range(start, start+num_items)]];
1330 }
1331 
1332 
1333 inline void SharedVariablesData::
all_continuous_labels(StringMultiArrayConstView cv_labels,size_t start,size_t num_items)1334 all_continuous_labels(StringMultiArrayConstView cv_labels, size_t start,
1335 		      size_t num_items)
1336 {
1337   svdRep->allContinuousLabels[boost::indices[idx_range(start, start+num_items)]]
1338     = cv_labels;
1339 }
1340 
1341 
1342 inline void SharedVariablesData::
all_continuous_label(const String & cv_label,size_t index)1343 all_continuous_label(const String& cv_label, size_t index)
1344 { svdRep->allContinuousLabels[index] = cv_label; }
1345 
1346 
1347 inline StringMultiArrayView SharedVariablesData::
all_discrete_int_labels(size_t start,size_t num_items) const1348 all_discrete_int_labels(size_t start, size_t num_items) const
1349 {
1350   return svdRep->
1351     allDiscreteIntLabels[boost::indices[idx_range(start, start+num_items)]];
1352 }
1353 
1354 
1355 inline void SharedVariablesData::
all_discrete_int_labels(StringMultiArrayConstView div_labels,size_t start,size_t num_items)1356 all_discrete_int_labels(StringMultiArrayConstView div_labels, size_t start,
1357 		      size_t num_items)
1358 {
1359   svdRep->
1360     allDiscreteIntLabels[boost::indices[idx_range(start, start+num_items)]]
1361     = div_labels;
1362 }
1363 
1364 
1365 inline void SharedVariablesData::
all_discrete_int_label(const String & div_label,size_t index)1366 all_discrete_int_label(const String& div_label, size_t index)
1367 { svdRep->allDiscreteIntLabels[index] = div_label; }
1368 
1369 
1370 inline StringMultiArrayView SharedVariablesData::
all_discrete_string_labels(size_t start,size_t num_items) const1371 all_discrete_string_labels(size_t start, size_t num_items) const
1372 {
1373   return svdRep->
1374     allDiscreteStringLabels[boost::indices[idx_range(start, start+num_items)]];
1375 }
1376 
1377 
1378 inline void SharedVariablesData::
all_discrete_string_labels(StringMultiArrayConstView dsv_labels,size_t start,size_t num_items)1379 all_discrete_string_labels(StringMultiArrayConstView dsv_labels, size_t start,
1380 			   size_t num_items)
1381 {
1382   svdRep->
1383     allDiscreteStringLabels[boost::indices[idx_range(start, start+num_items)]]
1384     = dsv_labels;
1385 }
1386 
1387 
1388 inline void SharedVariablesData::
all_discrete_string_label(const String & dsv_label,size_t index)1389 all_discrete_string_label(const String& dsv_label, size_t index)
1390 { svdRep->allDiscreteStringLabels[index] = dsv_label; }
1391 
1392 
1393 inline StringMultiArrayView SharedVariablesData::
all_discrete_real_labels(size_t start,size_t num_items) const1394 all_discrete_real_labels(size_t start, size_t num_items) const
1395 {
1396   return svdRep->
1397     allDiscreteRealLabels[boost::indices[idx_range(start, start+num_items)]];
1398 }
1399 
1400 
1401 inline void SharedVariablesData::
all_discrete_real_labels(StringMultiArrayConstView drv_labels,size_t start,size_t num_items)1402 all_discrete_real_labels(StringMultiArrayConstView drv_labels, size_t start,
1403 			 size_t num_items)
1404 {
1405   svdRep->
1406     allDiscreteRealLabels[boost::indices[idx_range(start, start+num_items)]]
1407     = drv_labels;
1408 }
1409 
1410 
1411 inline void SharedVariablesData::
all_discrete_real_label(const String & drv_label,size_t index)1412 all_discrete_real_label(const String& drv_label, size_t index)
1413 { svdRep->allDiscreteRealLabels[index] = drv_label; }
1414 
1415 
1416 inline UShortMultiArrayConstView SharedVariablesData::
all_continuous_types(size_t start,size_t num_items) const1417 all_continuous_types(size_t start, size_t num_items) const
1418 {
1419   return svdRep->
1420     allContinuousTypes[boost::indices[idx_range(start, start+num_items)]];
1421 }
1422 
1423 
1424 inline void SharedVariablesData::
all_continuous_types(UShortMultiArrayConstView cv_types,size_t start,size_t num_items)1425 all_continuous_types(UShortMultiArrayConstView cv_types,
1426 		     size_t start, size_t num_items)
1427 {
1428   svdRep->allContinuousTypes[boost::indices[idx_range(start, start+num_items)]]
1429     = cv_types;
1430 }
1431 
1432 
1433 inline void SharedVariablesData::
all_continuous_type(unsigned short cv_type,size_t index)1434 all_continuous_type(unsigned short cv_type, size_t index)
1435 { svdRep->allContinuousTypes[index] = cv_type; }
1436 
1437 
1438 inline UShortMultiArrayConstView SharedVariablesData::
all_discrete_int_types(size_t start,size_t num_items) const1439 all_discrete_int_types(size_t start, size_t num_items) const
1440 {
1441   return svdRep->
1442     allDiscreteIntTypes[boost::indices[idx_range(start, start+num_items)]];
1443 }
1444 
1445 
1446 inline void SharedVariablesData::
all_discrete_int_types(UShortMultiArrayConstView div_types,size_t start,size_t num_items)1447 all_discrete_int_types(UShortMultiArrayConstView div_types,
1448 		       size_t start, size_t num_items)
1449 {
1450   svdRep->allDiscreteIntTypes[boost::indices[idx_range(start, start+num_items)]]
1451     = div_types;
1452 }
1453 
1454 
1455 inline void SharedVariablesData::
all_discrete_int_type(unsigned short div_type,size_t index)1456 all_discrete_int_type(unsigned short div_type, size_t index)
1457 { svdRep->allDiscreteIntTypes[index] = div_type; }
1458 
1459 
1460 inline UShortMultiArrayConstView SharedVariablesData::
all_discrete_string_types(size_t start,size_t num_items) const1461 all_discrete_string_types(size_t start, size_t num_items) const
1462 {
1463   return svdRep->
1464     allDiscreteStringTypes[boost::indices[idx_range(start, start+num_items)]];
1465 }
1466 
1467 
1468 inline void SharedVariablesData::
all_discrete_string_types(UShortMultiArrayConstView dsv_types,size_t start,size_t num_items)1469 all_discrete_string_types(UShortMultiArrayConstView dsv_types,
1470 			  size_t start, size_t num_items)
1471 {
1472   svdRep->
1473     allDiscreteStringTypes[boost::indices[idx_range(start, start+num_items)]]
1474     = dsv_types;
1475 }
1476 
1477 
1478 inline void SharedVariablesData::
all_discrete_string_type(unsigned short dsv_type,size_t index)1479 all_discrete_string_type(unsigned short dsv_type, size_t index)
1480 { svdRep->allDiscreteStringTypes[index] = dsv_type; }
1481 
1482 
1483 inline UShortMultiArrayConstView SharedVariablesData::
all_discrete_real_types(size_t start,size_t num_items) const1484 all_discrete_real_types(size_t start, size_t num_items) const
1485 {
1486   return svdRep->
1487     allDiscreteRealTypes[boost::indices[idx_range(start, start+num_items)]];
1488 }
1489 
1490 
1491 inline void SharedVariablesData::
all_discrete_real_types(UShortMultiArrayConstView drv_types,size_t start,size_t num_items)1492 all_discrete_real_types(UShortMultiArrayConstView drv_types,
1493 			size_t start, size_t num_items)
1494 {
1495   svdRep->
1496     allDiscreteRealTypes[boost::indices[idx_range(start, start+num_items)]]
1497     = drv_types;
1498 }
1499 
1500 
1501 inline void SharedVariablesData::
all_discrete_real_type(unsigned short drv_type,size_t index)1502 all_discrete_real_type(unsigned short drv_type, size_t index)
1503 { svdRep->allDiscreteRealTypes[index] = drv_type; }
1504 
1505 
1506 inline SizetMultiArrayConstView SharedVariablesData::
all_continuous_ids(size_t start,size_t num_items) const1507 all_continuous_ids(size_t start, size_t num_items) const
1508 {
1509   return svdRep->
1510     allContinuousIds[boost::indices[idx_range(start, start+num_items)]];
1511 }
1512 
1513 inline SizetMultiArrayConstView SharedVariablesData::
all_discrete_int_ids(size_t start,size_t num_items) const1514 all_discrete_int_ids(size_t start, size_t num_items) const
1515 {
1516   return svdRep->
1517     allDiscreteIntIds[boost::indices[idx_range(start, start+num_items)]];
1518 }
1519 
1520 inline SizetMultiArrayConstView SharedVariablesData::
all_discrete_string_ids(size_t start,size_t num_items) const1521 all_discrete_string_ids(size_t start, size_t num_items) const
1522 {
1523   return svdRep->
1524     allDiscreteStringIds[boost::indices[idx_range(start, start+num_items)]];
1525 }
1526 
1527 inline SizetMultiArrayConstView SharedVariablesData::
all_discrete_real_ids(size_t start,size_t num_items) const1528 all_discrete_real_ids(size_t start, size_t num_items) const
1529 {
1530   return svdRep->
1531     allDiscreteRealIds[boost::indices[idx_range(start, start+num_items)]];
1532 }
1533 
1534 
1535 inline void SharedVariablesData::
all_continuous_ids(SizetMultiArrayConstView cv_ids,size_t start,size_t num_items)1536 all_continuous_ids(SizetMultiArrayConstView cv_ids,
1537 		   size_t start, size_t num_items)
1538 {
1539   svdRep->allContinuousIds[boost::indices[idx_range(start, start+num_items)]]
1540     = cv_ids;
1541 }
1542 
1543 
all_continuous_id(size_t cv_id,size_t index)1544 inline void SharedVariablesData::all_continuous_id(size_t cv_id, size_t index)
1545 { svdRep->allContinuousIds[index] = cv_id; }
1546 
1547 
id() const1548 inline const String& SharedVariablesData::id() const
1549 { return svdRep->variablesId; }
1550 
1551 
components_totals() const1552 inline const SizetArray& SharedVariablesData::components_totals() const
1553 { return svdRep->variablesCompsTotals; }
1554 
1555 
active_components_totals() const1556 inline const SizetArray& SharedVariablesData::active_components_totals() const
1557 { return svdRep->activeVarsCompsTotals; }
1558 
1559 
inactive_components_totals() const1560 inline const SizetArray& SharedVariablesData::inactive_components_totals() const
1561 { return svdRep->inactiveVarsCompsTotals; }
1562 
1563 
vc_lookup(unsigned short key) const1564 inline size_t SharedVariablesData::vc_lookup(unsigned short key) const
1565 { return svdRep->vc_lookup(key); }
1566 
1567 
view() const1568 inline const std::pair<short,short>& SharedVariablesData::view() const
1569 { return svdRep->variablesView; }
1570 
1571 
inactive_view(short view2)1572 inline void SharedVariablesData::inactive_view(short view2)
1573 { svdRep->variablesView.second = view2; }
1574 
1575 
cv() const1576 inline size_t SharedVariablesData::cv() const
1577 { return svdRep->numCV; }
1578 
1579 
cv_start() const1580 inline size_t SharedVariablesData::cv_start() const
1581 { return svdRep->cvStart; }
1582 
1583 
div() const1584 inline size_t SharedVariablesData::div() const
1585 { return svdRep->numDIV; }
1586 
1587 
div_start() const1588 inline size_t SharedVariablesData::div_start() const
1589 { return svdRep->divStart; }
1590 
1591 
dsv() const1592 inline size_t SharedVariablesData::dsv() const
1593 { return svdRep->numDSV; }
1594 
1595 
dsv_start() const1596 inline size_t SharedVariablesData::dsv_start() const
1597 { return svdRep->dsvStart; }
1598 
1599 
drv() const1600 inline size_t SharedVariablesData::drv() const
1601 { return svdRep->numDRV; }
1602 
1603 
drv_start() const1604 inline size_t SharedVariablesData::drv_start() const
1605 { return svdRep->drvStart; }
1606 
1607 
icv() const1608 inline size_t SharedVariablesData::icv() const
1609 { return svdRep->numICV; }
1610 
1611 
icv_start() const1612 inline size_t SharedVariablesData::icv_start() const
1613 { return svdRep->icvStart; }
1614 
1615 
idiv() const1616 inline size_t SharedVariablesData::idiv() const
1617 { return svdRep->numIDIV; }
1618 
1619 
idiv_start() const1620 inline size_t SharedVariablesData::idiv_start() const
1621 { return svdRep->idivStart; }
1622 
1623 
idsv() const1624 inline size_t SharedVariablesData::idsv() const
1625 { return svdRep->numIDSV; }
1626 
1627 
idsv_start() const1628 inline size_t SharedVariablesData::idsv_start() const
1629 { return svdRep->idsvStart; }
1630 
1631 
idrv() const1632 inline size_t SharedVariablesData::idrv() const
1633 { return svdRep->numIDRV; }
1634 
1635 
idrv_start() const1636 inline size_t SharedVariablesData::idrv_start() const
1637 { return svdRep->idrvStart; }
1638 
1639 
cv(size_t ncv)1640 inline void SharedVariablesData::cv(size_t ncv)
1641 { svdRep->numCV = ncv; }
1642 
1643 
cv_start(size_t cvs)1644 inline void SharedVariablesData::cv_start(size_t cvs)
1645 { svdRep->cvStart = cvs; }
1646 
1647 
div(size_t ndiv)1648 inline void SharedVariablesData::div(size_t ndiv)
1649 { svdRep->numDIV = ndiv; }
1650 
1651 
div_start(size_t divs)1652 inline void SharedVariablesData::div_start(size_t divs)
1653 { svdRep->divStart = divs; }
1654 
1655 
dsv(size_t ndsv)1656 inline void SharedVariablesData::dsv(size_t ndsv)
1657 { svdRep->numDSV = ndsv; }
1658 
1659 
dsv_start(size_t dsvs)1660 inline void SharedVariablesData::dsv_start(size_t dsvs)
1661 { svdRep->dsvStart = dsvs; }
1662 
1663 
drv(size_t ndrv)1664 inline void SharedVariablesData::drv(size_t ndrv)
1665 { svdRep->numDRV = ndrv; }
1666 
1667 
drv_start(size_t drvs)1668 inline void SharedVariablesData::drv_start(size_t drvs)
1669 { svdRep->drvStart = drvs; }
1670 
1671 
icv(size_t nicv)1672 inline void SharedVariablesData::icv(size_t nicv)
1673 { svdRep->numICV = nicv; }
1674 
1675 
icv_start(size_t icvs)1676 inline void SharedVariablesData::icv_start(size_t icvs)
1677 { svdRep->icvStart = icvs; }
1678 
1679 
idiv(size_t nidiv)1680 inline void SharedVariablesData::idiv(size_t nidiv)
1681 { svdRep->numIDIV = nidiv; }
1682 
1683 
idiv_start(size_t idivs)1684 inline void SharedVariablesData::idiv_start(size_t idivs)
1685 { svdRep->idivStart = idivs; }
1686 
1687 
idsv(size_t nidsv)1688 inline void SharedVariablesData::idsv(size_t nidsv)
1689 { svdRep->numIDSV = nidsv; }
1690 
1691 
idsv_start(size_t idsvs)1692 inline void SharedVariablesData::idsv_start(size_t idsvs)
1693 { svdRep->idsvStart = idsvs; }
1694 
1695 
idrv(size_t nidrv)1696 inline void SharedVariablesData::idrv(size_t nidrv)
1697 { svdRep->numIDRV = nidrv; }
1698 
1699 
idrv_start(size_t idrvs)1700 inline void SharedVariablesData::idrv_start(size_t idrvs)
1701 { svdRep->idrvStart = idrvs; }
1702 
1703 } // namespace Dakota
1704 
1705 
1706 // Since we may serialize this class through a temporary, force
1707 // serialization mode and no tracking.  We allow tracking on
1708 // SharedVariablesDataRep as we want to serialize each unique pointer
1709 // exactly once (may need to revisit this).
1710 BOOST_CLASS_IMPLEMENTATION(Dakota::SharedVariablesData,
1711  			   boost::serialization::object_serializable)
1712 BOOST_CLASS_TRACKING(Dakota::SharedVariablesData,
1713   		     boost::serialization::track_never)
1714 
1715 #endif
1716