ROL
ROL_SandiaSGMGA.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 
45 #ifndef ROL_SANDIASGMGA_HPP
46 #define ROL_SANDIASGMGA_HPP
47 
48 # include "ROL_SandiaRules.hpp"
49 # include "ROL_SandiaRules2.hpp"
50 # include "Teuchos_RCP.hpp"
51 
52 # include <string>
53 # include <cstdlib>
54 # include <iomanip>
55 # include <iostream>
56 # include <cmath>
57 
58 namespace ROL {
59 
60 class SandiaSGMGA {
61 private:
62  Teuchos::RCP<SandiaRules> webbur;
63  Teuchos::RCP<SandiaRules2> webbur2;
64 
65 public:
66  SandiaSGMGA(void){
67  webbur = Teuchos::rcp(new SandiaRules());
68  webbur2 = Teuchos::rcp(new SandiaRules2());
69  }
70 
71  double *sgmga_aniso_balance
72  (
73  double alpha_max,
74  int dim_num,
75  double level_weight[]
76  );
77 
79  (
80  int option,
81  int dim_num,
82  double level_weight[]
83  );
84 
86  (
87  int dim_num,
88  double importance[],
89  double level_weight[]
90  );
91 
92  void sgmga_index
93  (
94  int dim_num,
95  double level_weight[],
96  int level_max,
97  int point_num,
98  int point_total_num,
99  int sparse_unique_index[],
100  int growth,
101  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth ),
102  int sparse_order[],
103  int sparse_index[]
104  );
105 
106  void sgmga_point
107  (
108  int dim_num,
109  double level_weight[],
110  int level_max,
111  void ( SandiaRules2::*gw_compute_points[] ) ( int order, int dim, double x[] ),
112  int point_num,
113  int sparse_order[],
114  int sparse_index[],
115  int growth,
116  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth ),
117  double sparse_point[]
118  );
119 
121  (
122  int dim_num,
123  int order_1d[],
124  int order_nd,
125  void ( SandiaRules2::*gw_compute_weights[] ) ( int order, int dim, double w[] ),
126  double weight_nd[]
127  );
128 
129  int sgmga_size
130  (
131  int dim_num,
132  double level_weight[],
133  int level_max,
134  void ( SandiaRules2::*gw_compute_points[] ) ( int order, int dim, double x[] ),
135  double tol,
136  int growth,
137  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth )
138  );
139 
140  int sgmga_size_total
141  (
142  int dim_num,
143  double level_weight[],
144  int level_max,
145  int growth,
146  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth )
147  );
148 
149  void sgmga_unique_index
150  (
151  int dim_num,
152  double level_weight[],
153  int level_max,
154  void ( SandiaRules2::*gw_compute_points[] ) ( int order, int dim, double x[] ),
155  double tol,
156  int point_num,
157  int point_total_num,
158  int growth,
159  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth ),
160  int sparse_unique_index[]
161  );
162 
163  void sgmga_vcn
164  (
165  int n,
166  double level_weight[],
167  int x[],
168  double q_min,
169  double q_max,
170  bool *more
171  );
172 
173  double sgmga_vcn_coef
174  (
175  int n,
176  double level_weight[],
177  int x[],
178  double q_max
179  );
180 
181  double sgmga_vcn_coef_naive
182  (
183  int n,
184  double level_weight[],
185  int x_max[],
186  int x[],
187  double q_min,
188  double q_max
189  );
190 
191  void sgmga_vcn_naive
192  (
193  int n,
194  double level_weight[],
195  int x_max[],
196  int x[],
197  double q_min,
198  double q_max,
199  bool *more
200  );
201 
202  void sgmga_vcn_ordered
203  (
204  int dim_num,
205  double level_weight[],
206  int x_max[],
207  int x[],
208  double q_min,
209  double q_max,
210  bool *more
211  );
212 
214  (
215  int dim_num,
216  double level_weight[],
217  int x_max[],
218  int x[],
219  double q_min,
220  double q_max,
221  bool *more
222  );
223 
224  void sgmga_weight
225  (
226  int dim_num,
227  double level_weight[],
228  int level_max,
229  void ( SandiaRules2::*gw_compute_weights[] ) ( int order, int dim, double w[] ),
230  int point_num,
231  int point_total_num,
232  int sparse_unique_index[],
233  int growth,
234  int ( SandiaRules::*gw_compute_order[] ) ( int level, int growth ),
235  double sparse_weight[] );
236 };
237 
238 } // namespace ROL
239 
240 #include "ROL_SandiaSGMGADef.hpp"
241 #endif
double sgmga_vcn_coef_naive(int n, double level_weight[], int x_max[], int x[], double q_min, double q_max)
void sgmga_weight(int dim_num, double level_weight[], int level_max, void(SandiaRules2::*gw_compute_weights[])(int order, int dim, double w[]), int point_num, int point_total_num, int sparse_unique_index[], int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth), double sparse_weight[])
void sgmga_product_weight(int dim_num, int order_1d[], int order_nd, void(SandiaRules2::*gw_compute_weights[])(int order, int dim, double w[]), double weight_nd[])
int sgmga_size_total(int dim_num, double level_weight[], int level_max, int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth))
void sgmga_vcn_ordered(int dim_num, double level_weight[], int x_max[], int x[], double q_min, double q_max, bool *more)
void sgmga_point(int dim_num, double level_weight[], int level_max, void(SandiaRules2::*gw_compute_points[])(int order, int dim, double x[]), int point_num, int sparse_order[], int sparse_index[], int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth), double sparse_point[])
Teuchos::RCP< SandiaRules > webbur
double * sgmga_aniso_balance(double alpha_max, int dim_num, double level_weight[])
void sgmga_vcn(int n, double level_weight[], int x[], double q_min, double q_max, bool *more)
int sgmga_size(int dim_num, double level_weight[], int level_max, void(SandiaRules2::*gw_compute_points[])(int order, int dim, double x[]), double tol, int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth))
Teuchos::RCP< SandiaRules2 > webbur2
double sgmga_vcn_coef(int n, double level_weight[], int x[], double q_max)
void sgmga_vcn_ordered_naive(int dim_num, double level_weight[], int x_max[], int x[], double q_min, double q_max, bool *more)
void sgmga_unique_index(int dim_num, double level_weight[], int level_max, void(SandiaRules2::*gw_compute_points[])(int order, int dim, double x[]), double tol, int point_num, int point_total_num, int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth), int sparse_unique_index[])
void sgmga_importance_to_aniso(int dim_num, double importance[], double level_weight[])
void sgmga_index(int dim_num, double level_weight[], int level_max, int point_num, int point_total_num, int sparse_unique_index[], int growth, int(SandiaRules::*gw_compute_order[])(int level, int growth), int sparse_order[], int sparse_index[])
void sgmga_vcn_naive(int n, double level_weight[], int x_max[], int x[], double q_min, double q_max, bool *more)
void sgmga_aniso_normalize(int option, int dim_num, double level_weight[])