/// <summary> /// Přidá tabulku /// </summary> /// <param name="table"></param> public void AddTable(Table table) { GGrid grid = new GGrid(this); grid.AddTable(table); this._AddGrid(grid); }
/// <summary> /// Metoda načte všechny tabulky typu <see cref="GuiGrid"/> z dodaného <see cref="GuiPanel"/> a vloží je jako nové Taby do dodaného vizuálního objektu <see cref="TabContainer"/>. /// Současně je ukládá do <see cref="_DataTableList"/>. /// </summary> /// <param name="guiPanel"></param> /// <param name="tabs"></param> /// <returns></returns> private bool _LoadDataToTabs(GuiPanel guiPanel, TabContainer tabs) { if (guiPanel == null || guiPanel.Grids.Count == 0) { return(false); } foreach (GuiGrid guiGrid in guiPanel.Grids) { GGrid gGrid = new GGrid(); gGrid.SynchronizedTime = this.SynchronizedTime; gGrid.Name = guiGrid.FullName; // Fullname gridu slouží jako ID do konfigurace pro data o layoutu sloupců v gridu MainDataTable mainDataTable = this._LoadDataToMainTable(gGrid, guiGrid); if (mainDataTable == null) { continue; } tabs.AddTabItem(gGrid, guiGrid.Title, guiGrid.ToolTip); this._GGridList.Add(gGrid); // Toto je seznam GRIDŮ. A v této metodě se pracuje více gridy - jedna smyčka = jeden grid } return(true); }
/// <summary> /// Metoda načte všechny tabulky typu <see cref="GuiGrid"/> z dodaného <see cref="GuiPanel"/> a vloží je do dodaného vizuálního objektu <see cref="GGrid"/>. /// Současně je ukládá do <see cref="_DataTableList"/>. /// </summary> /// <param name="guiPanel"></param> /// <param name="gGrid"></param> /// <returns></returns> private bool _LoadDataToGrid(GuiPanel guiPanel, GGrid gGrid) { if (guiPanel == null || guiPanel.Grids.Count == 0) { return(false); } if (gGrid.SynchronizedTime == null) { gGrid.SynchronizedTime = this.SynchronizedTime; } gGrid.Name = guiPanel.FullName + "\\" + _GRID_MAIN_NAME; // Fullname gridu slouží jako ID do konfigurace pro data o layoutu sloupců v gridu this._GGridList.Add(gGrid); // Toto je seznam GRIDŮ. A v této metodě se pracuje jen s jedním gridem. foreach (GuiGrid guiGrid in guiPanel.Grids) { MainDataTable mainDataTable = this._LoadDataToMainTable(gGrid, guiGrid); if (mainDataTable == null) { continue; } } return(true); }
/// <summary> /// Metoda zajistí uložení layoutu jednoho daného GGridu do konfigurace <see cref="_PanelLayout"/> a návazně do souboru .config /// </summary> /// <param name="gGrid"></param> private void _SaveGridLayout(GGrid gGrid) { if (gGrid != null && !String.IsNullOrEmpty(gGrid.Name)) { this._PanelLayout.GridColumns[gGrid.Name] = gGrid.ColumnLayout; this.ConfigSaveDeffered(); } }
/// <summary> /// Metoda vytvoří novou tabulku <see cref="MainDataTable"/> s daty dodanými v <see cref="GuiGrid"/>. /// Pokud data neobsahují tabulku s řádky, vrací null. /// Vytvořenou tabulku <see cref="MainDataTable"/> uloží do <see cref="_DataTableList"/>, /// do vizuálního gridu <see cref="GGrid"/> přidá tabulku s řádky z dodaného <see cref="GuiGrid"/>. /// Vytvořenou tabulku <see cref="MainDataTable"/> vrací. /// </summary> /// <param name="gGrid"></param> /// <param name="guiGrid"></param> /// <returns></returns> private MainDataTable _LoadDataToMainTable(GGrid gGrid, GuiGrid guiGrid) { MainDataTable mainDataTable = null; using (App.Trace.Scope(TracePriority.Priority2_Lowest, "SchedulerPanel", "LoadDataToMainTable", "", guiGrid.FullName)) mainDataTable = new MainDataTable(this, gGrid, guiGrid); if (mainDataTable.TableRow == null) { return(null); } this._DataTableList.Add(mainDataTable); mainDataTable.AddTableToGrid(gGrid); return(mainDataTable); }
private void _AddGrid(GGrid grid) { if (grid == null) { return; } Table table = grid.DataTables.FirstOrDefault(); if (table == null) { return; } ((IInteractiveItem)grid).Parent = this; this._GridList.Add(grid); this._TabHeader.AddHeader(table.Title, table.Image, linkItem: grid); }
/// <summary> /// Does the launch. /// </summary> /// <param name="gridSize">Size of the grid.</param> /// <param name="blockSize">Size of the block.</param> /// <param name="streamId">Stream id, or -1 for non-async.</param> /// <param name="gpuMethodInfo">The gpu method info.</param> /// <param name="arguments">The arguments.</param> protected override void DoLaunch(dim3 gridSize, dim3 blockSize, int streamId, KernelMethodInfo gpuMethodInfo, params object[] arguments) { if (streamId > -1 && !_streams.ContainsKey(streamId)) { _streams.Add(streamId, streamId); } MethodInfo mi = gpuMethodInfo.Method; if (mi == null) { throw new CudafyHostException(CudafyHostException.csX_NOT_SET, gpuMethodInfo.Name); } object instance = mi.IsStatic ? null : Activator.CreateInstance(mi.DeclaringType); if (gpuMethodInfo.IsDummy) { object[] argsCopy = new object[arguments.Length]; for (int i = 0; i < arguments.Length; i++) { if (arguments[i].GetType().IsArray) { var v = TryGetDeviceMemory(arguments[i]) as EmuDevicePtrEx; if (v != null) { if (v.Offset == 0) { argsCopy[i] = v.DevPtr; } else { throw new CudafyHostException(CudafyHostException.csX_NOT_CURRENTLY_SUPPORTED, "Offsets in arrays passed to dummy functions"); } } else { argsCopy[i] = arguments[i]; } } else { argsCopy[i] = arguments[i]; } } mi.Invoke(instance, argsCopy); return; } GGrid grid = new GGrid(gridSize); Dictionary <Array, EmuDevicePtrEx> dic; object[] pList = BuildParameterList2(mi, arguments, out dic); //object[] pListCopy = new object[0]; if (gridSize.z > 1) { throw new CudafyHostException(CudafyHostException.csX_NOT_SUPPORTED, "3D grid sizes"); } if (blockSize.z > 1) { throw new CudafyHostException(CudafyHostException.csX_NOT_SUPPORTED, "3D block sizes"); } for (int x = 0; x < gridSize.x; x++) { for (int y = 0; y < gridSize.y; y++) { int totalSize = blockSize.x * blockSize.y * blockSize.z; Thread[] threads = new Thread[totalSize]; GBlock blk2lnch = new GBlock(grid, blockSize, x, y); int tCtr = 0; int pListLen = pList.Length; for (int tx = 0; tx < blockSize.x; tx++) { for (int ty = 0; ty < blockSize.y; ty++) { GThread ht = new GThread(tx, ty, blk2lnch); object[] pListCopy = new object[pListLen]; for (int pc = 0; pc < pListLen; pc++) { if (pList[pc] is GThread) { pListCopy[pc] = ht; } else { pListCopy[pc] = pList[pc]; } } #warning OPTIMIZATION if there is no synchronize then start and join threads in multiple of processor count - check this in disassembly and put flag in gpuMethodInfo threads[tCtr] = new Thread(() => { mi.Invoke(instance, pListCopy); }); threads[tCtr].Name = string.Format("Grid_{0}_{1}_Thread_{2}_{3}", x, y, tx, ty); threads[tCtr].Start(); //if (ctr % 16 == 0) // Console.WriteLine("Ctr=" + ctr.ToString()); //ctr++; tCtr++; } } for (int i = 0; i < totalSize; i++) { threads[i].Join(); //Console.WriteLine("Thread {0} exited.", threads[i].Name); } } } int iArgs = 0; ParameterInfo[] piArray = mi.GetParameters(); for (int iParams = 0; iParams < piArray.Length; iParams++) { ParameterInfo pi = piArray[iParams]; if (pi.ParameterType == typeof(GThread)) { continue; } else if (iArgs < pList.Length) { object o = pList[iArgs++]; if (!(o is GThread)) { if (o.GetType().IsArray) { if (dic.ContainsKey(o as Array)) { EmuDevicePtrEx ptrEx = dic[o as Array]; DoCopy(o as Array, 0, ptrEx.DevPtr, ptrEx.Offset, ptrEx.TotalSize, pi.ParameterType.GetElementType()); } } } else { iParams--; } } } }
/// <summary> /// Přidá grid /// </summary> /// <param name="grid"></param> public void AddGrid(GGrid grid) { this._AddGrid(grid); }
void Awake() { grid = GetComponentInChildren<GGrid>(); label = transform.FindChild("back/back/Label").GetComponent<UILabel>(); }