/// <summary> /// Creates a new thermo material template of the specified type /// </summary> public static ICapeThermoMaterialTemplate CreateMaterialTemplate(string materialTemplateName) { if (_materialTemplateSystem == null) { CapeDiagnostic.LogMessage("Create MaterialTemplate Failed."); throw new ECapeUnknownException("Create MaterialTemplate Failed."); } return(_materialTemplateSystem.CreateMaterialTemplate(materialTemplateName)); }
/// <summary> /// Set Simulation context /// </summary> /// <param name="utilities">if null, will output a message to Debug</param> public static void SetSimulationContext(ICapeCOSEUtilities utilities) { if (utilities == null) { CapeDiagnostic.LogMessage( "ICapeCOSEUtilities is null, failed to set SimulationContext."); } _utilities = utilities; }
/// <summary> /// Returns the value corresponding to the value named name. /// </summary> public static object NamedValue(string name) { if (_utilities == null) { CapeDiagnostic.LogMessage("Get NamedValue Failed."); throw new ECapeUnknownException( "Get NamedValue Failed."); } return(_utilities.get_NamedValue(name)); }
/// <summary> /// create an cape unknown exception, obj should be the unit which throw the exception, in most case, it's UnitOp /// </summary> public ECapeUnknownException(CapeOpenBaseObject obj, string message, Exception inner = null, string interfaceName = null) : base(message) { ErrorObject = obj; this.InnerException = inner; this.HResult = (int)ECapeErrorHResult.ECapeUnknownHR; this.name = message ?? inner.Message; this.interfaceName = interfaceName; string errorMessage = $"CapeUnknownException : {message}"; if (inner != null) { errorMessage += $"\n InnerMessage : {inner.Message}"; } CapeDiagnostic.LogMessage(errorMessage); ErrorObject.SetError(message, interfaceName, scope); }