/// <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)
        {
            CellGrid2d g = new CellGrid2d();

            if (!DA.GetData(0, ref g))
            {
                return;
            }



            Vec2d[] vals  = new Vec2d[g.XRes * g.YRes];
            int     count = 0;

            for (int i = 0; i < g.XRes; i++)
            {
                for (int j = 0; j < g.YRes; j++)
                {
                    vals[count] = new Vec2d(g.Cells[i, j].A, g.Cells[i, j].B);
                    count++;
                }
            }
            //field.Set(vals);
            //DA.SetData(0, field);
        }
        /// <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)
        {
            debugLog.Clear();
            CellGrid2d grid = new CellGrid2d();
            Mesh       m    = null;

            if (!DA.GetData(0, ref m))
            {
                return;
            }
            if (!DA.GetData(1, ref grid))
            {
                return;
            }


            if (m.Faces.Count != grid.Cells.Length)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Mesh must have same amount of faces as cellgrid.");
            }

            debugLog.Add(grid.XRes.ToString());
            debugLog.Add(grid.YRes.ToString());
            debugLog.Add(grid.Cells.Length.ToString());

            foreach (Point3d v in m.Vertices)
            {
                m.VertexColors.Add(0, 0, 0);
            }

            double[] AFlat = new double[grid.Cells.Length];
            int      count = 0;

            for (int i = 0; i < grid.XRes; i++)
            {
                for (int j = 0; j < grid.YRes; j++)
                {
                    AFlat[count] = grid.Cells[i, j].A;
                    count++;
                }
            }

            for (int i = 0; i < m.Faces.Count; i++)
            {
                int[] indices = m.Faces.GetTopologicalVertices(i);
                int   val     = (int)SpatialSlur.SlurCore.SlurMath.Remap(AFlat[i], 0, 1, 0, 255);

                foreach (int ind in indices)
                {
                    m.VertexColors[ind] = Color.FromArgb(val, val, val);
                }
            }


            DA.SetDataList("debug", debugLog);
            DA.SetData("Mesh Output", m);
        }