示例#1
0
 /// <summary>
 /// Creates 1-dimensional variable key using string name
 /// </summary>
 /// <param name="variableName">Kratos variable name, for example "PRESSURE"</param>
 /// <returns>1-dimensional variable .</returns>
 public static Variable1d FromName(string variableName)
 {
     if (NativeVariables.Variable_Has1dVar(variableName))
     {
         return(new Variable1d(NativeVariables.Variable_Get1dVar(variableName), variableName,
                               VariableType.Standard));
     }
     if (NativeVariables.Variable_HasVariableComponent(variableName))
     {
         return(new Variable1d(NativeVariables.Variable_GetVarComponent(variableName), variableName,
                               VariableType.Component));
     }
     return(null);
 }
示例#2
0
 /// <summary>
 /// Checks whether variable with this name is registered in Kratos
 /// </summary>
 /// <param name="variableName">Name to check</param>
 /// <returns>true, if variable exists and <see cref="FromName"/> can be called.</returns>
 public static bool HasName(string variableName)
 {
     return(NativeVariables.Variable_Has1dVar(variableName) ||
            NativeVariables.Variable_HasVariableComponent(variableName));
 }