/// <summary> /// Sets up the model outputs /// </summary> /// <param name="initialisation">An instance of the model initialisation class</param> /// <param name="simulation">The index of the simulation being run</param> /// <param name="scenarioIndex">The index of the scenario being run</param> public void SetUpOutputs(MadingleyModelInitialisation initialisation, int simulation, int scenarioIndex) { // Initialise the global outputs GlobalOutputs = new OutputGlobal(InitialisationFileStrings["OutputDetail"], initialisation); // Create new outputs class instances (if the model is run for the whold model grid then select the grid view for the live output, // if the model is run for specific locations then use the graph view) if (SpecificLocations) { // Initialise the vector of outputs instances CellOutputs = new OutputCell[_CellList.Count]; for (int i = 0; i < _CellList.Count; i++) { CellOutputs[i] = new OutputCell(InitialisationFileStrings["OutputDetail"], initialisation, i); } // Spawn a dataset viewer instance for each cell to display live model results if (initialisation.LiveOutputs) { for (int i = 0; i < _CellList.Count; i++) { CellOutputs[i].SpawnDatasetViewer(NumTimeSteps); } } } else { GridOutputs = new OutputGrid(InitialisationFileStrings["OutputDetail"], initialisation); // Spawn dataset viewer to display live grid results if (initialisation.LiveOutputs) { GridOutputs.SpawnDatasetViewer(); } } }
public void Copy(OutputCell existing) { this.BasicOutputMemory.Dispose(); this.BasicOutputMemory = null; // Somehow this reverses the variables, so do it again to reverse them back again var filename = "msds:nc?file=" + existing.FileName + "&openMode=readOnly"; if (System.IO.File.Exists(existing.FileName)) { var dataSet = DataSet.Open(filename); this.BasicOutputMemory = dataSet.Clone("msds:memory"); dataSet.Dispose(); dataSet = null; } else if (existing.BasicOutputMemory.IsDisposed == false) { var dataSet = existing.BasicOutputMemory.Clone("msds:memory"); this.BasicOutputMemory = dataSet.Clone("msds:memory"); dataSet.Dispose(); dataSet = null; } }