MooseVariablevar1("x", 0, "This is the variable x"); int value = var1.getValue(); // value will be 0 var1.setValue(5); // set the value of var1 to 5
MooseVariableIn this example, we create a MooseVariable called "var2" with type double, a default value of 1.0, lower limit of -1.0, upper limit of 1.0, and a description. We retrieve the value of var2 and set it to -0.5. This library is a part of the MOOSE Framework.var2("y", 1.0, -1.0, 1.0, "This is the variable y"); double value2 = var2.getValue(); // value2 will be 1.0 var2.setValue(-0.5); // set the value of var2 to -0.5