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 DAKOTA_DATA_TYPES_H
10 #define DAKOTA_DATA_TYPES_H
11 
12 #include "dakota_system_defs.hpp"
13 #include "Teuchos_config.h"
14 #include "Teuchos_SerialDenseVector.hpp"
15 #include <boost/multi_array.hpp>
16 #include <boost/dynamic_bitset.hpp>
17 #include <deque>
18 #include <list>
19 #include <map>
20 #include <set>
21 
22 namespace Dakota {
23 
24 // avoid problems with circular dependencies by using fwd declarations
25 class Iterator;
26 class Model;
27 class Variables;
28 class Interface;
29 class Response;
30 class ActiveSet;
31 class ParamResponsePair;
32 class ParallelLevel;
33 class ParallelConfiguration;
34 class DiscrepancyCorrection;
35 
36 
37 // Suppress Doxygen warnings for these known undocumented typedefs
38 /// \cond
39 
40 // -----------------------------------
41 // Aliases for fundamental data types:
42 // -----------------------------------
43 typedef double Real;
44 typedef std::string String;
45 
46 // -----------------------------------
47 // Numerical arrays (serial/parallel):
48 // -----------------------------------
49 
50 typedef Teuchos::SerialDenseVector<int, Real>    RealVector;
51 typedef Teuchos::SerialDenseMatrix<int, Real>    RealMatrix;
52 typedef Teuchos::SerialSymDenseMatrix<int, Real> RealSymMatrix;
53 typedef Teuchos::SerialDenseVector<int, int>     IntVector;
54 typedef Teuchos::SerialDenseMatrix<int, int>     IntMatrix;
55 typedef Teuchos::SerialDenseVector<int, size_t>  SizetVector;
56 
57 //typedef Tpetra::CrsMatrix<int, Real>             RealSparseMatrix
58 //typedef Tpetra::Vector<int, Real>                RealParallelVector
59 //typedef Tpetra::MultiVector<int, Real>           RealParallelMatrix
60 
61 // ---------------------------------------
62 // Admin/bookkeeping arrays (serial only):
63 // ---------------------------------------
64 typedef std::deque<bool> BoolDeque; // See Meyers' Effective STL #18
65 typedef boost::dynamic_bitset<unsigned long> BitArray;
66 
67 typedef std::vector<BoolDeque>      BoolDequeArray;
68 typedef std::vector<Real>           RealArray;
69 typedef std::vector<RealArray>      Real2DArray;
70 typedef std::vector<int>            IntArray;
71 typedef std::vector<IntArray>       Int2DArray;
72 typedef std::vector<short>          ShortArray;
73 typedef std::vector<unsigned int>   UIntArray;
74 typedef std::vector<unsigned short> UShortArray;
75 typedef std::vector<UShortArray>    UShort2DArray;
76 typedef std::vector<UShort2DArray>  UShort3DArray;
77 typedef std::vector<size_t>         SizetArray;
78 typedef std::vector<SizetArray>     Sizet2DArray;
79 typedef std::vector<Sizet2DArray>   Sizet3DArray;
80 typedef std::vector<String>         StringArray;
81 typedef std::vector<StringArray>    String2DArray;
82 
83 typedef boost::multi_array_types::index_range       idx_range;
84 typedef boost::multi_array<String, 1>               StringMultiArray;
85 typedef boost::multi_array<String, 2>               StringMulti2DArray;
86 typedef StringMultiArray::array_view<1>::type       StringMultiArrayView;
87 typedef StringMultiArray::const_array_view<1>::type StringMultiArrayConstView;
88 typedef boost::multi_array<unsigned short, 1>       UShortMultiArray;
89 typedef UShortMultiArray::array_view<1>::type       UShortMultiArrayView;
90 typedef UShortMultiArray::const_array_view<1>::type UShortMultiArrayConstView;
91 typedef boost::multi_array<size_t, 1>               SizetMultiArray;
92 typedef SizetMultiArray::array_view<1>::type        SizetMultiArrayView;
93 typedef SizetMultiArray::const_array_view<1>::type  SizetMultiArrayConstView;
94 typedef boost::multi_array<Real, 1>                 RealMultiArray;
95 typedef boost::multi_array<Real, 2>                 RealMulti2DArray;
96 typedef boost::multi_array<Real, 3>                 RealMulti3DArray;
97 
98 typedef std::vector<RealVector>        RealVectorArray;
99 typedef std::vector<RealVectorArray>   RealVector2DArray;
100 typedef std::vector<RealMatrix>        RealMatrixArray;
101 typedef std::vector<RealSymMatrix>     RealSymMatrixArray;
102 typedef std::vector<IntVector>         IntVectorArray;
103 typedef std::vector<Variables>         VariablesArray;
104 typedef std::vector<Response>          ResponseArray;
105 typedef std::vector<ParamResponsePair> PRPArray;
106 typedef std::vector<PRPArray>          PRP2DArray;
107 typedef std::vector<Model>             ModelArray;
108 typedef std::vector<Iterator>          IteratorArray;
109 typedef std::vector<RealMultiArray>    BoostMAArray;
110 typedef std::vector<RealMulti2DArray>  BoostMA2DArray;
111 typedef std::vector<RealMulti3DArray>  BoostMA3DArray;
112 
113 typedef std::list<bool>                BoolList;
114 typedef std::list<int>                 IntList;
115 typedef std::list<size_t>              SizetList;
116 typedef std::list<Real>                RealList;
117 typedef std::list<RealVector>          RealVectorList;
118 typedef std::list<String>              StringList;
119 typedef std::list<Variables>           VariablesList;
120 typedef std::list<Interface>           InterfaceList;
121 typedef std::list<Response>            ResponseList;
122 typedef std::list<ParamResponsePair>   PRPList;
123 typedef std::list<Model>               ModelList;
124 typedef std::list<Iterator>            IteratorList;
125 //typedef std::list<ParallelLevel>         ParLevList;
126 //typedef std::list<ParallelConfiguration> ParConfigList;
127 
128 typedef std::pair<int, int>            IntIntPair;
129 typedef std::pair<size_t, int>         SizetIntPair;
130 typedef std::pair<int, size_t>         IntSizetPair;
131 typedef std::pair<int, String>         IntStringPair;
132 typedef std::pair<Real, Real>          RealRealPair;
133 typedef std::pair<String, String>      StringStringPair;
134 typedef std::pair<int, Response>       IntResponsePair;
135 typedef std::set<Real>                 RealSet;
136 typedef std::set<int>                  IntSet;
137 typedef std::set<String>               StringSet;
138 typedef std::set<unsigned short>       UShortSet;
139 typedef std::set<size_t>               SizetSet;
140 typedef std::set<RealRealPair>         RealRealPairSet;
141 typedef std::vector<RealSet>           RealSetArray;
142 typedef std::vector<IntSet>            IntSetArray;
143 typedef std::vector<StringSet>         StringSetArray;
144 typedef std::vector<UShortSet>         UShortSetArray;
145 typedef std::map<int, int>             IntIntMap;
146 typedef std::map<int, short>           IntShortMap;
147 typedef std::map<unsigned long, unsigned long> ULongULongMap;
148 typedef std::map<int, Real>            IntRealMap;
149 typedef std::map<Real, Real>           RealRealMap;
150 typedef std::map<String, Real>         StringRealMap;
151 typedef std::multimap<Real, int>       RealIntMultiMap;
152 typedef std::vector<RealRealPair>      RealRealPairArray;
153 typedef std::vector<IntRealMap>        IntRealMapArray;
154 typedef std::vector<RealRealMap>       RealRealMapArray;
155 typedef std::vector<StringRealMap>     StringRealMapArray;
156 typedef std::map<int, RealVector>      IntRealVectorMap;
157 typedef std::map<int, RealMatrix>      IntRealMatrixMap;
158 typedef std::map<int, ActiveSet>       IntActiveSetMap;
159 typedef std::map<int, Variables>       IntVariablesMap;
160 typedef std::map<int, Response>        IntResponseMap;
161 typedef std::map<IntArray, size_t>     IntArraySizetMap;
162 typedef std::map<IntIntPair, Real>     IntIntPairRealMap;
163 typedef std::map<IntIntPair, RealMatrix> IntIntPairRealMatrixMap;
164 typedef std::map<RealRealPair, Real>     RealRealPairRealMap;
165 typedef std::map<StringStringPair, int>  StringStringPairIntMap;
166 typedef std::vector<IntIntPairRealMap>   IntIntPairRealMapArray;
167 typedef std::vector<RealRealPairRealMap> RealRealPairRealMapArray;
168 typedef std::multimap<RealRealPair, ParamResponsePair> RealPairPRPMultiMap;
169 //typedef std::multimap<Real, ParamResponsePair> RealPRPMultiMap;
170 
171 // ---------
172 // Iterators
173 // ---------
174 typedef IntList::iterator                          ILIter;
175 typedef IntList::const_iterator                    ILCIter;
176 typedef SizetList::iterator                        StLIter;
177 typedef SizetList::const_iterator                  StLCIter;
178 typedef RealList::iterator                         RLIter;
179 typedef RealList::const_iterator                   RLCIter;
180 typedef RealVectorList::iterator                   RVLIter;
181 typedef RealVectorList::const_iterator             RVLCIter;
182 typedef StringList::iterator                       StringLIter;
183 typedef StringList::const_iterator                 StringLCIter;
184 typedef VariablesList::iterator                    VarsLIter;
185 typedef InterfaceList::iterator                    InterfLIter;
186 typedef ResponseList::iterator                     RespLIter;
187 typedef PRPList::iterator                          PRPLIter;
188 typedef ModelList::iterator                        ModelLIter;
189 typedef ModelList::reverse_iterator                ModelLRevIter;
190 typedef IteratorList::iterator                     IterLIter;
191 typedef std::list<ParallelLevel>::iterator         ParLevLIter;
192 typedef std::list<ParallelConfiguration>::iterator ParConfigLIter;
193 
194 typedef IntSet::iterator                       ISIter;
195 typedef IntSet::const_iterator                 ISCIter;
196 typedef StringSet::iterator                    SSIter;
197 typedef StringSet::const_iterator              SSCIter;
198 typedef RealSet::iterator                      RSIter;
199 typedef RealSet::const_iterator                RSCIter;
200 typedef IntIntMap::iterator                    IntIntMIter;
201 typedef IntIntMap::const_iterator              IntIntMCIter;
202 typedef IntShortMap::iterator                  IntShMIter;
203 typedef IntShortMap::const_iterator            IntShMCIter;
204 typedef IntRealMap::iterator                   IRMIter;
205 typedef IntRealMap::const_iterator             IRMCIter;
206 typedef StringRealMap::iterator                SRMIter;
207 typedef StringRealMap::const_iterator          SRMCIter;
208 typedef RealRealMap::iterator                  RRMIter;
209 typedef RealRealMap::const_iterator            RRMCIter;
210 typedef IntIntPairRealMap::iterator            IIPRMIter;
211 typedef IntIntPairRealMap::const_iterator      IIPRMCIter;
212 typedef RealRealPairSet::iterator              RRPSIter;
213 typedef RealRealPairSet::const_iterator        RRPSCIter;
214 typedef RealRealPairRealMap::iterator          RRPRMIter;
215 typedef RealRealPairRealMap::const_iterator    RRPRMCIter;
216 typedef IntRealVectorMap::iterator             IntRVMIter;
217 typedef IntRealVectorMap::const_iterator       IntRVMCIter;
218 typedef IntRealMatrixMap::iterator             IntRMMIter;
219 typedef IntRealMatrixMap::const_iterator       IntRMMCIter;
220 typedef IntActiveSetMap::iterator              IntASMIter;
221 typedef IntVariablesMap::iterator              IntVarsMIter;
222 typedef IntVariablesMap::const_iterator        IntVarsMCIter;
223 typedef IntResponseMap::iterator               IntRespMIter;
224 typedef IntResponseMap::const_iterator         IntRespMCIter;
225 
226 // Suppress Doxygen warnings for these known undocumented typedefs
227 /// \endcond
228 
229 } // namespace Dakota
230 
231 #endif // DAKOTA_DATA_TYPES_H
232