Пример #1
0
        public override void removeClot(VascularNode nd)
        {
            int clt_id = clotes.FindIndex(x => x.c_nd == nd);

            if (clt_id != -1)
            {
                Clot clt = clotes[clt_id];
                clt.tgr_degree = 0.0;
                clotes[clt_id] = clt;
            }
        }
Пример #2
0
        public override void updateState()
        {
            for (int i = 0; i < clotes.Count; i++)
            {
                Clot clt = clotes[i];
                if (Math.Abs(clt.tgr_degree - clt.curr_degree) != 0.0)
                {
                    clt.curr_degree += Math.Sign(clt.tgr_degree - clt.curr_degree) * 0.001f;

                    if (Math.Abs(clt.tgr_degree - clt.curr_degree) < 0.01)
                    {
                        clt.curr_degree = clt.tgr_degree;
                    }

                    int L = 2; int sh = 0;
                    int nd_id = clt.thread_id;
                    for (int j = -L; j < L + 1; j++)
                    {
                        if (nd_id + j >= 0 && nd_id + j < nodes.GetLength(0))
                        {
                            double degree = clt.curr_degree * (L - Math.Abs(j) + 1) / (L + 1);
                            clt.nd[j + L + sh].lumen_sq_0 = clt.normal_lumen[j + L + sh] * (1 - degree);
                            lumen_sq_0[nd_id + j]         = clt.nd[j + L + sh].lumen_sq_0;
                            beta_1[nd_id + j]             = this.beta / clt.nd[j + L + sh].lumen_sq_0;
                        }
                        else
                        {
                            sh--;
                        }
                    }
                    clotes[i] = clt;
                }
                else
                {
                    if (clt.tgr_degree == 0.0)
                    {
                        clotes.RemoveAt(i);
                        break;
                    }
                }
            }
        }
Пример #3
0
        public override bool setClot(VascularNode nd, float degree)
        {
            int nd_id = 0;

            for (int i = 0; i < nodes.GetLength(0); i++)
            {
                if (nodes[i] == nd)
                {
                    nd_id = i; break;
                }
            }

            if (clotes.FindIndex(x => x.c_nd == nd) == -1)
            {
                Clot clt = new Clot();
                clt.c_nd = nd;

                clt.normal_lumen = new List <double>();
                clt.nd           = new List <VascularNode>();

                int L = 2;

                for (int i = -L; i < L + 1; i++)
                {
                    if (nd_id + i >= 0 && nd_id + i < nodes.GetLength(0))
                    {
                        clt.nd.Add(nodes[nd_id + i]);
                        clt.normal_lumen.Add(lumen_sq_0[nd_id + i]);
                    }
                }

                clt.tgr_degree  = degree;
                clt.curr_degree = 0;
                clt.thread_id   = nd_id;
                clotes.Add(clt);
                return(true);
            }

            return(false);
        }