public async Task <IActionResult> PutAggregateConfigurationDTO(int id, AggregateConfigurationDTO aggregateConfigurationDTO) { if (id != aggregateConfigurationDTO.Id) { return(BadRequest()); } _context.Entry(aggregateConfigurationDTO).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AggregateConfigurationDTOExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static void Initialize(DataContext context) { context.Database.EnsureCreated(); // Look for any aggconfigs. if (context.AggConfigs.Any()) { return; // DB has been seeded } var aggConfigs = new AggregateConfigurationDTO[] { new AggregateConfigurationDTO { Description = "Default", TotalPrimaryParticles = 600000, ClusterSize = 6, Df = 1.8, Kf = 1.3, Epsilon = 1.001, Delta = 1.01, MaxAttemptsPerCluster = 50000, MaxAttemptsPerAggregate = 200000, LargeNumber = 10000000, RadiusMeanCalculationMethod = "Geometric", AggregateSizeMeanCalculationMethod = "Geometric", PrimaryParticleSizeDistributionType = "DissDefault", AggregateSizeDistributionType = "DissDefault", AggregateFormationType = "ClusterClusterAggregation", RandomGeneratorSeed = -1 } }; context.AggConfigs.AddRange(aggConfigs); context.SaveChanges(); var filmConfigs = new FilmFormationConfigurationDTO[] { new FilmFormationConfigurationDTO { Description = "Default", XWidth = 2000, YWidth = 2000, ZWidth = 2000, MaxCPU = 4, LargeNumber = 10000000, Delta = 1.01, DepositionMethod = "Ballistic", WallCollisionMethod = "Periodic", NeighborslistMethod = "Accord" } }; context.FilmFormationConfigs.AddRange(filmConfigs); context.SaveChanges(); }
public async Task <ActionResult <AggregateConfigurationDTO> > PostAggregateConfigurationDTO(AggregateConfigurationDTO aggregateConfigurationDTO) { var dto = await _storageHelper.SaveIfNotExist(aggregateConfigurationDTO); return(CreatedAtAction("GetAggregateConfigurationDTO", new { id = dto.Id }, dto)); }
public AggregateConfigurationModelService(IAggregateConfigurationData configData) { _configData = configData; AggregateConfigurationModel = GetDefaultConfigurationModel(); }
public static IAggregateFormationConfig MapDTOtoAggregateFormationConfiguration(AggregateConfigurationDTO dto) { var config = new AggregateFormationConfig { TotalPrimaryParticles = dto.TotalPrimaryParticles, ClusterSize = dto.ClusterSize, Df = dto.Df, Kf = dto.Kf, Epsilon = dto.Epsilon, Delta = dto.Delta, MaxAttemptsPerCluster = dto.MaxAttemptsPerCluster, MaxAttemptsPerAggregate = dto.MaxAttemptsPerAggregate, LargeNumber = dto.LargeNumber, RandomGeneratorSeed = Convert.ToInt32(dto.RandomGeneratorSeed), RadiusMeanCalculationMethod = GetRadiusMeanCalculationMethod(dto.RadiusMeanCalculationMethod), AggregateSizeMeanCalculationMethod = GetAggregateSizeMeanCalculationMethod(dto.AggregateSizeMeanCalculationMethod), AggregateFormationType = GetAggregateFormationType(dto.AggregateFormationType), AggregateSizeDistributionType = GetSizeDistributionType(dto.AggregateSizeDistributionType), PrimaryParticleSizeDistributionType = GetSizeDistributionType(dto.PrimaryParticleSizeDistributionType) }; return(config); }