コード例 #1
0
ファイル: RelativeField.cs プロジェクト: Erroman/universal
 private void CalcRelative()
 {
     ReferenceFrame.GetRelativeFrame(posFrame, fieldFrame, relative);
     double[] r = relative.Position;
     double[,] m = relative.Matrix;
     object[] o = field[r];
     double[] a = o[num] as double[];
     PhysicalFieldMeasurements3D.ProcessCovariantVector(a, m, x);
 }
コード例 #2
0
        void IMeasurements.UpdateMeasurements()
        {
            if (isUpdated)
            {
                return;
            }
            isUpdated = true;
            ReferenceFrame frame = position.GetParentFrame();

            foreach (IPhysicalField field in fields)
            {
                IPositionObject po = field as IPositionObject;
                IPosition       p  = po.Position;
                ReferenceFrame  ff = po.Position.GetParentFrame();
                ReferenceFrame.GetRelativeFrame(ff, frame, relative);
                double[] r = relative.Position;
                double[,] m = relative.Matrix;
                object[] o = null;
                try
                {
                    o = field[r];
                    fieldValue[field] = o;
                }
                catch (Exception ex)
                {
                    ex.ShowError(10);
                    o = GetFieldValue(field);
                }

                /* if (updatedFields[field])
                 * {
                 *   o = fieldValue[field];
                 * }
                 * else
                 * {
                 *   o = field[r];
                 *   updatedFields[field] = true;
                 *   fieldValue[field] = o;
                 * }*/
                IList <object>       res = results[field];
                IList <ProcessField> pr  = proc[field];
                for (int i = 0; i < o.Length; i++)
                {
                    object       result  = res[i];
                    ProcessField process = pr[i];
                    process(o[i], m, result);
                }
            }
            isUpdated = true;

            /*foreach (IPhysicalField field in fields)
             * {
             *  updatedFields[field] = false;
             * }*/
        }
コード例 #3
0
        private void update()
        {
            IDataConsumer  cons  = this;
            ReferenceFrame frame = position.GetParentFrame();
            int            ncol  = colored ? 3 : 1;

            foreach (IPhysicalField field in fieldAliases.Keys)
            {
                IPositionObject po = field as IPositionObject;
                ReferenceFrame  ff = po.Position.GetParentFrame();
                ReferenceFrame.GetRelativeFrame(ff, frame, relative);
                Dictionary <int, Transformer> d = fieldAliases[field];
                foreach (int nf in d.Keys)
                {
                    Transformer      tr         = d[nf];
                    FieldTransformer transfomer = tr.tr;
                    tr.tr.Set(relative);
                }
                int fc = facet.Count;
                for (int i = 0; i < fc; i++)
                {
                    double[] p = facet[i];
                    relative.GetRelativePosition(p, pos);
                    object[] o = field[pos];
                    foreach (int nf in d.Keys)
                    {
                        Transformer tr = d[nf];
                        object      ot = tr.tr.Transform(o[nf]);
                        tr.an.SetValue(ot);
                    }
                    foreach (int ns in surfaceAliaes.Keys)
                    {
                        object sp = facet[i, ns];
                        surfaceAliaes[ns].SetValue(sp);
                    }
                    this.FullReset();
                    cons.UpdateChildrenData();
                    for (int j = 0; j < measures.Count; j++)
                    {
                        parameters[i, j] = measures[j].Parameter();
                    }
                    if (colorMea[0] == null)
                    {
                        continue;
                    }
                    for (int nnc = 0; nnc < ncol; nnc++)
                    {
                        double col = (double)colorMea[0].Parameter();
                        if (proportional)
                        {
                            if (i == 0)
                            {
                                min[nnc] = col;
                                max[nnc] = col;
                            }
                            else
                            {
                                if (min[nnc] > col)
                                {
                                    min[nnc] = col;
                                }
                                if (max[nnc] < col)
                                {
                                    max[nnc] = col;
                                }
                            }
                            colorValues[i, nnc] = col;
                        }
                    }
                }
            }
            if (colorMea[0] != null)
            {
                draw();
            }
        }