1 template <
int dim,
typename T>
5 std::cout <<
"\nTesting 'EquationDependencyParser'... " << std::endl;
10 std::vector<std::string> sorted_dependencies_value_RHS, sorted_dependencies_gradient_RHS, sorted_dependencies_value_LHS, sorted_dependencies_gradient_LHS;
13 std::vector<std::string> var_name;
14 var_name.push_back(
"a");
15 var_name.push_back(
"bc");
17 std::vector<PDEType> var_eq_type;
23 sorted_dependencies_value_RHS.push_back(
"a, grad(a), bc");
24 sorted_dependencies_value_RHS.push_back(
"hess(a),grad(bc)");
26 sorted_dependencies_gradient_RHS.push_back(
"grad(bc), bc");
27 sorted_dependencies_gradient_RHS.push_back(
"a,grad(bc)");
29 sorted_dependencies_value_LHS.push_back(
"");
30 sorted_dependencies_value_LHS.push_back(
"change(bc),grad(bc),grad(change(bc))");
32 sorted_dependencies_gradient_LHS.push_back(
"");
33 sorted_dependencies_gradient_LHS.push_back(
"bc");
35 std::vector<bool> var_nonlinear;
39 equation_dependency_parser.
parse(
42 sorted_dependencies_value_RHS,
43 sorted_dependencies_gradient_RHS,
44 sorted_dependencies_value_LHS,
45 sorted_dependencies_gradient_LHS,
50 unsigned int subtest_index = 0;
60 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_explicit_RHS': " << result << std::endl;
61 pass = pass && result;
72 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_explicit_RHS': " << result << std::endl;
73 pass = pass && result;
84 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_hessian_explicit_RHS': " << result << std::endl;
85 pass = pass && result;
96 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_nonexplicit_RHS': " << result << std::endl;
97 pass = pass && result;
108 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_nonexplicit_RHS': " << result << std::endl;
109 pass = pass && result;
120 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_hessian_nonexplicit_RHS': " << result << std::endl;
121 pass = pass && result;
132 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_nonexplicit_LHS': " << result << std::endl;
133 pass = pass && result;
144 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_nonexplicit_LHS': " << result << std::endl;
145 pass = pass && result;
156 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_hessian_nonexplicit_LHS': " << result << std::endl;
157 pass = pass && result;
168 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_change_nonexplicit_LHS': " << result << std::endl;
169 pass = pass && result;
180 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_change_nonexplicit_LHS': " << result << std::endl;
181 pass = pass && result;
191 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_hessian_change_nonexplicit_LHS': " << result << std::endl;
192 pass = pass && result;
202 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_residual_explicit_RHS': " << result << std::endl;
203 pass = pass && result;
213 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_residual_explicit_RHS': " << result << std::endl;
214 pass = pass && result;
224 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_residual_nonexplicit_RHS': " << result << std::endl;
225 pass = pass && result;
235 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_residual_nonexplicit_RHS': " << result << std::endl;
236 pass = pass && result;
246 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_value_residual_nonexplicit_LHS': " << result << std::endl;
247 pass = pass && result;
257 std::cout <<
"Subtest " << subtest_index <<
" result for 'need_gradient_residual_nonexplicit_LHS': " << result << std::endl;
258 pass = pass && result;
262 sprintf (buffer,
"Test result for 'EquationDependencyParser': %u\n", pass);
269 template <
int dim,
typename T>
273 std::cout <<
"\nTesting 'EquationDependencyParser'... " << std::endl;
278 std::vector<std::string> sorted_dependencies_value_RHS, sorted_dependencies_gradient_RHS, sorted_dependencies_value_LHS, sorted_dependencies_gradient_LHS;
281 std::vector<std::string> var_name;
282 var_name.push_back(
"a");
283 var_name.push_back(
"bc");
284 var_name.push_back(
"def");
285 var_name.push_back(
"ghij");
286 var_name.push_back(
"klmno");
288 std::vector<PDEType> var_eq_type;
297 sorted_dependencies_value_RHS.push_back(
"bc, def, grad(bc)");
298 sorted_dependencies_value_RHS.push_back(
"bc, def");
299 sorted_dependencies_value_RHS.push_back(
"def");
300 sorted_dependencies_value_RHS.push_back(
"a, ghij");
301 sorted_dependencies_value_RHS.push_back(
"a, klmno");
303 sorted_dependencies_gradient_RHS.push_back(
"hess(def), ghij");
304 sorted_dependencies_gradient_RHS.push_back(
"grad(bc)");
305 sorted_dependencies_gradient_RHS.push_back(
"");
306 sorted_dependencies_gradient_RHS.push_back(
"grad(ghij)");
307 sorted_dependencies_gradient_RHS.push_back(
"grad(klmno)");
309 sorted_dependencies_value_LHS.push_back(
"");
310 sorted_dependencies_value_LHS.push_back(
"change(bc)");
311 sorted_dependencies_value_LHS.push_back(
"change(def)");
312 sorted_dependencies_value_LHS.push_back(
"change(ghij), grad(def)");
313 sorted_dependencies_value_LHS.push_back(
"change(klmno), grad(a)");
315 sorted_dependencies_gradient_LHS.push_back(
"");
316 sorted_dependencies_gradient_LHS.push_back(
"");
317 sorted_dependencies_gradient_LHS.push_back(
"grad(def)");
318 sorted_dependencies_gradient_LHS.push_back(
"");
319 sorted_dependencies_gradient_LHS.push_back(
"hess(change(klmno))");
321 std::vector<bool> var_nonlinear;
325 equation_dependency_parser.
parse(
328 sorted_dependencies_value_RHS,
329 sorted_dependencies_gradient_RHS,
330 sorted_dependencies_value_LHS,
331 sorted_dependencies_gradient_LHS,
336 unsigned int subtest_index = 0;
341 if (var_nonlinear[0] ==
false){
344 std::cout <<
"Subtest " << subtest_index <<
" result for an explicit parabolic equation: " << result << std::endl;
345 pass = pass && result;
350 if (var_nonlinear[1] ==
true){
353 std::cout <<
"Subtest " << subtest_index <<
" result for nonlinearity due to needing a non-governing variable on the RHS: " << result << std::endl;
354 pass = pass && result;
359 if (var_nonlinear[2] ==
true){
362 std::cout <<
"Subtest " << subtest_index <<
" result for nonlinearity due to needed non-change version of governing variable on the LHS: " << result << std::endl;
363 pass = pass && result;
368 if (var_nonlinear[3] ==
true){
371 std::cout <<
"Subtest " << subtest_index <<
" result for nonlinearity due to needing a non-governing variable on the LHS: " << result << std::endl;
372 pass = pass && result;
377 if (var_nonlinear[4] ==
false){
380 std::cout <<
"Subtest " << subtest_index <<
" result for linear time independent: " << result << std::endl;
381 pass = pass && result;
385 sprintf (buffer,
"Test result for 'EquationDependencyParser': %u\n", pass);
392 template <
int dim,
typename T>
396 std::cout <<
"\nTesting 'EquationDependencyParser'... " << std::endl;
401 std::vector<std::string> sorted_dependencies_value, sorted_dependencies_gradient;
404 std::vector<std::string> var_name;
405 var_name.push_back(
"a");
406 var_name.push_back(
"bc");
408 std::vector<std::string> pp_var_name;
409 pp_var_name.push_back(
"pp1");
410 pp_var_name.push_back(
"pp2");
411 pp_var_name.push_back(
"pp3");
414 sorted_dependencies_value.push_back(
"bc, a, grad(bc)");
415 sorted_dependencies_value.push_back(
"");
416 sorted_dependencies_value.push_back(
"a");
418 sorted_dependencies_gradient.push_back(
"hess(a), bc");
419 sorted_dependencies_gradient.push_back(
"grad(bc)");
420 sorted_dependencies_gradient.push_back(
"a");
424 equation_dependency_parser.
pp_parse(
427 sorted_dependencies_value,
428 sorted_dependencies_gradient);
432 unsigned int subtest_index = 0;
442 std::cout <<
"Subtest " << subtest_index <<
" result for 'pp_need_value': " << result << std::endl;
443 pass = pass && result;
454 std::cout <<
"Subtest " << subtest_index <<
" result for 'pp_need_gradient': " << result << std::endl;
455 pass = pass && result;
466 std::cout <<
"Subtest " << subtest_index <<
" result for 'pp_need_hessian': " << result << std::endl;
467 pass = pass && result;
479 std::cout <<
"Subtest " << subtest_index <<
" result for 'pp_need_value_residual': " << result << std::endl;
480 pass = pass && result;
491 std::cout <<
"Subtest " << subtest_index <<
" result for 'pp_need_gradient_residual': " << result << std::endl;
492 pass = pass && result;
495 sprintf (buffer,
"Test result for 'EquationDependencyParser': %u\n", pass);
std::vector< bool > need_value_explicit_RHS
std::vector< bool > pp_need_gradient_residual
std::vector< bool > need_hessian_nonexplicit_RHS
void parse(std::vector< std::string > var_name, std::vector< PDEType > var_eq_type, std::vector< std::string > sorted_dependencies_value_RHS, std::vector< std::string > sorted_dependencies_gradient_RHS, std::vector< std::string > sorted_dependencies_value_LHS, std::vector< std::string > sorted_dependencies_gradient_LHS, std::vector< bool > &var_nonlinear)
bool test_EquationDependencyParser_postprocessing()
std::vector< bool > need_value_nonexplicit_LHS
std::vector< bool > need_value_change_nonexplicit_LHS
std::vector< bool > need_value_residual_explicit_RHS
std::vector< bool > pp_need_value
bool test_EquationDependencyParser_nonlinear()
std::vector< bool > pp_need_hessian
std::vector< bool > need_gradient_nonexplicit_RHS
std::vector< bool > need_hessian_nonexplicit_LHS
std::vector< bool > need_hessian_change_nonexplicit_LHS
std::vector< bool > need_gradient_nonexplicit_LHS
std::vector< bool > need_gradient_change_nonexplicit_LHS
std::vector< bool > need_value_nonexplicit_RHS
std::vector< bool > need_value_residual_nonexplicit_LHS
std::vector< bool > need_hessian_explicit_RHS
std::vector< bool > pp_need_value_residual
std::vector< bool > pp_need_gradient
std::vector< bool > need_value_residual_nonexplicit_RHS
void pp_parse(std::vector< std::string > var_name, std::vector< std::string > pp_var_name, std::vector< std::string > sorted_dependencies_value, std::vector< std::string > sorted_dependencies_gradient)
std::vector< bool > need_gradient_explicit_RHS
std::vector< bool > need_gradient_residual_nonexplicit_LHS
std::vector< bool > need_gradient_residual_nonexplicit_RHS
bool test_EquationDependencyParser_variables_and_residuals_needed()
std::vector< bool > need_gradient_residual_explicit_RHS