public void HighDataSetSizeTest() { GenerateTestPoints(out var testPoints1D, out var testPoints2D, out var testPoints3D); GenerateTestPositions(testPoints1D, testPoints2D, testPoints3D, out var testPositions1D, out var testPositions2D, out var testPositions3D); var testMatrices = GenerateTestMatrices(testPositions1D, testPositions2D, testPositions3D); var testContainers = GenerateTestContainers(testMatrices); ContainerCollectionBuilder <int> collectionsBuilder = new IntContainers(); var containers = collectionsBuilder.Create(); containers.ContainerArray = testContainers; for (var i = 0; i < 10; i++) { var containerIndex = randNum.Next(0, containerArraySize); var matrixIndex = randNum.Next(0, matrixArraySize); var positionIndex = randNum.Next(0, positionArraySize); var pointIndex = randNum.Next(0, pointArraySize); var point = containers[containerIndex][matrixIndex][positionIndex][pointIndex]; Trace.WriteLine(point.ToString()); } }
private static Containers <int> LoadDataFromDbToModel(NpgsqlConnection connection) { Console.WriteLine("Loading data to Containers PMC Model"); var containerCollection = ContainerCollectionService.Find(connection, validCollectionContainerId); var dataType = containerCollection.DataType; var containerCollectionData = ContainerCollectionService.Query(connection, containerCollection.Id); var pmsContainers = new Container <int> [containerCollectionData.Count]; for (var i = 0; i < containerCollectionData.Count; i++) { if (i % 100 == 0 && i != 0) { Console.WriteLine("Loaded {0} containers", i); } var containerModel = ContainerService.Find(connection, containerCollectionData[i].ContainerId); if (containerModel.DataType != dataType) { throw new CustomException("Containers has incorrect data type", (byte)CustomErrorCode.IncorrectDataTypeInContainers); } var containerMatrices = ContainerService.Query(connection, containerModel.Id); var pmsMatrices = new Matrix <int> [containerMatrices.Count]; for (var j = 0; j < containerMatrices.Count; j++) { if (j % 10 == 0 && j != 0) { Console.WriteLine("Loaded {0} matrices", j); } var matrixModel = MatrixService.Find(connection, containerMatrices[j].MatrixId); if (matrixModel.DataType != dataType) { throw new CustomException("Containers has incorrect data type", (byte)CustomErrorCode.IncorrectDataTypeInContainers); } var matrixPositions = MatrixService.Query(connection, matrixModel.Id); var pmsPositions = new Position <int> [matrixPositions.Count]; for (var k = 0; k < matrixPositions.Count; k++) { var positionModel = PositionService.Find(connection, matrixPositions[k].PositionId); if (positionModel.DataType != dataType) { throw new CustomException("Containers has incorrect data type", (byte)CustomErrorCode.IncorrectDataTypeInContainers); } var positionPoints = PositionService.Query(connection, positionModel.Id); var pmsPoints = new Point <int> [positionPoints.Count]; var dimension = Dimension.D1; for (var s = 0; s < positionPoints.Count; s++) { var pointModel = IntPointService.Find(connection, positionPoints[s].PointId); if (pointModel == null) { continue; } var pointModelDimension = (Dimension)pointModel.Dimension; if (dimension != pointModelDimension) { dimension = pointModelDimension; } pmsPoints[s] = new Point <int>(pointModel.GetPointArray()); } pmsPositions[k] = new Position <int>(pmsPoints, dimension); } pmsMatrices[j] = new Matrix <int>(pmsPositions); } pmsContainers[i] = new Container <int>(pmsMatrices); } ContainerCollectionBuilder <int> builder = new IntContainers(); var containers = builder.Create(); containers.ContainerArray = pmsContainers; return(containers); }