@@ -55,58 +55,28 @@ ParsedAux::ParsedAux(const InputParameters & parameters)
55
55
_nargs (coupledComponents ("coupled_variables" )),
56
56
_args (coupledValues ("coupled_variables" )),
57
57
_use_xyzt (getParam < bool > ("use_xyzt" )),
58
+ _xyzt ({"x" , "y" , "z" , "t" }),
58
59
_functor_names (getParam < std ::vector < MooseFunctorName >>("functor_names" )),
59
60
_n_functors (_functor_names .size ()),
60
61
_functor_symbols (getParam < std ::vector < std ::string >>("functor_symbols" ))
61
62
{
63
+
64
+ for (const auto i : make_range (_nargs ))
65
+ _coupled_variable_names .push_back (getFieldVar ("coupled_variables" , i )-> name ());
66
+
62
67
// sanity checks
63
68
if (!_functor_symbols .empty () && (_functor_symbols .size () != _n_functors ))
64
69
paramError ("functor_symbols" , "functor_symbols must be the same length as functor_names." );
65
70
66
- const std ::vector < std ::string > xyzt = {"x" , "y" , "z" , "t" };
67
- std ::vector < std ::string > variable_names ;
68
- for (const auto i : make_range (_nargs ))
69
- variable_names .push_back (getFieldVar ("coupled_variables ", i )- > name ());
70
-
71
- if (_functor_symbols .size ())
72
- {
73
- for (const auto & symbol : _functor_symbols )
74
- {
75
- // Make sure symbol is not x, y, z, or t
76
- if (_use_xyzt && (std ::find (xyzt .begin (), xyzt .end (), symbol ) != xyzt .end ()))
77
- paramError ("functor_symbols ",
78
- "x, y, z, and t cannot be used as a functor symbol when use_xyzt=true." );
79
- // Make sure symbol is not a variable name
80
- if (variable_names .size () &&
81
- (std ::find (variable_names .begin (), variable_names .end (), symbol ) != variable_names .end ()))
82
- paramError ("functor_symbols" ,
83
- "Functor symbols cannot overlap with coupled variable names." );
84
- }
85
- }
86
- else
87
- for (const auto & name : _functor_names )
88
- {
89
- // Make sure symbol is not x, y, z, or t
90
- if (_use_xyzt && (std ::find (xyzt .begin (), xyzt .end (), std ::string (name )) != xyzt .end ()))
91
- paramError ("functor_names" ,
92
- "x, y, z, and t cannot be used as a functor name when use_xyzt=true. Use "
93
- "'functor_symbols' to disambiguate." );
94
- // Make sure symbol is not a variable name
95
- if (variable_names .size () &&
96
- (std ::find (variable_names .begin (), variable_names .end (), std ::string (name )) !=
97
- variable_names .end ()))
98
- paramError (
99
- "functor_names" ,
100
- "Functor names cannot overlap with coupled variable names. Use 'functor_symbols' to "
101
- "disambiguate." );
102
- }
71
+ validateFunctorSymbols ();
72
+ validateFunctorNames ();
103
73
104
74
// build variables argument
105
75
std ::string variables ;
106
76
107
77
// coupled field variables
108
- for (const auto i : make_range ( _nargs ))
109
- variables += (i == 0 ? "" : "," ) + getFieldVar ( "coupled_variables" , i ) -> name () ;
78
+ for (const auto i : index_range ( _coupled_variable_names ))
79
+ variables += (i == 0 ? "" : ",") + _coupled_variable_names [ i ] ;
110
80
111
81
// adding functors to the expression
112
82
if (_functor_symbols .size ())
@@ -118,7 +88,7 @@ ParsedAux::ParsedAux(const InputParameters & parameters)
118
88
119
89
// "system" variables
120
90
if (_use_xyzt )
121
- for (auto & v : xyzt )
91
+ for (auto & v : _xyzt )
122
92
variables += (variables .empty () ? "" : "," ) + v ;
123
93
124
94
// base function object
@@ -191,3 +161,15 @@ ParsedAux::computeValue()
191
161
192
162
return evaluate (_func_F );
193
163
}
164
+
165
+ void
166
+ ParsedAux ::validateFunctorSymbols ()
167
+ {
168
+ validateGenericVectorNames (_functor_symbols , "functor_symbols" );
169
+ }
170
+
171
+ void
172
+ ParsedAux ::validateFunctorNames ()
173
+ {
174
+ validateGenericVectorNames (_functor_names , "functor_names" );
175
+ }
0 commit comments