private void CreateMesurements(IPhysicalField field)
        {
            string name = this.GetRelativeName(field as IAssociatedObject) + "_";

            name = name.Replace(".", "_");
            name = name.Replace("/", "_");
            int n = field.Count;
            IList <IMeasurement> lm = new List <IMeasurement>();
            IList <ProcessField> pr = new List <ProcessField>();
            IList <object>       lo = new List <object>();

            dic[field]     = lm;
            proc[field]    = pr;
            results[field] = lo;
            IMeasurement mea = null;

            measures.Clear();
            for (int i = 0; i < n; i++)
            {
                object       result = null;
                ProcessField pf     = null;
                string       na     = name + (i + 1);
                object       type   = field.GetType(i);
                object       tt     = field.GetTransformationType(i);
                if (type is ArrayReturnType)
                {
                    if (tt.Equals(Field3D_Types.CovariantVector))
                    {
                        pf = ProcessCovariantVector;
                    }
                    else
                    {
                        pf = ProcessInvariantVector;
                    }
                    ArrayReturnType art = type as ArrayReturnType;
                    int             dim = art.Dimension[0];
                    result = new double[dim];
                    mea    = new FieldMeasurement(na, type, result);
                }
                else
                {
                    pf     = ProcessSimpleType;
                    result = new object[1];
                    mea    = new FieldMeasurementElement(na, type, result as object[]);
                }
                lm.Add(mea);
                pr.Add(pf);
                lo.Add(result);
                measures.Add(mea);
            }
        }
Esempio n. 2
0
        public static int[] GetFields(IPhysicalField field, object type,
                                      object transformationType)
        {
            List <int> l = new List <int>();
            int        n = field.Count;

            for (int i = 0; i < n; i++)
            {
                object t  = field.GetType(i);
                object tr = field.GetTransformationType(i);
                if (t.Equals(type) & tr.Equals(transformationType))
                {
                    l.Add(i);
                }
            }
            return(l.ToArray());
        }