Beispiel #1
0
        public void ComputeExternalForces()
        {
            if (MGModel.elasticExternalSpring)
            {
                for (int i = 0; i < externalEdges.getCount(); i++)
                {
                    externalEdges[i].force = MGModel.Force(externalEdges[i].length(), MGModel.J[externalEdges[i].ends[0].tissueId, externalEdges[i].ends[1].tissueId], MGModel.DCol);
                }

                for (int i = 0; i < externalEdges.getCount(); i++)
                {
                    externalEdges[i].ends[0].externalForces += externalEdges[i].force * externalEdges[i].UnitVector();
                    externalEdges[i].ends[1].externalForces -= externalEdges[i].force * externalEdges[i].UnitVector();
                }
            }

            for (int i = 0; i < externalEdges.getCount(); i++)
            {
                //Console.WriteLine(cellId + ", " + i + ", " + externalEdges[i].ends[1].nucleusForce0);
                if (!externalEdges[i].ends[1].nullForces)
                {
                    //externalEdges[i].ends[0].externalForces += externalEdges[i].ends[1].internalForces + externalEdges[i].ends[1].nucleusForce0 + externalEdges[i].ends[1].globalForces;
                    externalEdges[i].ends[1].externalForces += externalEdges[i].gamma * (externalEdges[i].ends[0].internalForces + externalEdges[i].ends[0].nucleusForce0 + externalEdges[i].ends[0].globalForces);
                }
                //else
                //    externalEdges[i].ends[0].externalForces += externalEdges[i].ends[1].internalForces + externalEdges[i].ends[1].nucleusForce0;
                //if(cellId>=50)
                //Console.WriteLine(externalEdges[i].ends[1].externalForces);
            }


            for (int i = 0; i < nbOfParticles; i++)
            {
                if (!vertices[i].nullForces)
                {
                    vertices[i].force = vertices[i].internalForces + vertices[i].nucleusForce0;

                    /*
                     * if (vertices[i].force.norm() > MGModel.maxForce)
                     *  vertices[i].force *= MGModel.maxForce / vertices[i].force.norm();
                     *
                     * if (vertices[i].externalForces.norm() > MGModel.maxForce)
                     *  vertices[i].externalForces *= MGModel.maxForce / vertices[i].externalForces.norm();
                     * //*/

                    //Console.WriteLine(cellId + ", " + i + ", " + vertices[i].externalForces);
                    vertices[i].force += vertices[i].externalForces + vertices[i].globalForces;
                }
                else
                {
                    vertices[i].force = new Vector();
                }
                //Console.WriteLine(cellId + ", " + i + ", " + vertices[i].internalForces + "; " + vertices[i].nucleusForce0 + "; " + vertices[i].externalForces);
                //Console.WriteLine(cellId + ", " + i + ", " + vertices[i].internalForces + "; " + vertices[i].nucleusForce0);
                //Console.WriteLine(cellId + ", " + i + ", " + vertices[i].force + "; " + vertices[i].force.norm());
            }
        }
Beispiel #2
0
        public void ComputeExternalForces()
        {
            if (MGModel.elasticExternalSpring)
            {
                /*
                 * Parallel.For(0, externalEdges.getCount(), i =>
                 * {
                 *  externalEdges[i].force = MGModel.Force(externalEdges[i].length(), MGModel.u1, externalEdges[i].l0);
                 * });
                 */

                for (int i = 0; i < externalEdges.getCount(); i++)
                {
                    //externalEdges[i].force = MGModel.Force(externalEdges[i].length(), MGModel.u1, externalEdges[i].l0);
                    externalEdges[i].force = MGModel.Force(externalEdges[i].length(), 5f, MGModel.DCol);
                }

                for (int i = 0; i < externalEdges.getCount(); i++)
                {
                    externalEdges[i].ends[0].externalForces += externalEdges[i].force * externalEdges[i].UnitVector();
                    externalEdges[i].ends[1].externalForces -= externalEdges[i].force * externalEdges[i].UnitVector();
                }
            }
            else
            {
                for (int i = 0; i < externalEdges.getCount(); i++)
                {
                    //if (!externalEdges[i].ends[0].nullForces)
                    externalEdges[i].ends[0].externalForces += externalEdges[i].ends[1].internalForces + externalEdges[i].ends[1].nucleusForce0 + externalEdges[i].ends[1].globalForces;
                    //else
                    //    externalEdges[i].ends[0].externalForces += externalEdges[i].ends[1].internalForces + externalEdges[i].ends[1].nucleusForce0;
                }
            }

            for (int i = 0; i < nbOfParticles; i++)
            {
                if (!vertices[i].nullForces)
                {
                    vertices[i].force = vertices[i].internalForces + vertices[i].nucleusForce0 + vertices[i].externalForces + vertices[i].globalForces;
                }
                //Console.WriteLine(cellId + ", " + i + ", " + vertices[i].internalForces + "; " + vertices[i].nucleusForce0 + "; " + vertices[i].externalForces);
            }
        }
Beispiel #3
0
        public void ComputeForces()
        {
            ResetCell();

            for (int i = 0; i < edgeCount(); i++)
            {
                //edges[i].force = MGModel.Force(edges[i].length(), MGModel.u0, edges[i].l0);
                edges[i].force = MGModel.Force(edges[i].length(), MGModel.J[tissueId, tissueId], edges[i].l0);
            }
            for (int i = 0; i < nucleusEdges.getCount(); i++)
            {
                //nucleusEdges[i].force = MGModel.Force(nucleusEdges[i].length(), MGModel.u0, nucleusEdges[i].l0);
                nucleusEdges[i].force = MGModel.Force(nucleusEdges[i].length(), MGModel.J[tissueId, tissueId], nucleusEdges[i].l0);
                //Console.WriteLine(cellId + ", " + i + ", " + nucleusEdges[i].force + "; " + nucleusEdges[i].l0 + "; " + nucleusEdges[i].length());
            }

            for (int i = 0; i < edgeCount(); i++)
            {
                edges[i].ends[0].internalForces += edges[i].force * edges[i].UnitVector();
                edges[i].ends[1].internalForces -= edges[i].force * edges[i].UnitVector();
            }
            for (int i = 0; i < nucleusEdges.getCount(); i++)
            {
                nucleusEdges[i].ends[0].nucleusForce0 += nucleusEdges[i].force * nucleusEdges[i].UnitVector();
                nucleusEdges[i].ends[1].force         -= nucleusEdges[i].force * nucleusEdges[i].UnitVector();
            }

            for (int i = 0; i < nbOfParticles; i++)
            {
                vertices[i].force = vertices[i].internalForces + vertices[i].nucleusForce0;
            }
        }
Beispiel #4
0
        public void ComputeForces()
        {
            ResetCell();

            for (int i = 0; i < edgeCount(); i++)
            {
                //edges[i].force = MGModel.Force(edges[i].length(), MGModel.u0, edges[i].l0);
                edges[i].force = MGModel.Force(edges[i].length(), MGModel.J[tissueId, tissueId], edges[i].l0);
            }
            for (int i = 0; i < nucleusEdges.getCount(); i++)
            {
                //nucleusEdges[i].force = MGModel.Force(nucleusEdges[i].length(), MGModel.u0, nucleusEdges[i].l0);
                nucleusEdges[i].force = MGModel.Force(nucleusEdges[i].length(), MGModel.J[tissueId, tissueId], nucleusEdges[i].l0);
            }

            for (int i = 0; i < edgeCount(); i++)
            {
                edges[i].ends[0].internalForces += edges[i].force * edges[i].UnitVector();
                edges[i].ends[1].internalForces -= edges[i].force * edges[i].UnitVector();
            }
            for (int i = 0; i < nucleusEdges.getCount(); i++)
            {
                nucleusEdges[i].ends[0].nucleusForce0 += nucleusEdges[i].force * nucleusEdges[i].UnitVector();
                nucleusEdges[i].ends[1].force         -= nucleusEdges[i].force * nucleusEdges[i].UnitVector();
            }
        }