Esempio n. 1
0
        public object Clone()
        {
            var res = new InitialStates();

            res._MTs         = new List <MtRecord>(_MTs);
            res._chromosomes = new List <ChromosomeRecord>(_chromosomes);
            return(res);
        }
Esempio n. 2
0
        public object Clone()
        {
            var res = new LaunchParameters();

            if (Args != null)
            {
                res.Args = Args.Clone() as CliArgs;
            }
            if (Config != null)
            {
                res.Config = Config.Clone() as SimParams;
            }
            if (InitialStates != null)
            {
                res.InitialStates = InitialStates.Clone() as InitialStates;
            }
            if (PoleCoords != null)
            {
                res.PoleCoords = PoleCoords.Clone() as PoleCoordinates;
            }

            return(res);
        }
Esempio n. 3
0
        internal String Apply(String workingDir)
        {
            if (Args == null)
            {
                throw new ApplicationException("Cannot launch simulation without CLI arguments");
            }

            CliArgs defaultArgs    = new CliArgs();
            String  oldCellFile    = Args.CellFile;
            bool    needCellFile   = Args.Mode != LaunchMode.Help && Args.Mode != LaunchMode.Info;
            String  oldConfig      = Args.ConfigFile;
            bool    needConfig     = Args.Mode == LaunchMode.New || Args.Mode == LaunchMode.Continue || Args.Mode == LaunchMode.Restart;
            String  oldInitialFile = Args.InitialConditionsFile;
            String  oldPoleFile    = Args.PoleCoordsFile;

            try
            {
                //Settings file for results.
                if (needCellFile || Args.CellFile != defaultArgs.CellFile)
                {
                    Args.CellFile = ExtractFilename(workingDir, oldCellFile);
                }
                if (Args.Mode == LaunchMode.Fix)
                {
                    return(Args.Export());
                }

                //Storing config.
                if (needConfig || Args.ConfigFile != defaultArgs.ConfigFile)
                {
                    if (Config == null)
                    {
                        throw new ApplicationException("Cannot launch simulation without config");
                    }
                    if (String.IsNullOrEmpty(Args.ConfigFile))
                    {
                        Args.ConfigFile = "mitosis.conf";
                    }
                    Args.ConfigFile = ExtractFilename(workingDir, oldConfig);
                    File.WriteAllText(Args.ConfigFile, Config.ExportAsProps());
                }

                //Storing initial states.
                if (InitialStates != null)
                {
                    if (String.IsNullOrEmpty(Args.InitialConditionsFile))
                    {
                        Args.InitialConditionsFile = "initial.xml";
                    }
                    Args.InitialConditionsFile = ExtractFilename(workingDir, Args.InitialConditionsFile);
                    File.WriteAllText(Args.InitialConditionsFile, InitialStates.ToString());
                }

                //Storing information about poles.
                if (PoleCoords != null)
                {
                    if (String.IsNullOrEmpty(Args.PoleCoordsFile))
                    {
                        Args.PoleCoordsFile = "poles.xml";
                    }
                    Args.PoleCoordsFile = ExtractFilename(workingDir, Args.PoleCoordsFile);
                    File.WriteAllText(Args.PoleCoordsFile, PoleCoords.ToString());
                }

                //Done, exporting.
                return(Args.Export());
            }
            finally
            {
                Args.CellFile              = oldCellFile;
                Args.ConfigFile            = oldConfig;
                Args.InitialConditionsFile = oldInitialFile;
                Args.PoleCoordsFile        = oldPoleFile;
            }
        }