Closed lingzou closed 9 months ago
@GiudGiud and @lindsayad
what would be the best naming for the alias? CoupledVar
, CoupledVariables
, VariableNameVector
, or something else? I prefer the first one because of its consistency.
VariableNameVector would be fine for me
My only concern with CoupledVariables
is that it points to the Coupleable interface, but what if it s used outside that context? Maybe we can also not use it when we are not dealing with a coupleable context
VariableNameVector would be fine for me
My only concern with
CoupledVariables
is that it points to the Coupleable interface, but what if it s used outside that context? Maybe we can also not use it when we are not dealing with a coupleable context
Makes great sense to me. We can use VariableNameVector
.
I personally prefer CoupledName
as this is already used for a typedef
in the contact, tensor mechanics, and navier-stokes modules
addCoupledVar
can be used in any MooseObject
's validParams
whether it inherits from the Coupleable
interface or not. Similarly I think users can be comfortable using CoupledName
in non-"Coupleable" contexts
A quick search finds multiple typedef of CoupledName
contact/include/actions/ContactAction.h: typedef std::vector<VariableName> CoupledName;
navier_stokes/include/actions/CNSAction.h: typedef std::vector<VariableName> CoupledName;
navier_stokes/include/actions/INSAction.h: typedef std::vector<VariableName> CoupledName;
navier_stokes/include/base/NSFVBase.h: typedef std::vector<VariableName> CoupledName;
tensor_mechanics/include/actions/DomainIntegralAction.h: typedef std::vector<VariableName> CoupledName;
How about we keep CoupledName
and move the typedef
into MooseTypes.h and make it a moose thing?
I think that's a good idea!
Reason
The ultimate goal is for convenience.
In MOOSE kernels or objects similar, when a coupled variable is needed, the
InputParameters::addCoupledVar
API is used, which is reallyInputParameters::addParam<std::vector<VariableName>>
under the hood.When in the code (not in a MOOSE input file) this coupled variable is supplied, we do something like this:
pars.set<std::vector<VariableName>>("coupled_var") = {"my_var"}
To keep things consistent and convenient, it seems reasonable to define an alias, such as:
typedef std::vector<VariableName> CoupledVar
Design
See discussion above.
Add
typedef std::vector<VariableName> CoupledVar
inMooseTypes.h
, such thatInputParameters::addCoupledVar
andpars.set<CoupledVar>("coupled_var") = {"my_var"}
are consistent.Impact
Will not change existing APIs, nor user inputs.