示例#1
0
        static void Main(string[] args)
        {
            List <string> listcap = new List <string>()
            {
                "Paris",
                "Madrid",
                "Londres",
                "Rome",
                "Genève",
                "Dublin",
                "Moscou",
                "Zurich",
                "Prague"
            }; dl belvedere = (chaine, capitale) =>

            {
                Console.WriteLine("Capitales contenant '" + chaine + "'.");
                foreach (string contain in capitale)
                {
                    if (contain.ToUpper().Contains(chaine.ToUpper()))
                    {
                        Console.WriteLine(contain);
                    }
                }
            };
            Console.WriteLine("Rentrez la chaîne que doivent contenir les capitales :");
            belvedere(Console.ReadLine(), listcap);
        }
示例#2
0
 public ct_data_s(ushort x, ushort y)
 {
     dl      = default;
     fc.freq = x;
     fc.code = y;
     // TODO: Unsafe.SkipInit
 }
示例#3
0
 public void b()
 {
     GC.SuppressFinalize(this);
     this.a();
     this.az.Clear();
     this.n   = null;
     this.ag  = null;
     this.au  = null;
     this.at  = null;
     this.@as = null;
     this.ar  = null;
     this.aq  = null;
     this.ap  = null;
     this.ao  = null;
     this.an  = null;
     this.am  = null;
     this.al  = null;
     this.ak  = null;
     this.aj  = null;
     this.ai  = null;
     this.ah  = null;
     this.af  = null;
     this.ae  = null;
     this.ad  = null;
     this.ac  = null;
     this.ab  = null;
     this.aa  = null;
     this.z   = null;
     this.y   = null;
     this.x   = null;
     this.w   = null;
     this.v   = null;
     this.u   = null;
     this.t   = null;
     this.s   = null;
     this.r   = null;
     this.q   = null;
     this.p   = null;
     this.c   = null;
     this.av  = null;
     this.o   = null;
     this.m   = null;
     this.l   = null;
     this.k   = null;
     this.j   = null;
     this.i   = null;
     this.h   = null;
     this.g   = null;
     this.f   = null;
     this.e   = null;
     this.d   = null;
     this.b   = null;
     this.a   = null;
     this.aw  = null;
     this.ax  = null;
     this.ay  = null;
 }
示例#4
0
文件: Classlogin.cs 项目: lanhaiyin/-
 public void dlz(Form fr, Form zhuye, dl dl)
 {
     tcdx = sjk.Select("select*from glyb");
     for (int i = 0; i < tcdx.Rows.Count; i++)
     {
         if (tcdx.Rows[i]["glyzh"].ToString() == dl.zh)
         {
             if (tcdx.Rows[i]["glymm"].ToString() != dl.mm)
             {
                 MessageBox.Show("密码错误!");
                 return;
             }
             dlshuju.dlzh = dl.zh;
             dlshuju.dlmm = dl.mm;
             dlshuju.qx   = int.Parse(tcdx.Rows[i]["qx"].ToString());
             zhuye.Show();
             fr.Hide();
             return;
         }
     }
     MessageBox.Show("帐号错误!");
     return;
 }
示例#5
0
        public int tj(dl dl, int row, DataGridView dg)
        {
            DataTable tcdx = new DataTable();

            tcdx = sjk.Select("select * from glyb");
            for (int i = 0; i < tcdx.Rows.Count; i++)
            {
                if (tcdx.Rows[i][0].ToString() == dl.zh)
                {
                    MessageBox.Show("帐号已被使用,请重新输入!");
                    dg.Rows.Add();
                    dg.Rows[row].Cells[0].Value = dl.zh;
                    dg.Rows[row].Cells[1].Value = dl.mm;
                    dg.Rows[row].Cells[2].Value = dl.xm;
                    dg.Rows[row].Cells[3].Value = dl.qx;
                    dg.Rows[row].Cells[4].Value = "失败";
                    row++;
                    return(row);
                }
            }

            sjk.AddParameters("@glyzh", SqlDbType.VarChar, dl.zh);
            sjk.AddParameters("@glymm", SqlDbType.VarChar, dl.mm);
            sjk.AddParameters("@glyxm", SqlDbType.VarChar, dl.xm);
            sjk.AddParameters("@glyqx", SqlDbType.Int, dl.qx);
            sjk.Insert("insert into glyb values(@glyzh,@glymm,@glyxm,@glyqx,1)");
            MessageBox.Show("帐号添加成功!");
            dg.Rows.Add();
            dg.Rows[row].Cells[0].Value = dl.zh;
            dg.Rows[row].Cells[1].Value = dl.mm;
            dg.Rows[row].Cells[2].Value = dl.xm;
            dg.Rows[row].Cells[3].Value = dl.qx;
            dg.Rows[row].Cells[4].Value = "成功";
            row++;
            return(row);
        }
示例#6
0
        public void xg(dl dl, int sum, DataGridView dg)
        {
            bool      t  = true;
            DataTable dt = new DataTable();

            dt = db.Select("SELECT * FROM glyb where zt=1");
            db.AddParameters("@zh", SqlDbType.VarChar, dt.Rows[sum][0]);
            db.AddParameters("@glymm", SqlDbType.VarChar, dl.mm);
            db.AddParameters("@glyxm", SqlDbType.VarChar, dl.xm);
            db.AddParameters("@qx", SqlDbType.VarChar, dl.qx);
            db.AddParameters("@glyzh", SqlDbType.VarChar, dl.zh);
            t = db.Up("update glyb set glyzh=@glyzh  where glyzh=@zh");
            if (t == false)
            {
                MessageBox.Show("此帐号已存在,修改失败");
                db.clear();
                return;
            }
            db.Up("update glyb set glymm=@glymm  where glyzh=@glyzh");
            db.Up("update glyb set glyxm=@glyxm  where glyzh=@glyzh");
            db.Up("update glyb set qx=@qx  where glyzh=@glyzh");
            db.clear();
            MessageBox.Show("用户修改成功!");
        }
示例#7
0
        /// <summary>
        /// initialize
        /// </summary>
        public Form1()
        {
            InitializeComponent();
            #region hide
            /*temp test*/
            //Calculator.GetRealCount(5, new DateTime(2015, 1, 1, 12, 38, 0), new DateTime(2015, 1, 1, 14, 38, 0));
            //Calculator.GetAvgCount(5, new DateTime(2015, 1, 1, 12, 38, 0), new DateTime(2015, 1, 1, 14, 38, 0));
            #endregion
            //start logger thread
            logt = new Thread(new ThreadStart(LogThread));
            logt.Start();

            try
            {
                pipoints = ((string)(new AppSettingsReader()).GetValue("pipoint", typeof(string))).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                PointListBox.Items.AddRange(pipoints);
                plantid = int.Parse((string)(new AppSettingsReader()).GetValue("plantid", typeof(string)));
            }
            catch (Exception ex)
            {
                //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "---" + ex.Message);
                ExceptionBody eb = new ExceptionBody() { et = ExceptionType.Error, info = "Initialization?" + ex.Message, ts = DateTime.Now };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
            }

            if ((PointListBox.Items.Count == 0) || (pipoints.Length == 0))
            {
                InvalidControls();
                ExceptionBody eb = new ExceptionBody() { et = ExceptionType.Warning, info = "Initialization?" + "配置文件中没有找到PI计量点", ts = DateTime.Now };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
                MessageBox.Show("配置文件中没有找到PI计量点");
                return;
            }
            if (plantid == null)
            {
                InvalidControls();
                ExceptionBody eb = new ExceptionBody() { et = ExceptionType.Warning, info = "Initialization?" + "未能初始化plantid", ts = DateTime.Now };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
                MessageBox.Show("未能初始化plantid, 检查配置文件");
                return;
            }

            //connect pi
            new PI.PIFunc2((string)(new AppSettingsReader()).GetValue("ip", typeof(string)), (string)(new AppSettingsReader()).GetValue("username", typeof(string)), (string)(new AppSettingsReader()).GetValue("password", typeof(string)));
            //connect sql
            {
                //no special initialization
            }
            //backgroudworker init
            {
                bgw.DoWork += Bgw_DoWork;
                bgw.ProgressChanged += Bgw_ProgressChanged;
                bgw.RunWorkerCompleted += Bgw_RunWorkerCompleted;
                bgw.WorkerReportsProgress = true;
                bgw.WorkerSupportsCancellation = true;
                desktopdl += updatedesktop;
                UpdateprogressBar.Style = ProgressBarStyle.Blocks;
            }
            //other init
            {
                closedl += closeform;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                this.FormClosing += Form1_FormClosing;
            }
            //machine time delay

            for (int i = 1; i < 10; i++)
            {
                try
                {
                    string[] machineinfo = ((string)(new AppSettingsReader()).GetValue("machinedelay_" + i.ToString(), typeof(string))).Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach(string point in machineinfo[1].Split(','))
                    {
                        if(pointdelay.ContainsKey(point))
                        {
                            pointdelay[point].delay = int.Parse(machineinfo[0]);
                            pointdelay[point].machineid = i;
                        }
                        else
                        {
                            pointdelay.Add(point, new PointInfo()
                            {
                                delay = int.Parse(machineinfo[0]),
                                machineid = i
                            });
                        }
                    }
                }
                catch(Exception ex)
                {

                }
            }

            StartValid();
        }
示例#8
0
        /// <summary>
        /// initialize
        /// </summary>
        public Form1()
        {
            InitializeComponent();
            #region hide
            /*temp test*/
            //Calculator.GetRealCount(5, new DateTime(2015, 1, 1, 12, 38, 0), new DateTime(2015, 1, 1, 14, 38, 0));
            //Calculator.GetAvgCount(5, new DateTime(2015, 1, 1, 12, 38, 0), new DateTime(2015, 1, 1, 14, 38, 0));
            #endregion
            //start logger thread
            logt = new Thread(new ThreadStart(LogThread));
            logt.Start();

            try
            {
                pipoints = ((string)(new AppSettingsReader()).GetValue("pipoint", typeof(string))).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                PointListBox.Items.AddRange(pipoints);
                plantid = int.Parse((string)(new AppSettingsReader()).GetValue("plantid", typeof(string)));
            }
            catch (Exception ex)
            {
                //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "---" + ex.Message);
                ExceptionBody eb = new ExceptionBody()
                {
                    et = ExceptionType.Error, info = "Initialization?" + ex.Message, ts = DateTime.Now
                };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
            }

            if ((PointListBox.Items.Count == 0) || (pipoints.Length == 0))
            {
                InvalidControls();
                ExceptionBody eb = new ExceptionBody()
                {
                    et = ExceptionType.Warning, info = "Initialization?" + "配置文件中没有找到PI计量点", ts = DateTime.Now
                };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
                MessageBox.Show("配置文件中没有找到PI计量点");
                return;
            }
            if (plantid == null)
            {
                InvalidControls();
                ExceptionBody eb = new ExceptionBody()
                {
                    et = ExceptionType.Warning, info = "Initialization?" + "未能初始化plantid", ts = DateTime.Now
                };
                (new PublicLib.Log()).AddExceptionLog(eb, logtype.console);
                MessageBox.Show("未能初始化plantid, 检查配置文件");
                return;
            }

            //connect pi
            new PI.PIFunc2((string)(new AppSettingsReader()).GetValue("ip", typeof(string)), (string)(new AppSettingsReader()).GetValue("username", typeof(string)), (string)(new AppSettingsReader()).GetValue("password", typeof(string)));
            //connect sql
            {
                //no special initialization
            }
            //backgroudworker init
            {
                bgw.DoWork                    += Bgw_DoWork;
                bgw.ProgressChanged           += Bgw_ProgressChanged;
                bgw.RunWorkerCompleted        += Bgw_RunWorkerCompleted;
                bgw.WorkerReportsProgress      = true;
                bgw.WorkerSupportsCancellation = true;
                desktopdl += updatedesktop;
                UpdateprogressBar.Style = ProgressBarStyle.Blocks;
            }
            //other init
            {
                closedl += closeform;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                this.FormClosing    += Form1_FormClosing;
            }
            //machine time delay

            for (int i = 1; i < 10; i++)
            {
                try
                {
                    string[] machineinfo = ((string)(new AppSettingsReader()).GetValue("machinedelay_" + i.ToString(), typeof(string))).Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string point in machineinfo[1].Split(','))
                    {
                        if (pointdelay.ContainsKey(point))
                        {
                            pointdelay[point].delay     = int.Parse(machineinfo[0]);
                            pointdelay[point].machineid = i;
                        }
                        else
                        {
                            pointdelay.Add(point, new PointInfo()
                            {
                                delay     = int.Parse(machineinfo[0]),
                                machineid = i
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }

            StartValid();
        }
示例#9
0
 public ev(CoreManager A_0, PluginHost A_1, PluginCore A_2)
 {
     this.aw = A_0;
     this.ax = A_1;
     this.ay = A_2;
     this.a  = new b2(this.ay);
     this.az.Add(this.a);
     this.b = new j();
     this.az.Add(this.b);
     this.d = new aj();
     this.az.Add(this.d);
     this.e = new cd((FileService)this.aw.get_FileService(), this);
     this.az.Add(this.e);
     this.f = new d6();
     this.az.Add(this.f);
     this.g = new dv(this);
     this.az.Add(this.g);
     this.z = new s(this.aw);
     this.az.Add(this.z);
     this.h = new cs(this);
     this.az.Add(this.h);
     this.i = new dg(this);
     this.az.Add(this.i);
     this.j = new dl(this);
     this.az.Add(this.j);
     this.k = new eo(this);
     this.az.Add(this.k);
     this.l = new bh();
     this.az.Add(this.l);
     this.m = new fq();
     this.az.Add(this.m);
     this.o = new bw();
     this.az.Add(this.o);
     this.c = new cLogic(this.g, this.ay, this.z);
     this.az.Add(this.c);
     this.p = new cj(new cj.a(ad.a), A_1.get_Actions());
     this.az.Add(this.p);
     this.q = new b5(this.aw, this.ay);
     this.az.Add(this.q);
     this.r = new cz(this.ay, this.aw, this.ax, this.p);
     this.az.Add(this.r);
     this.s = new ag();
     this.az.Add(this.s);
     this.t = new fc(this.aw, this.ay);
     this.az.Add(this.t);
     this.u = new b0(this.aw, this.ay, this.p);
     this.az.Add(this.u);
     this.v = new el(this.aw);
     this.az.Add(this.v);
     this.w = new bd();
     this.az.Add(this.w);
     this.x = new bv(this.aw);
     this.az.Add(this.x);
     this.y = new a7(this.aw);
     this.az.Add(this.y);
     this.n = new fn(this.aw, this.p);
     this.az.Add(this.n);
     this.aa = new d0(this.aw);
     this.az.Add(this.aa);
     this.ab = new da(this.p, this.ay);
     this.az.Add(this.ab);
     this.ac = new bj();
     this.az.Add(this.ac);
     this.ad = new fs();
     this.az.Add(this.ad);
     this.ae = new b9();
     this.az.Add(this.ae);
     this.af = new en();
     this.az.Add(this.af);
     this.ah = new e0();
     this.az.Add(this.ah);
     this.ai = new ar();
     this.az.Add(this.ai);
     this.aj = new y(this.ai);
     this.az.Add(this.aj);
     this.ak = new cRechargeManager();
     this.az.Add(this.ak);
     this.al = new q();
     this.az.Add(this.al);
     this.am = new fr();
     this.az.Add(this.am);
     this.an = new ei(this.g, this.p);
     this.az.Add(this.an);
     this.ao = new ca(this.x, this.an);
     this.az.Add(this.ao);
     this.ap = new cr(this.ay);
     this.az.Add(this.ap);
     this.aq = new bp();
     this.az.Add(this.aq);
     this.ar = new ay(this.p);
     this.az.Add(this.ar);
     this.@as = new h();
     this.az.Add(this.@as);
     this.at = new du();
     this.az.Add(this.at);
     this.au = new ac();
     this.az.Add(this.au);
     this.ag = new cc();
     this.az.Add(this.ag);
 }
示例#10
0
        public void precompute(dl tup)
        {
            //Assume M[0] and M[1] are precomputed,

            //double[][,] M=new double[2][,];
            //M[0]=fM(uNum,_uDim,_uDim-1,uKnot);
            //M[1]=fM(vNum,_vDim,_vDim-1,vKnot);
            tup.internalIndex = this.index;
            tup.nNode         = nDV / 3;
            tup.elemDim       = elemDim;
            tup.shape         = new double[__DIM, nDV];                   //Global coordinate *coefficient*
            tup.C             = new double[elemDim, __DIM, nDV];          //Base vectors *coefficient*
            tup.B             = new double[elemDim, elemDim, nDV, nDV];   //Metric *coefficient*
            tup.D             = new double[elemDim, elemDim, __DIM, nDV]; //Hessian coefficient
            tup.d0            = new double[nDV / 3];
            tup.d1            = new double[elemDim][];
            tup.d2            = new double[elemDim, elemDim][];
            for (int i = 0; i < elemDim; i++)
            {
                tup.d1[i] = new double[nDV / 3];
            }
            for (int i = 0; i < elemDim; i++)
            {
                for (int j = 0; j < elemDim; j++)
                {
                    tup.d2[i, j] = new double[nDV / 3];
                }
            }

            //Shape functions  [N] (for global coordinate)
            double t = tup.lo;

            for (int k = 0; k < dim; k++)
            {
                hh[k] = Math.Pow(t, (dim - k - 1));
            }
            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int j = 0; j < __DIM; j++)
            {
                for (int k = 0; k < nDV; k++)
                {
                    tup.shape[j, k] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //Shape functinos
                double shape = 1.0;
                shape *= tt[dd[k]];
                for (int j = 0; j < __DIM; j++)
                {
                    tup.shape[j, k *__DIM + j] = shape;
                }
            }
            //Create [C]  (for base vectors)
            t = tup.lo;
            {
                for (int k = 0; k < dim - 1; k++)
                {
                    hh[k] = (dim - k - 1) * Math.Pow(t, (dim - k - 2));
                }
                hh[dim - 1] = 0;
            }
            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int jj = 0; jj < __DIM; jj++)
            {
                for (int j = 0; j < nDV; j++)
                {
                    tup.C[0, jj, j] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //[C]
                double C = 1.0;
                for (int j = 0; j < elemDim; j++)
                {
                    C *= tt[dd[k]];
                }
                for (int j = 0; j < __DIM; j++)
                {
                    tup.C[0, j, k *__DIM + j] = C;
                }
            }
            //Create [B]  (for metric)
            tup.CtoB(elemDim, nDV);
            //Create [D] (for second derivative)
            t = tup.lo;
            for (int k = 0; k < dim - 1; k++)
            {
                hh[k] = (dim - k - 1) * (dim - k - 2) * Math.Pow(t, (dim - k - 3));
            }
            hh[dim - 1] = 0;
            hh[dim - 2] = 0;

            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int jj = 0; jj < __DIM; jj++)
            {
                for (int j = 0; j < nDV; j++)
                {
                    tup.D[0, 0, jj, j] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //[D]
                double D = 1.0;
                D *= tt[dd[k]];
                for (int j = 0; j < __DIM; j++)
                {
                    tup.D[0, 0, j, k *__DIM + j] = D;
                }
            }
            compute(tup);
        }
示例#11
0
        public void compute(dl tup)
        {
            //Global position
            double X = 0, Y = 0, Z = 0;

            for (int i = 0; i < nDV; i++)
            {
                X += tup.shape[0, i] * node[i];
                Y += tup.shape[1, i] * node[i];
                Z += tup.shape[2, i] * node[i];
            }
            tup.x = X;
            tup.y = Y;
            tup.z = Z;
            //covariant base vectors
            double fx = 0, fy = 0;

            for (int i = 0; i < nDV; i++)
            {
                fx += tup.C[0, 0, i] * node[i];
                fy += tup.C[0, 1, i] * node[i];
            }
            tup.gi[0][0]  = fx;
            tup.gi[0][1]  = fy;
            tup.gi[0][2]  = 0;
            tup.gij[0, 0] = tup.gi[0][0] * tup.gi[0][0] + tup.gi[0][1] * tup.gi[0][1] + tup.gi[0][2] * tup.gi[0][2];
            if (elemDim == 1)
            {
                _inv1(tup.gij, tup.Gij);
            }
            else if (elemDim == 2)
            {
                _inv2(tup.gij, tup.Gij);
            }
            else if (elemDim == 3)
            {
                _inv3(tup.gij, tup.Gij);
            }
            if (elemDim == 1)
            {
                tup.dv = Math.Sqrt(_det1(tup.gij));
            }
            else if (elemDim == 2)
            {
                tup.dv = Math.Sqrt(_det2(tup.gij));
            }
            else if (elemDim == 3)
            {
                tup.dv = Math.Sqrt(_det3(tup.gij));
            }
            tup.refDv = tup.dv;

            //contravatiant base vectors
            double Fx = 0, Fy = 0;

            Fx          += tup.gi[0][0] * tup.Gij[0, 0];
            Fy          += tup.gi[0][1] * tup.Gij[0, 0];
            tup.Gi[0][0] = Fx;
            tup.Gi[0][1] = Fy;
            tup.Gi[0][2] = 0;
            //Create gradient of hessian with computed connection coefficients
            for (int k = 0; k < nNode; k++)
            {
                tup.d2[0, 0][k] = tup.D[0, 0, 2, k *__DIM + 2];
            }
            for (int k = 0; k < nNode; k++)
            {
                tup.d1[0][k] = tup.C[0, 2, k *__DIM + 2];
            }
            for (int k = 0; k < nNode; k++)
            {
                tup.d0[k] = tup.shape[2, k *__DIM + 2];
            }
        }
示例#12
0
        public void precompute(dl tup)
        {
            //Assume M[0] and M[1] are precomputed,

            //double[][,] M=new double[2][,];
            //M[0]=fM(uNum,_uDim,_uDim-1,uKnot);
            //M[1]=fM(vNum,_vDim,_vDim-1,vKnot);
            tup.internalIndex = this.index;
            tup.nNode = nDV / 3;
            tup.elemDim = elemDim;
            tup.shape = new double[__DIM, nDV];                        //Global coordinate *coefficient*
            tup.C = new double[elemDim, __DIM, nDV];                //Base vectors *coefficient*
            tup.B = new double[elemDim, elemDim, nDV, nDV];          //Metric *coefficient*
            tup.D = new double[elemDim, elemDim, __DIM, nDV];   //Hessian coefficient
            tup.d0 = new double[nDV / 3];
            tup.d1 = new double[elemDim][];
            tup.d2 = new double[elemDim, elemDim][];
            for (int i = 0; i < elemDim; i++)
            {
                tup.d1[i] = new double[nDV / 3];
            }
            for (int i = 0; i < elemDim; i++)
            {
                for (int j = 0; j < elemDim; j++)
                {
                    tup.d2[i, j] = new double[nDV / 3];
                }
            }

            //Shape functions  [N] (for global coordinate)
            double t = tup.lo;
            for (int k = 0; k < dim; k++)
            {
                hh[k] = Math.Pow(t, (dim - k - 1));
            }
            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int j = 0; j < __DIM; j++)
            {
                for (int k = 0; k < nDV; k++)
                {
                    tup.shape[j, k] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //Shape functinos
                double shape = 1.0;
                shape *= tt[dd[k]];
                for (int j = 0; j < __DIM; j++)
                {
                    tup.shape[j, k * __DIM + j] = shape;
                }
            }
            //Create [C]  (for base vectors)
            t = tup.lo;
            {
                for (int k = 0; k < dim - 1; k++)
                {
                    hh[k] = (dim - k - 1) * Math.Pow(t, (dim - k - 2));
                }
                hh[dim - 1] = 0;
            }
            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int jj = 0; jj < __DIM; jj++)
            {
                for (int j = 0; j < nDV; j++)
                {
                    tup.C[0, jj, j] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //[C]
                double C = 1.0;
                for (int j = 0; j < elemDim; j++)
                {
                    C *= tt[dd[k]];
                }
                for (int j = 0; j < __DIM; j++)
                {
                    tup.C[0, j, k * __DIM + j] = C;
                }
            }
            //Create [B]  (for metric)
            tup.CtoB(elemDim, nDV);
            //Create [D] (for second derivative)
            t = tup.lo;
            for (int k = 0; k < dim - 1; k++)
            {
                hh[k] = (dim - k - 1) * (dim - k - 2) * Math.Pow(t, (dim - k - 3));
            }
            hh[dim - 1] = 0;
            hh[dim - 2] = 0;

            for (int k = 0; k < dim; k++)
            {
                double val = 0;
                for (int l = 0; l < dim; l++)
                {
                    val += hh[l] * M[l, k];
                }
                tt[k] = val;
            }
            for (int jj = 0; jj < __DIM; jj++)
            {
                for (int j = 0; j < nDV; j++)
                {
                    tup.D[0, 0, jj, j] = 0;
                }
            }
            for (int k = 0; k < nNode; k++)
            {
                //[D]
                double D = 1.0;
                D *= tt[dd[k]];
                for (int j = 0; j < __DIM; j++)
                {
                    tup.D[0, 0, j, k * __DIM + j] = D;
                }
            }
            compute(tup);
        }
示例#13
0
        public void compute(dl tup)
        {
            //Global position
            double X = 0, Y = 0, Z = 0;
            for (int i = 0; i < nDV; i++)
            {
                X += tup.shape[0, i] * node[i];
                Y += tup.shape[1, i] * node[i];
                Z += tup.shape[2, i] * node[i];
            }
            tup.x = X;
            tup.y = Y;
            tup.z = Z;
            //covariant base vectors
            double fx = 0, fy = 0;
            for (int i = 0; i < nDV; i++)
            {
                fx += tup.C[0, 0, i] * node[i];
                fy += tup.C[0, 1, i] * node[i];
            }
            tup.gi[0][0] = fx;
            tup.gi[0][1] = fy;
            tup.gi[0][2] = 0;
            tup.gij[0, 0] = tup.gi[0][0] * tup.gi[0][0] + tup.gi[0][1] * tup.gi[0][1] + tup.gi[0][2] * tup.gi[0][2];
            if (elemDim == 1)
            {
                _inv1(tup.gij, tup.Gij);
            }
            else if (elemDim == 2)
            {
                _inv2(tup.gij, tup.Gij);
            }
            else if (elemDim == 3)
            {
                _inv3(tup.gij, tup.Gij);
            }
            if (elemDim == 1)
            {
                tup.dv = Math.Sqrt(_det1(tup.gij));
            }
            else if (elemDim == 2)
            {
                tup.dv = Math.Sqrt(_det2(tup.gij));
            }
            else if (elemDim == 3)
            {
                tup.dv = Math.Sqrt(_det3(tup.gij));
            }
            tup.refDv = tup.dv;

            //contravatiant base vectors
            double Fx = 0, Fy = 0;
            Fx += tup.gi[0][0] * tup.Gij[0, 0];
            Fy += tup.gi[0][1] * tup.Gij[0, 0];
            tup.Gi[0][0] = Fx;
            tup.Gi[0][1] = Fy;
            tup.Gi[0][2] = 0;
            //Create gradient of hessian with computed connection coefficients
            for (int k = 0; k < nNode; k++)
            {
                tup.d2[0, 0][k] = tup.D[0, 0, 2, k * __DIM + 2];
            }
            for (int k = 0; k < nNode; k++)
            {
                tup.d1[0][k] = tup.C[0, 2, k * __DIM + 2];
            }
            for (int k = 0; k < nNode; k++)
            {
                tup.d0[k] = tup.shape[2, k * __DIM + 2];
            }
        }
 internal bool Deletes(dl delete, bool set = false, bool value = false)
 {
     if (set == false) { return deletes[(int)delete].isChecked; }
     else { deletes[(int)delete].isChecked = value; }
     return deletes[(int)delete].isChecked;
 }