ROL
ROL_SGMGA.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_SGMGA_HPP
46 #define ROL_SGMGA_HPP
47 
48 # include "ROL_SandiaRules.hpp"
49 # include "Teuchos_RCP.hpp"
50 
51 # include <string>
52 # include <cstdlib>
53 # include <iomanip>
54 # include <iostream>
55 # include <cmath>
56 
57 namespace ROL {
58 
59 class sgmga {
60 private:
61  Teuchos::RCP<SandiaRules> webbur;
62 
63 public:
64 
65  sgmga(void){webbur = Teuchos::rcp(new SandiaRules());}
66 
67  double *sgmga_aniso_balance ( double alpha_max,
68  int dim_num,
69  double level_weight[] );
70 
71  void sgmga_aniso_normalize ( int option,
72  int dim_num,
73  double level_weight[] );
74 
75  void sgmga_importance_to_aniso ( int dim_num,
76  double importance[],
77  double level_weight[] );
78 
79  void sgmga_index ( int dim_num,
80  double level_weight[],
81  int level_max,
82  int rule[],
83  int point_num,
84  int point_total_num,
85  int sparse_unique_index[],
86  int growth[],
87  int sparse_order[],
88  int sparse_index[] );
89 
90  void sgmga_point ( int dim_num,
91  double level_weight[],
92  int level_max,
93  int rule[],
94  int np[],
95  double p[],
96  void ( *gw_compute_points[] ) ( int order,
97  int np,
98  double p[],
99  double x[] ),
100  int point_num,
101  int sparse_order[],
102  int sparse_index[],
103  int growth[],
104  double sparse_point[] );
105 
106  void sgmga_product_weight ( int dim_num,
107  int order_1d[],
108  int order_nd,
109  int rule[],
110  int np[],
111  double p[],
112  void ( *gw_compute_weights[] ) ( int order,
113  int np,
114  double p[],
115  double w[] ),
116  double weight_nd[] );
117 
118  int sgmga_size ( int dim_num,
119  double level_weight[],
120  int level_max,
121  int rule[],
122  int np[],
123  double p[],
124  void ( *gw_compute_points[] ) ( int order,
125  int np,
126  double p[],
127  double x[] ),
128  double tol,
129  int growth[] );
130 
131  int sgmga_size_total ( int dim_num,
132  double level_weight[],
133  int level_max,
134  int rule[],
135  int growth[] );
136 
137  void sgmga_unique_index ( int dim_num,
138  double level_weight[],
139  int level_max,
140  int rule[],
141  int np[],
142  double p[],
143  void ( *gw_compute_points[] ) ( int order,
144  int np,
145  double p[],
146  double x[] ),
147  double tol,
148  int point_num,
149  int point_total_num,
150  int growth[],
151  int sparse_unique_index[] );
152 
153  void sgmga_vcn ( int n,
154  double level_weight[],
155  int x[],
156  double q_min,
157  double q_max,
158  bool *more );
159 
160  double sgmga_vcn_coef ( int n,
161  double level_weight[],
162  int x[],
163  double q_max );
164 
165  double sgmga_vcn_coef_naive ( int n,
166  double level_weight[],
167  int x_max[],
168  int x[],
169  double q_min,
170  double q_max );
171 
172  void sgmga_vcn_naive ( int n,
173  double level_weight[],
174  int x_max[],
175  int x[],
176  double q_min,
177  double q_max,
178  bool *more );
179 
180  void sgmga_vcn_ordered ( int dim_num,
181  double level_weight[],
182  int x_max[],
183  int x[],
184  double q_min,
185  double q_max,
186  bool *more );
187 
188  void sgmga_vcn_ordered_naive ( int dim_num,
189  double level_weight[],
190  int x_max[],
191  int x[],
192  double q_min,
193  double q_max,
194  bool *more );
195 
196  void sgmga_weight ( int dim_num,
197  double level_weight[],
198  int level_max,
199  int rule[],
200  int np[],
201  double p[],
202  void ( *gw_compute_weights[] ) ( int order,
203  int np,
204  double p[],
205  double w[] ),
206  int point_num,
207  int point_total_num,
208  int sparse_unique_index[],
209  int growth[],
210  double sparse_weight[] );
211 
212  void sgmga_write ( int dim_num,
213  double level_weight[],
214  int rule[],
215  int np[],
216  double p[],
217  int point_num,
218  double sparse_weight[],
219  double sparse_point[],
220  std::string file_name );
221 };
222 
223 } // namespace ROL
224 
225 #include "ROL_SGMGADef.hpp"
226 #endif
void sgmga_index(int dim_num, double level_weight[], int level_max, int rule[], int point_num, int point_total_num, int sparse_unique_index[], int growth[], int sparse_order[], int sparse_index[])
void sgmga_point(int dim_num, double level_weight[], int level_max, int rule[], int np[], double p[], void(*gw_compute_points[])(int order, int np, double p[], double x[]), int point_num, int sparse_order[], int sparse_index[], int growth[], double sparse_point[])
double sgmga_vcn_coef_naive(int n, double level_weight[], int x_max[], int x[], double q_min, double q_max)
void sgmga_importance_to_aniso(int dim_num, double importance[], double level_weight[])
int sgmga_size_total(int dim_num, double level_weight[], int level_max, int rule[], int growth[])
void sgmga_product_weight(int dim_num, int order_1d[], int order_nd, int rule[], int np[], double p[], void(*gw_compute_weights[])(int order, int np, double p[], double w[]), double weight_nd[])
double sgmga_vcn_coef(int n, double level_weight[], int x[], double q_max)
double * sgmga_aniso_balance(double alpha_max, int dim_num, double level_weight[])
void sgmga_weight(int dim_num, double level_weight[], int level_max, int rule[], int np[], double p[], void(*gw_compute_weights[])(int order, int np, double p[], double w[]), int point_num, int point_total_num, int sparse_unique_index[], int growth[], double sparse_weight[])
void sgmga_unique_index(int dim_num, double level_weight[], int level_max, int rule[], int np[], double p[], void(*gw_compute_points[])(int order, int np, double p[], double x[]), double tol, int point_num, int point_total_num, int growth[], int sparse_unique_index[])
Teuchos::RCP< SandiaRules > webbur
Definition: ROL_SGMGA.hpp:61
void sgmga_aniso_normalize(int option, int dim_num, double level_weight[])
void sgmga_write(int dim_num, double level_weight[], int rule[], int np[], double p[], int point_num, double sparse_weight[], double sparse_point[], std::string file_name)
sgmga(void)
Definition: ROL_SGMGA.hpp:65
int sgmga_size(int dim_num, double level_weight[], int level_max, int rule[], int np[], double p[], void(*gw_compute_points[])(int order, int np, double p[], double x[]), double tol, 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_vcn_ordered_naive(int dim_num, double level_weight[], int x_max[], int x[], double q_min, double q_max, bool *more)
void sgmga_vcn_naive(int n, double level_weight[], int x_max[], int x[], double q_min, double q_max, bool *more)
void sgmga_vcn(int n, double level_weight[], int x[], double q_min, double q_max, bool *more)