/// <summary> /// Performs a single time step /// </summary> public void PerformTimeStep() { if (!(MohidWaterEngineDLLAccess.PerformTimeStep())) { CreateAndThrowException(); } }
public void Dispose() { if (!MohidWaterEngineDLLAccess.Dispose()) { CreateAndThrowException(); } }
/// <summary> /// Runs the whole working cycle once - Testing Only /// </summary> public void RunSimulation() { if (!(MohidWaterEngineDLLAccess.RunSimulation())) { CreateAndThrowException(); } }
public string GetPropertyNameByIDNumber(int propertyID) { StringBuilder stringBuilder = new StringBuilder(" "); if (!MohidWaterEngineDLLAccess.GetPropertyNameByID(ref propertyID, stringBuilder, (uint)stringBuilder.Length)) { CreateAndThrowException(); } return(stringBuilder.ToString().Trim()); }
public string GetDischargeName(int dischargeInstanceID, int dischargeID) { StringBuilder stringBuilder = new StringBuilder(" "); if (!MohidWaterEngineDLLAccess.GetDischargeName(ref dischargeInstanceID, ref dischargeID, stringBuilder, (uint)stringBuilder.Length)) { CreateAndThrowException(); } return(stringBuilder.ToString().Trim()); }
/// <summary> /// Gets Current Time of the Model /// </summary> public DateTime GetCurrentTime() { StringBuilder stringBuilder = new StringBuilder(" "); if (!MohidWaterEngineDLLAccess.GetCurrentInstant(stringBuilder, (uint)stringBuilder.Length)) { CreateAndThrowException(); } return(MohidTimeStringToDotNetTime(stringBuilder.ToString().Trim())); }
/// <summary> /// Gets the name of the model /// </summary> /// <returns>Model Name</returns> public String GetModelID() { StringBuilder stringBuilder = new StringBuilder(" "); if (!MohidWaterEngineDLLAccess.GetModelID(stringBuilder, (uint)stringBuilder.Length)) { CreateAndThrowException(); } return(stringBuilder.ToString().Trim()); }
/// <summary> /// Calls the model destructor (closes data files) /// </summary> public void Finish() { if (!(MohidWaterEngineDLLAccess.Finish())) { CreateAndThrowException(); } while (Kernel32Wrapper.FreeLibrary(_FortranDllHandle)) { ; } }
private void CreateAndThrowException() { int numberOfMessages = 0; numberOfMessages = MohidWaterEngineDLLAccess.GetNumberOfMessages(); string message = "Error Messages from MOHID Water Engine"; for (int i = 0; i < numberOfMessages; i++) { int n = i; StringBuilder messageFromCore = new StringBuilder(" "); MohidWaterEngineDLLAccess.GetMessage(ref n, messageFromCore, (uint)messageFromCore.Length); message += "; "; message += messageFromCore.ToString().Trim(); } throw new Exception(message); }
/// <summary> /// Loads the Fortran Dll and initializes the model (calling the constructor) /// </summary> /// <param name="filePath">Path to the nomfich.dat file</param> public void Initialize(string filePath) { //Loads the library _FortranDllHandle = Kernel32Wrapper.LoadLibrary(@"D:\Software\Mohid\MOHID.Numerics\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MohidWaterEngine\Release OpenMI\MohidWaterEngine.dll"); //Sets the directory temporary to the exe dir of the model String currentDir = Environment.CurrentDirectory; Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(filePath); //Calls the constructor and reads data files, etc if (!(MohidWaterEngineDLLAccess.Initialize(filePath, ((uint)filePath.Length)))) { CreateAndThrowException(); } Environment.CurrentDirectory = currentDir; }
public double GetDischargeYCoordinate(int dischargeInstanceID, int dischargeID) { return(MohidWaterEngineDLLAccess.GetDischargeYCoordinate(ref dischargeInstanceID, ref dischargeID)); }
public int GetDischargeType(int dischargeInstanceID, int dischargeID) { return(MohidWaterEngineDLLAccess.GetDischargeType(ref dischargeInstanceID, ref dischargeID)); }
public double GetConcentrationAtPoint(int waterPropertiesInstanceID, int propertyID, int i, int j) { return(MohidWaterEngineDLLAccess.GetConcentrationAtPoint(ref waterPropertiesInstanceID, ref propertyID, ref i, ref j)); }
public void GetConcentration1D(int waterPropertiesInstanceID, int propertyID, int numberOfcomputePoints, ref double[] concentration1D) { MohidWaterEngineDLLAccess.GetConcentration1D(ref waterPropertiesInstanceID, ref propertyID, ref numberOfcomputePoints, concentration1D); }
public void SetDischargeConcentration(int dischargeInstanceID, int dischargeID, int propertyID, double concentration) { MohidWaterEngineDLLAccess.SetDischargeConcentration(ref dischargeInstanceID, ref dischargeID, ref propertyID, ref concentration); }
public void SetDischargeFlow(int dischargeInstanceID, int dischargeID, double flow) { MohidWaterEngineDLLAccess.SetDischargeFlow(ref dischargeInstanceID, ref dischargeID, ref flow); }
public void GetWaterLevel1D(int hydrodynamicInstanceID, int numberOfComputePoints, ref double[] waterLevels1D) { MohidWaterEngineDLLAccess.GetWaterLevel1D(ref hydrodynamicInstanceID, ref numberOfComputePoints, waterLevels1D); }
public int GetNumberOfProperties(int waterPropertiesInstanceID) { return(MohidWaterEngineDLLAccess.GetNumberOfProperties(ref waterPropertiesInstanceID)); }
public void GetGridCellCoordinates(int horizontalGridInstanceID, int i, int j, ref double[] xCoords, ref double[] yCoords) { MohidWaterEngineDLLAccess.GetGridCellCoordinates(ref horizontalGridInstanceID, ref i, ref j, xCoords, yCoords); }
public double GetWaterLevelAtPoint(int hydrodynamicInstanceID, int i, int j) { return(MohidWaterEngineDLLAccess.GetWaterLevelAtPoint(ref hydrodynamicInstanceID, ref i, ref j)); }
public int GetNumberOfDischargeProperties(int dischargeInstanceID, int dischargeID) { return(MohidWaterEngineDLLAccess.GetNumberOfDischargeProperties(ref dischargeInstanceID, ref dischargeID)); }
public bool IsWaterPoint(int horizontalGridInstanceID, int i, int j) { return(MohidWaterEngineDLLAccess.IsWaterPoint(ref horizontalGridInstanceID, ref i, ref j)); }
public int GetJUB(int horizontalGridInstanceID) { return(MohidWaterEngineDLLAccess.GetJUB(ref horizontalGridInstanceID)); }
/// <summary> /// Gets Current Time Step of the Model /// </summary> public double GetCurrentTimeStep() { return(MohidWaterEngineDLLAccess.GetCurrentTimeStep()); }
public int GetPropertyIDNumber(int waterPropertiesInstanceID, int idx) { return(MohidWaterEngineDLLAccess.GetWaterPropertiesPropertyID(ref waterPropertiesInstanceID, ref idx)); }
public double GetCenterYCoordinate(int horizontalGridInstanceID, int i, int j) { return(MohidWaterEngineDLLAccess.GetCenterYCoordinate(ref horizontalGridInstanceID, ref i, ref j)); }
public int GetDischargePropertyID(int dischargeInstanceID, int dischargeID, int idx) { return(MohidWaterEngineDLLAccess.GetDischargePropertyID(ref dischargeInstanceID, ref dischargeID, ref idx)); }