示例#1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //Input
            DataTypes.PressureData presData = new DataTypes.PressureData();
            DA.GetData(0, ref presData);

            //Extract properties
            Point3d[]  pts    = new Point3d[presData.Locations.Length];
            Vector3d[] forces = new Vector3d[presData.Loads.Length];

            for (int i = 0; i < presData.Locations.Length; i++)
            {
                pts[i]    = presData.Locations[i];
                forces[i] = presData.Loads[i];
            }

            double p0   = presData.PresStart;
            double p1   = presData.PresEnd;
            double v0   = presData.VolStart;
            double v1   = presData.VolEnd;
            int    mol0 = presData.MolStart;
            int    mol1 = presData.MolEnd;


            //Output
            DA.SetDataList(0, pts);
            DA.SetDataList(1, forces);
            DA.SetData(2, p0);
            DA.SetData(3, p1);
            DA.SetData(4, v0);
            DA.SetData(5, v1);
            DA.SetData(6, mol0);
            DA.SetData(7, mol1);
        }
示例#2
0
            public override object Output(List <KangarooSolver.Particle> p)
            {
                Point3d[]  vertices = new Point3d[pMesh.Vertices.Count];
                Vector3d[] pForces  = new Vector3d[pMesh.Vertices.Count];

                for (int i = 0; i < pMesh.Vertices.Count; i++)
                {
                    vertices[i] = p[PIndex[i]].Position;
                    pForces[i]  = Move[i] * Weighting[i] * 1e-3;      // Unit: [kN]
                }

                //Create pressure data object to store output information
                double p0 = pres0 * 1e-3;       //Unit: [kN/m2]
                double p1 = pres1 * 1e-3;       //Unit: [kN/m2]

                if (negativePres)
                {
                    p0 *= -1.0;
                    p1 *= -1.0;
                }

                DataTypes.PressureData presData = new DataTypes.PressureData(vertices, pForces, Math.Round(p0, 3), Math.Round(p1, 3), Math.Round(vol0, 3), Math.Round(vol1, 3), Convert.ToInt32(mol0), Convert.ToInt32(mol1));
                return(presData);
            }