public void CreateAndSerializeScenario()
        {
            var config     = new SimConfigurator(filename);
            var sim_config = config.SimConfig;

            // Experiment
            sim_config.experiment_name = "Test experiment for XML serialization";
            sim_config.scenario.time_config.duration = 100;
            sim_config.scenario.time_config.timestep = 3;

            // Global Paramters
            sim_config.LoadDefaultGlobalParameters();

            // Entity Repository
            EntityRepository repository = new EntityRepository();
            // Possible solfac types
            SolfacType st = new SolfacType();

            st.solfac_type_name = "ccr7";
            repository.solfac_types.Add(st);
            st = new SolfacType();
            st.solfac_type_name = "cxcl13";
            repository.solfac_types.Add(st);
            // Possible cell types
            CellType ct = new CellType();

            ct.cell_type_name = "bcell";
            ct.LoadDefaultMotileCellParams();
            repository.cell_types.Add(ct);
            ct = new CellType();
            ct.cell_type_name = "tcell";
            ct.LoadDefaultMotileCellParams();
            repository.cell_types.Add(ct);
            sim_config.entity_repository = repository;
            // Gaussian Gradients
            GaussianSpecification gg = new GaussianSpecification();

            gg.gaussian_spec_name = "Default on-center gradient";
            sim_config.entity_repository.gaussian_gradients.Add(gg);

            // Regions (not part of repository right now...)
            sim_config.scenario.regions.Add(new Region("Sphere", RegionShape.Ellipsoid));
            sim_config.scenario.regions.Add(new Region("Cube", RegionShape.Rectangular));

            // Cells
            CellSet cs = new CellSet();

            cs.cell_name     = "Generic motile bcell";
            cs.cell_type_ref = sim_config.entity_repository.cell_types[0].cell_type_name;
            cs.number        = 200;
            cs.cells_constrained_to_region = true;
            cs.region_name_ref             = sim_config.scenario.regions[0].region_name;
            cs.wrt_region = RelativePosition.Inside;
            sim_config.scenario.cellsets.Add(cs);
            cs               = new CellSet();
            cs.cell_name     = "Generic motile tcell";
            cs.cell_type_ref = sim_config.entity_repository.cell_types[1].cell_type_name;
            cs.number        = 200;
            cs.cells_constrained_to_region = true;
            cs.region_name_ref             = sim_config.scenario.regions[1].region_name;
            cs.wrt_region = RelativePosition.Outside;
            sim_config.scenario.cellsets.Add(cs);

            // Solfacs
            Solfac solfac = new Solfac();

            solfac.solfac_name     = "Gauss";
            solfac.solfac_type_ref = sim_config.entity_repository.solfac_types[0].solfac_type_name;
            SolfacGaussianGradient sgg = new SolfacGaussianGradient();

            sgg.gaussian_spec_name_ref = sim_config.entity_repository.gaussian_gradients[0].gaussian_spec_name;
            solfac.solfac_distribution = sgg;
            sim_config.scenario.solfacs.Add(solfac);
            solfac             = new Solfac();
            solfac.solfac_name = "Lin";
            SolfacLinearGradient sll = new SolfacLinearGradient();

            sll.min_concentration         = 20;
            sll.max_concentration         = 150;
            solfac.solfac_distribution    = sll;
            solfac.solfac_type_ref        = sim_config.entity_repository.solfac_types[1].solfac_type_name;
            solfac.solfac_is_time_varying = false;
            sim_config.scenario.solfacs.Add(solfac);
            solfac                        = new Solfac();
            solfac.solfac_name            = "Homog";
            solfac.solfac_type_ref        = sim_config.entity_repository.solfac_types[1].solfac_type_name;
            solfac.solfac_is_time_varying = true;
            solfac.solfac_amplitude_keyframes.Add(new TimeAmpPair(0, 1));
            sim_config.scenario.solfacs.Add(solfac);

            // Write out XML file
            config.SerializeSimConfigToFile();
        }
        public void CreateAndSerializeScenario()
        {
            var config = new SimConfigurator(filename);
            var sim_config = config.SimConfig;

            // Experiment
            sim_config.experiment_name = "Test experiment for XML serialization";
            sim_config.scenario.time_config.duration = 100;
            sim_config.scenario.time_config.timestep = 3;

            // Global Paramters
            sim_config.LoadDefaultGlobalParameters();

            // Entity Repository
            EntityRepository repository = new EntityRepository();
            // Possible solfac types
            SolfacType st = new SolfacType();
            st.solfac_type_name = "ccr7";
            repository.solfac_types.Add(st);
            st = new SolfacType();
            st.solfac_type_name = "cxcl13";
            repository.solfac_types.Add(st);
            // Possible cell types
            CellType ct = new CellType();
            ct.cell_type_name = "bcell";
            ct.LoadDefaultMotileCellParams();
            repository.cell_types.Add(ct);
            ct = new CellType();
            ct.cell_type_name = "tcell";
            ct.LoadDefaultMotileCellParams();
            repository.cell_types.Add(ct);
            sim_config.entity_repository = repository;
            // Gaussian Gradients
            GaussianSpecification gg = new GaussianSpecification();
            gg.gaussian_spec_name = "Default on-center gradient";
            sim_config.entity_repository.gaussian_gradients.Add(gg);

            // Regions (not part of repository right now...)
            sim_config.scenario.regions.Add(new Region("Sphere", RegionShape.Ellipsoid));
            sim_config.scenario.regions.Add(new Region("Cube", RegionShape.Rectangular));

            // Cells
            CellSet cs = new CellSet();
            cs.cell_name = "Generic motile bcell";
            cs.cell_type_ref = sim_config.entity_repository.cell_types[0].cell_type_name;
            cs.number = 200;
            cs.cells_constrained_to_region = true;
            cs.region_name_ref = sim_config.scenario.regions[0].region_name;
            cs.wrt_region = RelativePosition.Inside;
            sim_config.scenario.cellsets.Add(cs);
            cs = new CellSet();
            cs.cell_name = "Generic motile tcell";
            cs.cell_type_ref = sim_config.entity_repository.cell_types[1].cell_type_name;
            cs.number = 200;
            cs.cells_constrained_to_region = true;
            cs.region_name_ref = sim_config.scenario.regions[1].region_name;
            cs.wrt_region = RelativePosition.Outside;
            sim_config.scenario.cellsets.Add(cs);

            // Solfacs
            Solfac solfac = new Solfac();
            solfac.solfac_name = "Gauss";
            solfac.solfac_type_ref = sim_config.entity_repository.solfac_types[0].solfac_type_name;
            SolfacGaussianGradient sgg = new SolfacGaussianGradient();
            sgg.gaussian_spec_name_ref = sim_config.entity_repository.gaussian_gradients[0].gaussian_spec_name;
            solfac.solfac_distribution = sgg;
            sim_config.scenario.solfacs.Add(solfac);
            solfac = new Solfac();
            solfac.solfac_name = "Lin";
            SolfacLinearGradient sll = new SolfacLinearGradient();
            sll.min_concentration = 20;
            sll.max_concentration = 150;
            solfac.solfac_distribution = sll;
            solfac.solfac_type_ref = sim_config.entity_repository.solfac_types[1].solfac_type_name;
            solfac.solfac_is_time_varying = false;
            sim_config.scenario.solfacs.Add(solfac);
            solfac = new Solfac();
            solfac.solfac_name = "Homog";
            solfac.solfac_type_ref = sim_config.entity_repository.solfac_types[1].solfac_type_name;
            solfac.solfac_is_time_varying = true;
            solfac.solfac_amplitude_keyframes.Add(new TimeAmpPair(0, 1));
            sim_config.scenario.solfacs.Add(solfac);

            // Write out XML file
            config.SerializeSimConfigToFile();
        }