Exemplo n.º 1
0
        public ElasticThread(Thread _protothread, GetBetaFunction getElsticBeta)
            : base(_protothread.nodes.ToList())
        {
            int L = nodes.GetLength(0);

            beta_1         = new double[L];
            lumen_sq_0     = new double[L];
            wall_thickhess = new double[L];
            viscosity      = new double[L];
            g_energy       = new double[L];


            for (int i = 0; i < L; i++)
            {
                double R0 = Math.Sqrt(nodes[i].lumen_sq_0 / Math.PI);
                beta = getElsticBeta(R0, nodes[i].elasticity);

                beta_1[i]         = beta / nodes[i].lumen_sq_0;
                wall_thickhess[i] = GlobalDefs.getBoileauWallThickness(R0, nodes[i].elasticity);
                lumen_sq_0[i]     = nodes[i].lumen_sq_0;
                lumen_sq[i]       = nodes[i].lumen_sq_0;
                pressure[i]       = GlobalDefs.DIASTOLIC_PRESSURE;
                //g_energy[i] = Vector1.Dot(nodes[i].position - GlobalDefs.ZERO_POINT, GlobalDefs.DOWN) * GlobalDefs.GRAVITY;
                g_energy[i]  = 0;
                viscosity[i] = GlobalDefs.BLOOD_VISC;
            }
#if FAST
            unsafe
            {
                double *dZ = (double *)Marshal.AllocHGlobal((L - 1) * sizeof(double));
                for (int i = 0; i < L - 1; i++)
                {
                    dZ[i] = Vector3.Distance(nodes[i + 1].position, nodes[i].position);
                }


                thread_solver = new McCormackThread(L, dZ, GlobalDefs.BLOOD_DENSITY, GlobalDefs.BLOOD_VISC, GlobalDefs.FRICTION_C);

                for (int i = 0; i < L; i++)
                {
                    int I = i;

                    _1DFunction_del pressure_func_del = delegate(double x)
                    {
                        return(calcPressure(x, I));
                    };

                    delegate1DFunc f = new delegate1DFunc(pressure_func_del);

                    thread_solver.addFunc(f, i);
                }

                fixed(double *g_ptr = &g_energy[0])
                {
                    //thread_solver.setGravity(g_ptr);
                }
            }
#endif

            clotes     = new List <Clot>();
            ffr_clotes = new List <FFRClot>();
        }
Exemplo n.º 2
0
 public delegate1DFunc(_1DFunction_del __1d_func_del)
 {
     _1d_func_del = __1d_func_del;
 }