コード例 #1
0
        internal static void ExampleAutoSetup()
        {
            FuncCallBack2 oFunc2 = FunctionCallback2;
            StpntCallBack oStpnt = StpntCallback;
            BcndCallBack  oBcnd  = BoundaryCallback;

            AutoInterface.SetAutoNumParameters(36);
            AutoInterface.setCallbackFunc2(oFunc2);
            AutoInterface.setCallbackStpnt(oStpnt);
            AutoInterface.setCallbackBcnd(oBcnd);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            FuncCallBack2 oFunc2 = new FuncCallBack2(FunctionCallback2);
            StpntCallBack oStpnt = new StpntCallBack(StpntCallback);
            BcndCallBack  oBcnd  = new BcndCallBack(BoundaryCallback);


            //AutoInterface.SetAutoNumParameters(36);
            AutoInterface.setCallbackFunc2(oFunc2);
            AutoInterface.setCallbackStpnt(oStpnt);
            AutoInterface.setCallbackBcnd(oBcnd);
            //AutoInterface.setFort2File(global::AutoTorCSharp.Properties.Resources.fort, global::AutoTorCSharp.Properties.Resources.fort.Length);
            AutoInterface.CallAuto();

            int    nLength = 0;
            string sResult = AutoInterface.getFort7File(out nLength);

            Console.WriteLine(sResult);
            //Console.WriteLine("done!");
        }
コード例 #3
0
        internal void SetupUsingModel(IModel oCurrentModel)
        {
            if (oCurrentModel == null)
            {
                throw new ArgumentNullException("oCurrentModel", "Need to load SBML file first.");
            }

            setupControl1.CurrentConfig.NDIM = oCurrentModel.y.Length;

            _InitializationCallBack = ModelInitializationCallback;
            _FunctionCallBack       = ModelFunctionCallback;
            //_BCNDCallBack = new BcndCallBack(ModelBcndCallBack);
            //_IcndCallBack = new IcndCallBack(ModelIcndCallBack);
            //_FoptCallBack = new FoptCallBack(ModelFoptCallBack);
            //_PvlsCallBack = new PvlsCallBack(ModelPvlsCallBack);


            AutoInterface.setCallbackStpnt(_InitializationCallBack);
            AutoInterface.setCallbackFunc2(_FunctionCallBack);
            //AutoInterface.setCallbackBcnd(_BCNDCallBack);
            //AutoInterface.setCallbackIcnd(_IcndCallBack);
            //AutoInterface.setCallbackFopt(_FoptCallBack);
            //AutoInterface.setCallbackPvls(_PvlsCallBack);
        }
コード例 #4
0
        private void RunContinuationForTripple(IntTripple tripple)
        {
            try
            {
                if (SBML == null || SBML.Length == 0)
                {
                    return;
                }

                string fort8 = AutoResult.NewFort8; //.Replace(" 7 ", " 12 ");
                //string fort7 = AutoResult.NewFort7;

                ResetAuto();

                setupControl1.RunContinuation = true;
                setupControl1.Label           = tripple.Value1;

                string originalConfig = setupControl1.CurrentConfig.ToInputString();

                //setupControl1.CurrentConfig.IPS = 2;
                setupControl1.CurrentConfig.IRS = tripple.Value1;
                //setupControl1.CurrentConfig.ILP = 1;

                setupControl1.CurrentConfig.NICP = 2;
                setupControl1.CurrentConfig.ICP.Clear();
                setupControl1.CurrentConfig.ICP.Add(0);
                setupControl1.CurrentConfig.ICP.Add(10);

                //setupControl1.CurrentConfig.NCOL = 4;
                //setupControl1.CurrentConfig.IAD = 3;
                //setupControl1.CurrentConfig.ISP = 1;
                //setupControl1.CurrentConfig.ISW = 1;

                setupControl1.CurrentConfig.MXBF = 10;

                setupControl1.CurrentConfig.NTHL = 1;
                setupControl1.CurrentConfig.THL.Add(new IntDoublePair(10, 0));

                txtConfig.Text = setupControl1.Configuration;

                SetupAuto();

                AutoInterface.setFort2File(txtConfig.Text, txtConfig.Text.Length);

                AutoInterface.setFort3File(fort8, fort8.Length);

                if (setupControl1.CurrentConfig.IPS != 1)
                {
                    if (
                        MessageBox.Show(
                            "Currently only IPS = 1 is supported, any other value will make the library unstable. It is recommendet that you Quit (yes).",
                            "Unsupported Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        return;
                    }
                }


                AutoInterface.CallAuto();
                string lastMessage = AutoInterface.GetLastMessage();

                //fort7 = fort7 + AutoResult.NewFort7;
                //AutoInterface.setFort7File(fort7, fort7.Length);

                fort8 = fort8 + AutoResult.NewFort8;
                AutoInterface.setFort8File(fort8, fort8.Length);

                CurrentResult  = new AutoResult();
                txtResult.Text = CurrentResult.Fort7;

                RemoveWartermark();
                if (CurrentResult.ErrorOccured && CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Auto\ndid not\nreturn\nresults.");
                }
                else if (CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Not\nenough\npoints\nreturned.");
                }


                setupControl1.CurrentConfig = AutoInputConstants.FromContent(originalConfig);


                if (!string.IsNullOrEmpty(lastMessage))
                {
                    RemoveWartermark();
                    AddWaterMark(lastMessage);
                    return;
                }


                PlotResults(CurrentResult);


                if (setupControl1.ReloadAfterRun)
                {
                    try
                    {
                        //Simulator.loadSBML(SBML);
                        cmdSendToAuto_Click(this, EventArgs.Empty);
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "An Error occured while running Auto", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        internal void RunAuto()
        {
            Cursor originalCursor = Cursor;

            try
            {
                Cursor = Cursors.WaitCursor;

                if (string.IsNullOrEmpty(SBML))
                {
                    OpenSBML();
                }

                ResetAuto();
                setupControl1.RunContinuation = false;
                SetupAuto();


                AutoInterface.setFort2File(txtConfig.Text, txtConfig.Text.Length);

                if (setupControl1.CurrentConfig.IPS != 1)
                {
                    if (
                        MessageBox.Show(
                            "Currently only IPS = 1 is supported, any other value will make the library unstable. It is recommendet that you Quit (yes).",
                            "Unsupported Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        return;
                    }
                }


                AutoInterface.CallAuto();

                CurrentResult  = new AutoResult();
                txtResult.Text = CurrentResult.Fort7;

                RemoveWartermark();
                if (CurrentResult.ErrorOccured)
                {
                    AddWaterMark("Auto\ndid not\nreturn\nresults.");
                }
                else if (CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Not\nenough\npoints\nreturned.");
                }

                PlotResults(CurrentResult);


                //if (setupControl1.ReloadAfterRun)
                //{
                //    try
                //    {
                //        //Simulator.loadSBML(SBML);
                //        cmdSendToAuto_Click(this, EventArgs.Empty);
                //    }
                //    catch (Exception)
                //    {
                //        //
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "An Error occured while running Auto", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = originalCursor;
            }
        }