File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525namespace libMesh
2626{
2727
28- Number RBTheta ::evaluate (const RBParameters & ) { return 1. ; }
28+ Number RBTheta ::evaluate (const RBParameters & mu )
29+ {
30+ // The RBTheta::evaluate() API is not general enough to handle the
31+ // multi-step RBParameters case, and you must therefore call
32+ // RBTheta::evaluate_vec() instead.
33+ libmesh_error_msg_if (mu .n_steps () > 1 ,
34+ "You should only call the evaluate_vec() API when using multi-step RBParameters objects." );
35+
36+ return 1. ;
37+ }
2938
3039std ::vector < Number >
3140RBTheta ::evaluate_vec (const std ::vector < RBParameters > & mus )
3241{
33- std ::vector < Number > result (mus .size ());
34- for (auto i : index_range (mus ))
35- result [i ] = evaluate (mus [i ]);
42+ // Eventual return value
43+ std ::vector < Number > result ;
44+
45+ for (const auto & mu : mus )
46+ {
47+ // Backwards-compatible behavior: for single-step RBParameters objects, we fall back on
48+ // calling the scalar evaluate() function for this RBTheta object, which may have been
49+ // overridden by the user.
50+ if (mu .n_steps () == 1 )
51+ result .push_back ( this -> evaluate (mu ) );
52+ else
53+ {
54+ // For multistep RBParameters objects, all we can do is return
55+ // mu.n_steps() copies of 1 here at the base class level.
56+ result .insert (result .end (), /*count=*/ mu .n_steps (), /*val=*/ 1. );
57+ }
58+ }
3659
3760 return result ;
3861}
You can’t perform that action at this time.
0 commit comments